1212 FORCE_COLOR : " 1"
1313
1414jobs :
15+ get-environments :
16+ runs-on : ubuntu-latest
17+ outputs :
18+ envs : ${{ steps.get-envs.outputs.envs }}
19+ pythons : ${{ steps.get-pythons.outputs.pythons }}
20+ steps :
21+ - uses : actions/checkout@v4
22+ with :
23+ fetch-depth : 0
24+ filter : blob:none
25+ - name : Install uv
26+ uses : astral-sh/setup-uv@v5
27+ - name : Get test environments
28+ id : get-envs
29+ run : |
30+ ENVS_JSON=$(
31+ FORCE_COLOR= uvx hatch env show --json |
32+ jq -c 'to_entries | map(select(.key | startswith("hatch-test")) | { name: .key, python: .value.python })'
33+ )
34+ echo "envs=$ENVS_JSON" | tee $GITHUB_OUTPUT
35+ - name : Get python versions
36+ id : get-pythons
37+ env :
38+ ENVS_JSON : ${{ steps.get-envs.outputs.envs }}
39+ run : |
40+ PYTHONS_JSON=$(echo "$ENVS_JSON" | jq -c 'map(.python) | unique')
41+ echo "pythons=$PYTHONS_JSON" | tee $GITHUB_OUTPUT
1542 test :
1643 name : Tests
44+ needs : get-environments
1745 runs-on : ubuntu-latest
1846 strategy :
1947 matrix :
20- include :
21- - python-version : " 3.13"
22- test-extra : test-min
23- - python-version : " 3.11"
24- - python-version : " 3.13"
48+ env : ${{ fromJSON(needs.get-environments.outputs.envs) }}
2549 steps :
2650 - uses : actions/checkout@v4
2751 with :
2852 fetch-depth : 0
2953 filter : blob:none
30- - uses : actions/setup-python@v5
31- with :
32- python-version : ${{ matrix.python-version }}
3354 - uses : astral-sh/setup-uv@v5
3455 with :
3556 enable-cache : true
3657 cache-dependency-glob : pyproject.toml
37- - run : uv pip install --system -e .[${{ matrix.test-extra || 'test' }}]
38- - run : |
39- coverage run -m pytest -m "not benchmark"
40- coverage report
58+ python-version : ${{ matrix.env.python }}
59+ - name : create environment
60+ run : uvx hatch env create ${{ matrix.env.name }}
61+ - name : run tests with coverage
62+ run : |
63+ uvx hatch run ${{ matrix.env.name }}:run-cov
4164 # https://github.com/codecov/codecov-cli/issues/648
42- coverage xml
65+ uvx hatch run ${{ matrix.env.name }}: coverage xml
4366 rm test-data/.coverage
4467 - uses : codecov/codecov-action@v5
4568 with :
46- name : Min Tests
69+ name : ${{ matrix.env.name }}
4770 fail_ci_if_error : true
4871 files : test-data/coverage.xml
4972 token : ${{ secrets.CODECOV_TOKEN }}
@@ -84,10 +107,11 @@ jobs:
84107 - run : python -c 'import testing.fast_array_utils as tfau; print(tfau.ArrayType("numpy", "ndarray"))'
85108 check :
86109 name : Static Checks
110+ needs : get-environments
87111 runs-on : ubuntu-latest
88112 strategy :
89113 matrix :
90- python-version : ["3.11", "3.13"]
114+ python-version : ${{ fromJSON(needs.get-environments.outputs.pythons) }}
91115 env :
92116 SKIP : no-commit-to-branch # this CI runs on the main branch
93117 steps :
@@ -99,3 +123,17 @@ jobs:
99123 with :
100124 python-version : ${{ matrix.python-version }}
101125 -
uses :
pre-commit/[email protected] 126+ pass :
127+ name : All Checks
128+ if : always()
129+ needs :
130+ - get-environments
131+ - test
132+ - bench
133+ - import
134+ - check
135+ runs-on : ubuntu-latest
136+ steps :
137+ - uses : re-actors/alls-green@release/v1
138+ with :
139+ jobs : ${{ toJSON(needs) }}
0 commit comments