1010 workflow_dispatch :
1111
1212env :
13- DEFAULT_PYTHON : " 3.12"
1413 PRE_COMMIT_CACHE : ~/.cache/pre-commit
1514
1615concurrency :
@@ -22,24 +21,27 @@ jobs:
2221 # This prevent upcoming jobs to do the same individually
2322 prepare :
2423 runs-on : ubuntu-latest
24+ strategy :
25+ matrix :
26+ python-version : ["3.12", "3.13"]
2527 outputs :
26- python-version : ${{ steps.python.outputs .python-version }}
27- name : Prepare Python dependencies
28+ python-version : ${{ matrix .python-version }}
29+ name : Prepare Python ${{ matrix.python-version }} dependencies
2830 steps :
2931 - name : Check out code from GitHub
30323133 - name : Set up Python
3234 id : python
33353436 with :
35- python-version : ${{ env.DEFAULT_PYTHON }}
37+ python-version : ${{ matrix.python-version }}
3638 - name : Restore Python virtual environment
3739 id : cache-venv
38403941 with :
4042 path : venv
4143 key : |
42- ${{ runner.os }}-venv-${{ steps.python.outputs .python-version }}-${{
44+ ${{ runner.os }}-venv-${{ matrix .python-version }}-${{
4345 hashFiles('pyproject.toml') }}
4446 - name : Create Python virtual environment
4547 if : steps.cache-venv.outputs.cache-hit != 'true'
@@ -66,24 +68,27 @@ jobs:
6668 pre-commit install-hooks
6769
6870 lint-ruff-format :
69- name : Check ruff-format
71+ name : Check ruff-format Python ${{ matrix.python-version }}
7072 runs-on : ubuntu-latest
7173 needs : prepare
74+ strategy :
75+ matrix :
76+ python-version : ["3.12", "3.13"]
7277 steps :
7378 - name : Check out code from GitHub
747975- - name : Set up Python ${{ needs.prepare.outputs .python-version }}
80+ - name : Set up Python ${{ matrix .python-version }}
76817782 id : python
7883 with :
79- python-version : ${{ needs.prepare.outputs .python-version }}
84+ python-version : ${{ matrix .python-version }}
8085 - name : Restore Python virtual environment
8186 id : cache-venv
82878388 with :
8489 path : venv
8590 key : |
86- ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version
91+ ${{ runner.os }}-venv-${{ env.DEFAULT_PYTHON
8792 }}-${{ hashFiles('pyproject.toml') }}
8893 - name : Fail job if Python cache restore failed
8994 if : steps.cache-venv.outputs.cache-hit != 'true'
@@ -112,24 +117,27 @@ jobs:
112117 RUFF_OUTPUT_FORMAT : github
113118
114119 lint-ruff :
115- name : Check ruff
120+ name : Check ruff Python ${{ matrix.python-version }}
116121 runs-on : ubuntu-latest
117122 needs : prepare
123+ strategy :
124+ matrix :
125+ python-version : ["3.12", "3.13"]
118126 steps :
119127 - name : Check out code from GitHub
120128121- - name : Set up Python ${{ needs.prepare.outputs .python-version }}
129+ - name : Set up Python ${{ matrix .python-version }}
122130123131 id : python
124132 with :
125- python-version : ${{ needs.prepare.outputs .python-version }}
133+ python-version : ${{ matrix .python-version }}
126134 - name : Restore Python virtual environment
127135 id : cache-venv
128136129137 with :
130138 path : venv
131139 key : |
132- ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version
140+ ${{ runner.os }}-venv-${{ env.DEFAULT_PYTHON
133141 }}-${{ hashFiles('pyproject.toml') }}
134142 - name : Fail job if Python cache restore failed
135143 if : steps.cache-venv.outputs.cache-hit != 'true'
@@ -158,24 +166,27 @@ jobs:
158166 RUFF_OUTPUT_FORMAT : github
159167
160168 lint-other :
161- name : Check other linters
169+ name : Check other linters Python ${{ matrix.python-version }}
162170 runs-on : ubuntu-24.04
163171 needs : prepare
172+ strategy :
173+ matrix :
174+ python-version : ["3.12", "3.13"]
164175 steps :
165176 - name : Check out code from GitHub
166177167- - name : Set up Python ${{ needs.prepare.outputs .python-version }}
178+ - name : Set up Python ${{ matrix .python-version }}
168179169180 id : python
170181 with :
171- python-version : ${{ needs.prepare.outputs .python-version }}
182+ python-version : ${{ matrix .python-version }}
172183 - name : Restore Python virtual environment
173184 id : cache-venv
174185175186 with :
176187 path : venv
177188 key : |
178- ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version
189+ ${{ runner.os }}-venv-${{ env.DEFAULT_PYTHON
179190 }}-${{ hashFiles('pyproject.toml') }}
180191 - name : Fail job if Python cache restore failed
181192 if : steps.cache-venv.outputs.cache-hit != 'true'
@@ -249,22 +260,25 @@ jobs:
249260 pytest :
250261 runs-on : ubuntu-latest
251262 needs : prepare
252- name : Run tests Python ${{ needs.prepare.outputs.python-version }}
263+ strategy :
264+ matrix :
265+ python-version : ["3.12", "3.13"]
266+ name : Run tests Python ${{ matrix.python-version }}
253267 steps :
254268 - name : Check out code from GitHub
255269256- - name : Set up Python ${{ needs.prepare.outputs .python-version }}
270+ - name : Set up Python ${{ matrix .python-version }}
257271258272 id : python
259273 with :
260- python-version : ${{ needs.prepare.outputs .python-version }}
274+ python-version : ${{ matrix .python-version }}
261275 - name : Restore Python virtual environment
262276 id : cache-venv
263277264278 with :
265279 path : venv
266280 key : |
267- ${{ runner.os }}-venv-${{ needs.prepare.outputs .python-version
281+ ${{ runner.os }}-venv-${{ matrix .python-version
268282 }}-${{ hashFiles('pyproject.toml') }}
269283 - name : Fail job if Python cache restore failed
270284 if : steps.cache-venv.outputs.cache-hit != 'true'
@@ -300,35 +314,23 @@ jobs:
300314 coverage :
301315 name : Process test coverage
302316 runs-on : ubuntu-latest
303- needs : ["pytest", "prepare" ]
317+ needs : ["pytest"]
304318 steps :
305319 - name : Check out code from GitHub
306320307- - name : Set up Python ${{ needs.prepare.outputs.python-version }}
308- 309- id : python
310- with :
311- python-version : ${{ needs.prepare.outputs.python-version }}
312- - name : Restore Python virtual environment
313- id : cache-venv
314- 315321 with :
316- path : venv
317- key : |
318- ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version
319- }}-${{ hashFiles('pyproject.toml') }}
320- - name : Fail job if Python cache restore failed
321- if : steps.cache-venv.outputs.cache-hit != 'true'
322- run : |
323- echo "Failed to restore Python virtual environment from cache"
324- exit 1
325- - name : Download all coverage artifacts
322+ fetch-depth : 0
323+ - name : Download coverage data
326324327- - name : Combine coverage results
325+ - name : Set up uv
326+ 327+ with :
328+ enable-cache : true
329+ - name : Install dependencies
330+ run : uv sync --frozen --dev
331+ - name : Process coverage results
328332 run : |
329- . venv/bin/activate
330- coverage combine coverage*/.coverage*
331- coverage report
332- coverage xml
333+ uv run --frozen coverage combine coverage*/.coverage*
334+ uv run --frozen coverage xml -i
333335 - name : Upload coverage to Codecov
334336
0 commit comments