ci: upload main test-shard coverage to codecov

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 <noreply@anthropic.com>
This commit is contained in:
Ashish Gaonker 2026-06-12 05:28:02 -07:00
parent 9ed6b082fb
commit 120696e54e

View file

@ -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'