ci: report least-covered functions in coverage summary#1083
Draft
cpuguy83 wants to merge 1 commit into
Draft
Conversation
The coverage-report job's job summary previously showed only the total coverage percentage, giving no visibility into what is under-tested. Add cmd/covreport, which parses `go tool cover -func` output and renders a collapsible markdown section listing the top 20 functions below 100% coverage, sorted lowest-first. Wire it into the coverage-report job so the list is appended to $GITHUB_STEP_SUMMARY after the existing total. The tool reuses coverage/summary.txt (already produced by the `tee` on the `go tool cover -func` line), so no additional profile parsing is needed. It reports only; it never gates the build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Brian Goff <cpuguy83@gmail.com>
bcf7522 to
b57447f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
coverage-reportCI job's job summary previously showed only the total coverage percentage, giving no visibility into what is under-tested.This adds
cmd/covreport, a small testable helper that parsesgo tool cover -funcoutput and renders a## Missing coveragemarkdown section: a collapsible<details>table of the top 20 functions below 100% coverage, sorted lowest-first (Coverage | Function | Location). It's wired into thecoverage-reportjob so the list is appended to$GITHUB_STEP_SUMMARYright after the existing total.How
coverage/summary.txt(already produced by theteeon thego tool cover -funcline), so no additional profile parsing is needed.-input(default stdin),-top(default 20).total:line and malformed lines; emits "All tracked functions are fully covered." when nothing is below 100%.Tests
cmd/covreport/main_test.gocovers parsing,total:/malformed exclusion, the 100% filter, ascending sort with deterministic tie-breaks, top-N capping, full-list vs capped summaries, empty/all-covered input, and flag parsing.Verified locally:
go test,go vet, the repo's custom linter, andgo build ./cmd/...all pass; smoke-tested against real-funcoutput.