ci: report coverage to Codecov, add a badge - #27
Merged
Conversation
Adds a coverage badge. The configuration matters more than the badge, because the naive version of this is actively misleading here. internal/api/gen/zz_generated.go is 7,488 of the repository's 11,848 statements — 63% of the codebase — and is generated by oapi-codegen from the vendored spec. It has 0% coverage and always will; covering it means writing tests for somebody else's code generator. Left in, the reported figure is 23.4%. Excluded, it is 63.6%. The badge would have understated the tested-ness of the hand-written code by a factor of 2.7, so codecov.yml ignores that file and the number reflects code somebody here actually wrote. Per-package, the hand-written code runs 58-83% (internal/config 82.6%, internal/api 73.9%, cmd/domain 74.7%), with internal/output at 30.1% and cmd at 38.1% as the visible gaps. Three deliberate choices: - The coverage profile rides along on the existing test run rather than getting its own step. A second full `go test -race` would roughly double the job for a number the first run already computed. - Both project and patch status checks are informational. A coverage gate that fails a PR invites padding tests to clear a threshold, or merging past a red check until red checks stop meaning anything. - The upload step is continue-on-error with fail_ci_if_error false. Coverage reporting is not a correctness signal; Codecov being down or rate-limiting must not turn a PR red when the tests passed. The action is SHA-pinned like the other four, to commit fb8b358 — verified as the commit v7.0.0's annotated tag dereferences to, not the tag object's own SHA. Dependabot's github-actions group will bump it. Requires a CODECOV_TOKEN repository secret, which does not exist yet. The upload step no-ops without it; everything else in CI is unaffected.
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.
Adds the coverage badge. The configuration matters more than the badge here, because the naive version of this is actively misleading.
The number is wrong by 2.7x unless the generated client is excluded
internal/api/gen/zz_generated.gois 7,488 of the repository's 11,848 statements — 63% of the codebase — generated byoapi-codegenfrom the vendored spec. It has 0% coverage and always will; covering it means writing tests for somebody else's code generator.codecov.ymlignore)So the badge would have understated the tested-ness of the hand-written code by a factor of 2.7.
codecov.ymlignores that one file.Per-package, the hand-written code runs 58–83%:
cmd/apicmdcmd/configinternal/configcmd/dnscmd/ordercmd/contactcmd/dnsseccmd/urlcmd/domaincmd/cmdutilcmd/vanitycmd/emailinternal/apicmd/transferThe visible gaps are
internal/output(30.1%) andcmd(38.1%) — worth a look later, not in this PR.Three deliberate choices
go test -racewould roughly double that job for a number the first run already computed.projectandpatchstatuses areinformational. A coverage gate that fails a PR invites the two worst responses: padding tests to clear a threshold, or merging past a red check until red checks stop meaning anything.continue-on-errorwithfail_ci_if_error: false. Coverage reporting isn't a correctness signal — Codecov being down or rate-limiting must not turn a PR red when the tests passed.The action is SHA-pinned like the other four, to
fb8b358. Note that's the commit v7.0.0's annotated tag dereferences to — not the tag object's own SHA, which is what the naivegit/ref/tagslookup returns. Dependabot'sgithub-actionsgroup will bump it.CODECOV_TOKENdoes not exist on this repo yet. You'll need to:patramsey/namecom-cligh secret set CODECOV_TOKEN -R patramsey/namecom-cliUntil then the upload step no-ops (it's
continue-on-error), CI stays green, and the README badge renders as "unknown". Nothing else in CI is affected. Happy to hold this PR unmerged until the token's in place if you'd rather not have an unknown badge onmainin the meantime.Test plan
go test -race -count=1 -coverprofile=coverage.out ./...— the exact CI command — writes an 8,361-line profile locallycodecov.yml's ignore rule to that profile yields 63.6%, confirming what the badge will read