Skip to content

fix: exclude generated and non-library code from codecov coverage - #1450

Open
khrm wants to merge 1 commit into
tektoncd:mainfrom
khrm:fix-codecov-ignore-patterns
Open

fix: exclude generated and non-library code from codecov coverage#1450
khrm wants to merge 1 commit into
tektoncd:mainfrom
khrm:fix-codecov-ignore-patterns

Conversation

@khrm

@khrm khrm commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user-facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 18, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from khrm after the PR has been reviewed.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 18, 2026

@khrm khrm left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Aug 18, 2026
@khrm
khrm force-pushed the fix-codecov-ignore-patterns branch 4 times, most recently from 6affbf5 to 796fe2a Compare August 18, 2026 16:03
@khrm
khrm requested a lite review from Copilot August 19, 2026 02:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.go entries from the coverage profile.
  • Updates .codecov.yaml ignore 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.

Comment thread .codecov.yaml Outdated
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>
@khrm
khrm force-pushed the fix-codecov-ignore-patterns branch from 796fe2a to a4f640c Compare August 19, 2026 06:19
@khrm
khrm requested a balanced review from Copilot August 19, 2026 06:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@divyansh42

Copy link
Copy Markdown
Member

/release-note-none

@tekton-robot

Copy link
Copy Markdown
Contributor

@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".

Details

In response to this:

/release-note-none

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.

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/misc Categorizes issue or PR as a miscellaneuous one. release-note-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants