Nightly CI #2930
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # adapted from xarray's nightly CI | |
| name: Nightly CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: "0 0 * * *" # Daily "At 00:00" UTC | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| detect-test-upstream-trigger: | |
| name: "Detect CI Trigger: [test-upstream]" | |
| if: | | |
| github.repository_owner == 'xarray-contrib' | |
| && (github.event_name == 'push' || github.event_name == 'pull_request') | |
| runs-on: ubuntu-slim | |
| outputs: | |
| triggered: ${{ steps.detect-trigger.outputs.trigger-found }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 2 | |
| persist-credentials: false | |
| - uses: xarray-contrib/ci-trigger@10cd2bfec3484946a4058a421ddf9cfad101e715 # v1.2.1 | |
| id: detect-trigger | |
| with: | |
| keyword: "[test-upstream]" | |
| upstream-dev: | |
| name: upstream-dev | |
| runs-on: ubuntu-latest | |
| needs: detect-test-upstream-trigger | |
| if: | | |
| always() | |
| && github.repository_owner == 'xarray-contrib' | |
| && ( | |
| (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') | |
| || needs.detect-test-upstream-trigger.outputs.triggered == 'true' | |
| || ( | |
| github.event_name == 'pull_request' | |
| && contains(github.event.pull_request.labels.*.name, 'run-upstream') | |
| ) | |
| ) | |
| outputs: | |
| artifacts_availability: ${{ steps.status.outputs.ARTIFACTS_AVAILABLE }} | |
| env: | |
| FORCE_COLOR: 3 | |
| steps: | |
| - name: checkout the repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| # need to fetch all tags to get a correct version | |
| fetch-depth: 0 # fetch all branches and tags | |
| persist-credentials: false | |
| - name: setup environment | |
| uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 | |
| with: | |
| environments: "nightly" | |
| locked: false | |
| frozen: false | |
| cache: false | |
| - name: import pint-xarray | |
| run: | | |
| pixi run -e nightly python -c 'import pint_xarray' | |
| - name: run tests | |
| if: success() | |
| id: status | |
| run: | | |
| pixi run -e nightly tests -rf --report-log=pytest-log.jsonl | |
| - name: upload the log file | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: log file | |
| path: pytest-log.jsonl | |
| create-issue: | |
| name: Report failures | |
| runs-on: ubuntu-latest | |
| needs: upstream-dev | |
| if: | | |
| always() | |
| && needs.upstream-dev.result == 'failure' | |
| && github.repository == 'xarray-contrib/pint-xarray' | |
| && github.event_name == 'schedule' | |
| permissions: | |
| issues: write # open issues if the tests failed | |
| steps: | |
| - name: download log file | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: log file | |
| - name: report failures | |
| uses: scientific-python/issue-from-pytest-log@8e905db353437cda1d6a773de245343fbfc940dd # v1.5.0 | |
| with: | |
| log-path: pytest-log.jsonl |