Skip to content

Add GitHub Actions test workflow with coverage badge#2

Merged
pgundlach merged 3 commits into
mainfrom
claude/test-coverage-badge
Jun 18, 2026
Merged

Add GitHub Actions test workflow with coverage badge#2
pgundlach merged 3 commits into
mainfrom
claude/test-coverage-badge

Conversation

@fank

@fank fank commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

What

Adds CI that runs the test suite on every push and PR, and publishes a coverage badge on main.

  • .github/workflows/test.yml — a test job on ubuntu-latest: sets up Go from go.mod, runs go test -race -coverprofile=cover.out ./.... On main, 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 orphan badges branch using the built-in GITHUB_TOKEN — no external service or secrets. On PRs the token is empty, so it only reports coverage (no push, no gate).

Notes

  • The orphan badges branch already exists (the action requires it to be pre-created). The coverage badge image renders once the first main run writes .badges/main/coverage.svg — i.e. after this PR merges. Until then the badge 404s; the Test badge works immediately.
  • Badge push needs contents: write (scoped in the workflow). If it 403s, check Settings → Actions → General → Workflow permissions.
  • cmd/pdfdump and examples/* have no tests, so total coverage lands ~51%. These can be excluded via a .testcoverage.yml if preferred.

fank added 3 commits June 18, 2026 15:11
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.
@fank fank marked this pull request as ready for review June 18, 2026 13:21
@fank fank self-assigned this Jun 18, 2026
@fank fank requested a review from pgundlach June 18, 2026 13:22
@pgundlach pgundlach merged commit f2cc48b into main Jun 18, 2026
1 check passed
@fank fank deleted the claude/test-coverage-badge branch June 18, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants