Skip to content

ci+readme: build and coverage badges - #2

Merged
WiktorStarczewski merged 1 commit into
mainfrom
ci/badges
Apr 23, 2026
Merged

WiktorStarczewski merged 1 commit into
mainfrom
ci/badges

Conversation

@WiktorStarczewski

Copy link
Copy Markdown
Owner

Summary

  • New `badge` job in the CI workflow runs only on green push-to-main.
  • It downloads the `coverage.out` artifact, composes a shields.io endpoint JSON with the aggregate percentage + a color threshold, and publishes to an orphan `badges` branch.
  • README gets two badges at the top: CI status + coverage.

Architecture note

Branch protection on `main` is enforced (no direct pushes). The badge job publishes to a separate `badges` branch — never touches `main` — so the protection is preserved end-to-end.

Coverage badge will show `invalid` until the first post-merge run completes, at which point shields.io picks up the freshly-published `coverage.json`.

Test plan

  • CI `test` job passes on this PR (coverage ≥ 90%).
  • After merge, `badge` job creates the `badges` branch with `coverage.json`.
  • README badges render correctly on main.

A second 'badge' job in the workflow runs only on a green push to main.
It reads the coverage.out artifact produced by the test job, composes a
shields.io endpoint JSON (coverage %, color threshold red→yellow→
brightgreen→green), and publishes it to a dedicated 'badges' branch.
The branch is an orphan — never merges back into main — so the main
branch protection remains intact (the bot never writes to main).

README gets two badges at the top:
- build status, read directly from the GitHub Actions workflow
- coverage, via shields.io reading raw content from the badges branch

The coverage badge will show 'invalid' until the first post-merge run
publishes coverage.json; after that it auto-updates on each push.
@WiktorStarczewski
WiktorStarczewski merged commit 20a9ebe into main Apr 23, 2026
2 checks passed
@WiktorStarczewski
WiktorStarczewski deleted the ci/badges branch April 23, 2026 23:17
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.

1 participant