CI #272
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
| name: CI | |
| on: | |
| pull_request: # Run on all PR changes | |
| types: [opened, synchronize, reopened, labeled] | |
| push: # Run on all changes to main (includes PR merges) | |
| branches: | |
| - main | |
| schedule: # Scheduled workflows will only run on the default branch | |
| - cron: "50 23 * * *" # 11:50pm daily (to get ahead of all those midnight jobs) | |
| jobs: | |
| # Verify that the package builds successfully | |
| # For PRs: only runs if the cibuild label is present | |
| # Also runs on push to main and scheduled runs | |
| build-package: | |
| if: | | |
| (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'cibuild')) || | |
| github.event_name == 'push' || | |
| github.event_name == 'schedule' | |
| name: Build | |
| uses: ./.github/workflows/_build.yml | |
| # Run unit and integration tests | |
| run-tests: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| # For codecov OIDC verifications | |
| id-token: write | |
| contents: read | |
| strategy: | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # We need the full history to generate the proper version number | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ".[test,xarray]" | |
| - name: Testing | |
| run: | | |
| pytest --color=yes --cov --cov-report=xml | |
| - uses: codecov/codecov-action@v6 | |
| with: | |
| use_oidc: true | |
| # Run the example scripts and ensure there are no errors | |
| run-examples: | |
| name: Run Examples | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read # Minimal permissions required for checkout | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ".[examples]" | |
| - name: Test examples | |
| env: | |
| MPLBACKEND: Agg # Use non-interactive backend for matplotlib | |
| run: | | |
| cd examples | |
| for example in *.py; do | |
| echo "Testing $example..." | |
| python "$example" || { echo "Example $example failed"; exit 1; } | |
| echo "Example $example passed" | |
| done |