From c420a577b885c5fe16316a6d6469c69c9d2e9fb1 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 16 Nov 2026 20:15:41 +0100 Subject: [PATCH] CI: collect coverage only in the job that uploads it Only the ubuntu / Python 3.14 job uploads coverage to Codecov. Collecting it in the other jobs only slows them down, in particular on Python < 3.14: with `branch = True`, coverage.py can't use its `sys.monitoring`-based core there and falls back to the slower C tracer. E.g., pytest took 225 s on ubuntu / 3.12 vs 102 s on 3.14. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci_tests.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 1da3a9c0..8070bab7 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -17,6 +17,10 @@ jobs: platform: [windows-latest, macos-latest, ubuntu-latest] python-version: ["3.12", "3.14"] runs-on: ${{ matrix.platform }} + env: + # Coverage is only uploaded from one job. Elsewhere, it would only slow + # down the tests (substantially on Python < 3.14). + COVERAGE_ARGS: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.14' && '--cov=petab --cov-report=xml' || '' }} steps: - name: Check out repository @@ -39,14 +43,14 @@ jobs: run: | uv sync --no-default-groups --group test uv pip list - uv run pytest --cov=petab --cov-report=xml --cov-append --durations=10 tests + uv run pytest ${{ env.COVERAGE_ARGS }} --durations=10 tests - name: Coverage uses: codecov/codecov-action@v7 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml - if: matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.14' + if: env.COVERAGE_ARGS != '' doc: # Read the Docs covers PRs. Skipped jobs count as passing, so this can