Re-add Codecov coverage reporting to GHA matrix workflow - #24804
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR re-introduces Codecov coverage reporting to the GitHub Actions matrix workflow after it was lost when CircleCI jobs were removed. Coverage is collected per matrix job using
Confidence Score: 5/5This PR is safe to merge — it adds only CI/coverage infrastructure with no changes to production code paths. All previously flagged issues (mutable tag, coverage filename mismatch) have been resolved. The OIDC upload approach is correctly scoped, action SHAs are pinned, relative_files=true + root_dir ensure path portability, and the isolated upload job keeps any write-capable tokens away from test execution. No P0 or P1 findings remain. No files require special attention.
|
| Filename | Overview |
|---|---|
| .github/workflows/test-litellm-matrix.yml | Adds coverage collection flags to every matrix pytest invocation, saves per-job XML artifacts, and adds an isolated upload-coverage job using OIDC; all action SHAs pinned, filename parametrisation correct, and permissions scoped appropriately. |
| codecov.yaml | Adds Enterprise component tracking enterprise/** paths; existing coverage thresholds and layout unchanged. |
| pyproject.toml | Adds pytest-cov ^5.0 to dev dependencies and [tool.coverage.run] config block with source=["litellm"] and relative_files=true for portable path resolution. |
Sequence Diagram
sequenceDiagram
participant M as matrix: test (N jobs)
participant AR as actions/upload-artifact
participant U as upload-coverage job
participant DA as actions/download-artifact
participant CC as Codecov (OIDC)
M->>M: pytest --cov=litellm --cov-report=xml:coverage-{name}.xml
M->>AR: upload artifact coverage-{name} (retention 1 day)
Note over M,AR: if: always() — captured even on partial failure
M-->>U: needs: test (all matrix jobs)
U->>U: actions/checkout (fetches codecov.yaml)
U->>DA: download-artifact pattern=coverage-* → coverage-reports/
DA-->>U: merged XML files
U->>CC: codecov-action v5.5.4 (OIDC, directory=coverage-reports, root_dir=workspace)
CC-->>U: upload ACK (fail_ci_if_error=false)
Reviews (19): Last reviewed commit: "Use unique filenames per matrix job to p..." | Re-trigger Greptile
Head branch was pushed to by a user without write access
be61ba7 to
efd3dc4
Compare
| --durations=20 \ | ||
| --cov=. \ | ||
| --cov-report=xml \ | ||
| --cov-config=pyproject.toml | ||
|
|
||
| - name: Save coverage report | ||
| if: always() | ||
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | ||
| with: | ||
| name: coverage-${{ matrix.test-group.name }} | ||
| path: coverage-${{ matrix.test-group.name }}.xml |
There was a problem hiding this comment.
Coverage filename mismatch — artifacts will always be empty
--cov-report=xml writes to coverage.xml by default. The upload-artifact step then looks for coverage-${{ matrix.test-group.name }}.xml, which will never exist, so every artifact is uploaded empty and Codecov receives nothing.
The fix is to pass the target filename directly to the --cov-report option:
| --durations=20 \ | |
| --cov=. \ | |
| --cov-report=xml \ | |
| --cov-config=pyproject.toml | |
| - name: Save coverage report | |
| if: always() | |
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | |
| with: | |
| name: coverage-${{ matrix.test-group.name }} | |
| path: coverage-${{ matrix.test-group.name }}.xml | |
| --durations=20 \ | |
| --cov=. \ | |
| --cov-report=xml:coverage-${{ matrix.test-group.name }}.xml \ | |
| --cov-config=pyproject.toml |
The "Debug coverage paths" step below also hard-codes coverage-root.xml as the file to inspect, which is only correct once the output filename is explicitly set this way.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
562c6f7 to
c903845
Compare
Re-add Codecov coverage reporting to GHA matrix workflow
Summary
Coverage upload was lost on 2026-03-28 when CircleCI jobs were removed (
7aec9101f). Thecodecov.yamlconfig was preserved but upload steps were never carried over to GitHub Actions.pytest-covto dev dependencies and regeneratepoetry.lock--cov=litellm --cov-report=xmlupload-coveragejob that runs after all test jobs, checks out repo (socodecov.yamlis present), downloads artifacts, and uploads to Codecov via OIDC (use_oidc: true) withroot_dirset so file paths resolve correctlyCODECOV_TOKENrequired — GitHub mints a short-lived OIDC token scoped to the job at runtimeEnterprisecomponent to existingcodecov.yamlfor separate enterprise coverage trackingcodecov-actionto immutable SHA (v5.5.4)Requires Codecov org "Global Upload Token" set to "Not Required" (already configured).
Test plan
litellm/confirmed on Codecov dashboardlitellm/...prefix)CODECOV_TOKENsecret required