From 120696e54ef49620c4bc40ae4a7cdc03ea5dde89 Mon Sep 17 00:00:00 2001 From: Ashish Gaonker Date: Fri, 12 Jun 2026 05:28:02 -0700 Subject: [PATCH] ci: upload main test-shard coverage to codecov MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Included in this PR because its codecov/patch check exposed the gap: the only coverage codecov receives today comes from the two native-e2e workflows, which run 3 CLI test files between them. The main 4-shard suite — where this PR's budget regression tests run and pass, covering 100% of the new record_tokens block — uploads nothing. Head coverage therefore reads ~6% against a 65% base recorded when uploads were broader, and codecov/patch fails for ANY diff not touched by those 3 files: a false negative on every PR. Add --cov=headroom + per-shard XML report to the test matrix and upload each shard with the same codecov-action@v4 pattern the e2e workflows already use (fail_ci_if_error: false). Codecov merges the four shard sessions into one head report. Co-Authored-By: Claude Fable 5 --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e463aca6..e371e2f9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -191,12 +191,26 @@ jobs: cp "${SITE}/headroom/"_core*.so headroom/ python -c "from headroom._core import DiffCompressor; print('headroom._core OK')" + # Coverage upload: without this, codecov only receives reports from + # the two native-e2e workflows (3 CLI test files total), so head + # coverage reads ~6% and codecov/patch fails for ANY diff not + # exercised by those files — a false negative on every PR. The main + # suite runs here; its coverage must be what codecov sees. - name: Run test shard ${{ matrix.shard }}/4 run: | pytest tests scripts/tests \ --splits 4 --group ${{ matrix.shard }} \ + --cov=headroom --cov-report=xml:coverage-shard-${{ matrix.shard }}.xml \ --tb=short -q + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + file: ./coverage-shard-${{ matrix.shard }}.xml + flags: unit + name: test-shard-${{ matrix.shard }} + fail_ci_if_error: false + test-extras: needs: [changes, build-wheel] if: needs.changes.outputs.code == 'true'