Add GitHub Actions test workflow with coverage badge#2
Merged
Conversation
Runs `go test -race` on pushes and PRs. On main, publishes a coverage badge to an orphan `badges` branch via vladopajic/go-test-coverage (built-in GITHUB_TOKEN, no external service). README links the Test status and Coverage badges.
The source action compiles the tool with go run, and v2.18.8 needs Go >= 1.26 while this module pins go 1.23 — the action forces GOTOOLCHAIN=local so it can't upgrade. The root action runs a prebuilt image instead, independent of the runner Go version.
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
Adds CI that runs the test suite on every push and PR, and publishes a coverage badge on
main..github/workflows/test.yml— atestjob onubuntu-latest: sets up Go fromgo.mod, runsgo test -race -coverprofile=cover.out ./.... Onmain, also publishes the coverage badge.README.md— Test status + Coverage badges under the title.Coverage badge
Uses
vladopajic/go-test-coverage, which writes an SVG to an orphanbadgesbranch using the built-inGITHUB_TOKEN— no external service or secrets. On PRs the token is empty, so it only reports coverage (no push, no gate).Notes
badgesbranch already exists (the action requires it to be pre-created). The coverage badge image renders once the firstmainrun writes.badges/main/coverage.svg— i.e. after this PR merges. Until then the badge 404s; the Test badge works immediately.contents: write(scoped in the workflow). If it 403s, check Settings → Actions → General → Workflow permissions.cmd/pdfdumpandexamples/*have no tests, so total coverage lands ~51%. These can be excluded via a.testcoverage.ymlif preferred.