fix: exclude generated and non-library code from codecov coverage - #1450
fix: exclude generated and non-library code from codecov coverage#1450khrm wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
6affbf5 to
796fe2a
Compare
There was a problem hiding this comment.
Pull request overview
Adjusts Go coverage generation and Codecov configuration so reported coverage better reflects the repository’s library code by excluding generated, vendored, and non-library paths from the coverage denominator.
Changes:
- Updates the Go coverage GitHub Actions workflow to test a filtered package set and use
-coverpkg, then strips.pb.goentries from the coverage profile. - Updates
.codecov.yamlignore rules to use broader directory/glob patterns and ignore additional non-library paths. - Tweaks Codecov upload configuration by enabling
disable_search: true.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/go-coverage.yml | Generates coverage using a filtered go list package set + -coverpkg, removes .pb.go entries, and updates Codecov upload options. |
| .codecov.yaml | Reworks ignore patterns to exclude generated protobufs and other non-library paths from Codecov coverage accounting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov reports low coverage because it includes auto-generated protobuf code, vendored deps, CLI entry points, and test infrastructure in the denominator. Filter these out so coverage reflects actual library code. Mirrors the approach proven in tektoncd/triggers#2101. - Replace bare `go test ./...` with filtered package list + `-coverpkg` - Strip .pb.go files from profile - Add `disable_search: true` to codecov upload step - Use bare directory names and glob patterns in .codecov.yaml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
796fe2a to
a4f640c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
.github/workflows/go-coverage.yml:48
- This removes the workflow's existing test-failure tolerance. GitHub's Bash steps run with
-e, so any failing/flaky package now terminates this step before the profile is filtered or uploaded, leaving Codecov with no report. The referenced tektoncd/triggers#2101 implementation retained|| true; retain it here as well unless changing the workflow's failure semantics is intentional and documented.
go test -coverprofile=coverage_raw.out -covermode=atomic -coverpkg="$COVERPKG" $PACKAGES
|
/release-note-none |
|
@divyansh42: you can only set the release note label to release-note-none if the release-note block in the PR body text is empty or "none". DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov reports low coverage because it includes auto-generated protobuf code, vendored deps, CLI entry points, and test infrastructure in the denominator. Filter these out so coverage reflects actual library code. Mirrors the approach proven in tektoncd/triggers#2101.
go test ./...with filtered package list +-coverpkgdisable_search: trueto codecov upload stepChanges
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you review them:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes