|
10 | 10 | workflow_dispatch: |
11 | 11 |
|
12 | 12 | env: |
| 13 | + DEFAULT_PYTHON: "3.13" |
13 | 14 | PRE_COMMIT_CACHE: ~/.cache/pre-commit |
14 | 15 |
|
15 | 16 | concurrency: |
@@ -314,23 +315,35 @@ jobs: |
314 | 315 | coverage: |
315 | 316 | name: Process test coverage |
316 | 317 | runs-on: ubuntu-latest |
317 | | - needs: ["pytest"] |
| 318 | + needs: ["pytest", "prepare"] |
318 | 319 | steps: |
319 | 320 | - name: Check out code from GitHub |
320 | 321 | |
| 322 | + - name: Set up Python ${{ env.DEFAULT_PYTHON }} |
| 323 | + |
| 324 | + id: python |
321 | 325 | with: |
322 | | - fetch-depth: 0 |
323 | | - - name: Download coverage data |
324 | | - |
325 | | - - name: Set up uv |
326 | | - |
| 326 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 327 | + - name: Restore Python virtual environment |
| 328 | + id: cache-venv |
| 329 | + |
327 | 330 | with: |
328 | | - enable-cache: true |
329 | | - - name: Install dependencies |
330 | | - run: uv sync --frozen --dev |
331 | | - - name: Process coverage results |
| 331 | + path: venv |
| 332 | + key: > |
| 333 | + ${{ runner.os }}-venv-${{ env.DEFAULT_PYTHON }}- |
| 334 | + ${{ hashFiles('pyproject.toml') }} |
| 335 | + - name: Fail job if Python cache restore failed |
| 336 | + if: steps.cache-venv.outputs.cache-hit != 'true' |
332 | 337 | run: | |
333 | | - uv run --frozen coverage combine coverage*/.coverage* |
334 | | - uv run --frozen coverage xml -i |
| 338 | + echo "Failed to restore Python virtual environment from cache" |
| 339 | + exit 1 |
| 340 | + - name: Download all coverage artifacts |
| 341 | + |
| 342 | + - name: Combine coverage results |
| 343 | + run: | |
| 344 | + . venv/bin/activate |
| 345 | + coverage combine coverage*/.coverage* |
| 346 | + coverage report |
| 347 | + coverage xml |
335 | 348 | - name: Upload coverage to Codecov |
336 | 349 | |
0 commit comments