groups now hides NAs unless na_color is specified
#1253
Workflow file for this run
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: Test | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: "0 5 1,15 * *" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| MPLBACKEND: agg | |
| jobs: | |
| # Dynamically extract the test matrix from hatch so pyproject.toml is the single source of truth. | |
| # See [[tool.hatch.envs.hatch-test.matrix]] in pyproject.toml. | |
| get-environments: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| envs: ${{ steps.get-envs.outputs.envs }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| filter: blob:none | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Get test environments | |
| id: get-envs | |
| run: | | |
| ENVS_JSON=$(uvx hatch env show --json | jq -c 'to_entries | |
| | map( | |
| select(.key | startswith("hatch-test")) | |
| | { | |
| name: .key, | |
| label: (if (.key | contains("pre")) then .key + " (PRE-RELEASE DEPENDENCIES)" else .key end), | |
| python: .value.python | |
| } | |
| )') | |
| echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT | |
| test: | |
| needs: get-environments | |
| permissions: | |
| id-token: write # for codecov OIDC | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| env: ${{ fromJSON(needs.get-environments.outputs.envs) }} | |
| name: ${{ matrix.env.label }} | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ contains(matrix.env.name, 'pre') }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| filter: blob:none | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.env.python }} | |
| - name: Ensure figure directory exists | |
| run: mkdir -p tests/figures | |
| - name: Create hatch environment | |
| run: uvx hatch env create ${{ matrix.env.name }} | |
| - name: Run tests | |
| env: | |
| DISPLAY: ":42" | |
| run: >- | |
| uvx hatch run ${{ matrix.env.name }}:${{ | |
| matrix.env.name == 'hatch-test.py3.14-stable' && 'run-cov' || 'run' | |
| }} -v --color=yes ${{ | |
| matrix.env.name == 'hatch-test.py3.14-stable' && ' ' || '-n auto' | |
| }} | |
| - name: Generate coverage report | |
| if: matrix.env.name == 'hatch-test.py3.14-stable' | |
| run: | | |
| test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine | |
| uvx hatch run ${{ matrix.env.name }}:cov-report | |
| - name: Archive visual test figures | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: visual_test_results_${{ matrix.env.name }} | |
| path: tests/figures/* | |
| - name: Upload coverage | |
| if: matrix.env.name == 'hatch-test.py3.14-stable' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: true | |
| use_oidc: true | |
| # Single required check for branch protection. | |
| # See https://github.com/re-actors/alls-green#why | |
| check: | |
| name: Tests pass in all hatch environments | |
| if: always() | |
| needs: | |
| - get-environments | |
| - test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |