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,25 +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
87- }}-${{ hashFiles('pyproject.toml') }}
91+ ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
8892 - name : Fail job if Python cache restore failed
8993 if : steps.cache-venv.outputs.cache-hit != 'true'
9094 run : |
@@ -112,25 +116,27 @@ jobs:
112116 RUFF_OUTPUT_FORMAT : github
113117
114118 lint-ruff :
115- name : Check ruff
119+ name : Check ruff Python ${{ matrix.python-version }}
116120 runs-on : ubuntu-latest
117121 needs : prepare
122+ strategy :
123+ matrix :
124+ python-version : ["3.12", "3.13"]
118125 steps :
119126 - name : Check out code from GitHub
120127121- - name : Set up Python ${{ needs.prepare.outputs .python-version }}
128+ - name : Set up Python ${{ matrix .python-version }}
122129123130 id : python
124131 with :
125- python-version : ${{ needs.prepare.outputs .python-version }}
132+ python-version : ${{ matrix .python-version }}
126133 - name : Restore Python virtual environment
127134 id : cache-venv
128135129136 with :
130137 path : venv
131138 key : |
132- ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version
133- }}-${{ hashFiles('pyproject.toml') }}
139+ ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
134140 - name : Fail job if Python cache restore failed
135141 if : steps.cache-venv.outputs.cache-hit != 'true'
136142 run : |
@@ -158,25 +164,27 @@ jobs:
158164 RUFF_OUTPUT_FORMAT : github
159165
160166 lint-other :
161- name : Check other linters
167+ name : Check other linters Python ${{ matrix.python-version }}
162168 runs-on : ubuntu-24.04
163169 needs : prepare
170+ strategy :
171+ matrix :
172+ python-version : ["3.12", "3.13"]
164173 steps :
165174 - name : Check out code from GitHub
166175167- - name : Set up Python ${{ needs.prepare.outputs .python-version }}
176+ - name : Set up Python ${{ matrix .python-version }}
168177169178 id : python
170179 with :
171- python-version : ${{ needs.prepare.outputs .python-version }}
180+ python-version : ${{ matrix .python-version }}
172181 - name : Restore Python virtual environment
173182 id : cache-venv
174183175184 with :
176185 path : venv
177186 key : |
178- ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version
179- }}-${{ hashFiles('pyproject.toml') }}
187+ ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
180188 - name : Fail job if Python cache restore failed
181189 if : steps.cache-venv.outputs.cache-hit != 'true'
182190 run : |
@@ -249,22 +257,25 @@ jobs:
249257 pytest :
250258 runs-on : ubuntu-latest
251259 needs : prepare
252- name : Run tests Python ${{ needs.prepare.outputs.python-version }}
260+ strategy :
261+ matrix :
262+ python-version : ["3.12", "3.13"]
263+ name : Run tests Python ${{ matrix.python-version }}
253264 steps :
254265 - name : Check out code from GitHub
255266256- - name : Set up Python ${{ needs.prepare.outputs .python-version }}
267+ - name : Set up Python ${{ matrix .python-version }}
257268258269 id : python
259270 with :
260- python-version : ${{ needs.prepare.outputs .python-version }}
271+ python-version : ${{ matrix .python-version }}
261272 - name : Restore Python virtual environment
262273 id : cache-venv
263274264275 with :
265276 path : venv
266277 key : |
267- ${{ runner.os }}-venv-${{ needs.prepare.outputs .python-version
278+ ${{ runner.os }}-venv-${{ matrix .python-version
268279 }}-${{ hashFiles('pyproject.toml') }}
269280 - name : Fail job if Python cache restore failed
270281 if : steps.cache-venv.outputs.cache-hit != 'true'
@@ -300,35 +311,23 @@ jobs:
300311 coverage :
301312 name : Process test coverage
302313 runs-on : ubuntu-latest
303- needs : ["pytest", "prepare" ]
314+ needs : ["pytest"]
304315 steps :
305316 - name : Check out code from GitHub
306317307- - name : Set up Python ${{ needs.prepare.outputs.python-version }}
308- 309- id : python
310318 with :
311- python-version : ${{ needs.prepare.outputs.python-version }}
312- - name : Restore Python virtual environment
313- id : cache-venv
314- 315- 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
319+ fetch-depth : 0
320+ - name : Download coverage data
326321327- - name : Combine coverage results
322+ - name : Set up uv
323+ 324+ with :
325+ enable-cache : true
326+ - name : Install dependencies
327+ run : uv sync --frozen --dev
328+ - name : Process coverage results
328329 run : |
329- . venv/bin/activate
330- coverage combine coverage*/.coverage*
331- coverage report
332- coverage xml
330+ uv run --frozen coverage combine coverage*/.coverage*
331+ uv run --frozen coverage xml -i
333332 - name : Upload coverage to Codecov
334333
0 commit comments