12
12
FORCE_COLOR : " 1"
13
13
14
14
jobs :
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
15
42
test :
16
43
name : Tests
44
+ needs : get-environments
17
45
runs-on : ubuntu-latest
18
46
strategy :
19
47
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) }}
25
49
steps :
26
50
- uses : actions/checkout@v4
27
51
with :
28
52
fetch-depth : 0
29
53
filter : blob:none
30
- - uses : actions/setup-python@v5
31
- with :
32
- python-version : ${{ matrix.python-version }}
33
54
- uses : astral-sh/setup-uv@v5
34
55
with :
35
56
enable-cache : true
36
57
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
41
64
# https://github.com/codecov/codecov-cli/issues/648
42
- coverage xml
65
+ uvx hatch run ${{ matrix.env.name }}: coverage xml
43
66
rm test-data/.coverage
44
67
- uses : codecov/codecov-action@v5
45
68
with :
46
- name : Min Tests
69
+ name : ${{ matrix.env.name }}
47
70
fail_ci_if_error : true
48
71
files : test-data/coverage.xml
49
72
token : ${{ secrets.CODECOV_TOKEN }}
@@ -84,10 +107,11 @@ jobs:
84
107
- run : python -c 'import testing.fast_array_utils as tfau; print(tfau.ArrayType("numpy", "ndarray"))'
85
108
check :
86
109
name : Static Checks
110
+ needs : get-environments
87
111
runs-on : ubuntu-latest
88
112
strategy :
89
113
matrix :
90
- python-version : ["3.11", "3.13"]
114
+ python-version : ${{ fromJSON(needs.get-environments.outputs.pythons) }}
91
115
env :
92
116
SKIP : no-commit-to-branch # this CI runs on the main branch
93
117
steps :
@@ -99,3 +123,17 @@ jobs:
99
123
with :
100
124
python-version : ${{ matrix.python-version }}
101
125
-
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