Skip to content

Add coverage percent badge to README, auto-updated by CI#357

Merged
tinder-maxwellelliott merged 3 commits into
masterfrom
add-coverage-badge
May 20, 2026
Merged

Add coverage percent badge to README, auto-updated by CI#357
tinder-maxwellelliott merged 3 commits into
masterfrom
add-coverage-badge

Conversation

@tinder-maxwellelliott
Copy link
Copy Markdown
Collaborator

@tinder-maxwellelliott tinder-maxwellelliott commented May 20, 2026

Summary

  • Adds a shields.io endpoint coverage badge to the README, sourced from a coverage.json file in the repo root.
  • Extends tools/coverage_check.py with a --badge-json PATH flag that writes the shields.io schema (color-banded against the project's 90% gate). The script writes the JSON before the threshold check, so a regression below 90% still produces an honest value rather than freezing on the last-good one.
  • Adds a Publish coverage badge to master CI step that auto-commits coverage.json back to master after every push so the README badge tracks the latest tested state. Skipped on pull requests; the badge always reflects master.
  • Seeds coverage.json with a pending placeholder so the badge renders correctly until the first master push replaces it. (The auto-commit 599395a on this branch demonstrates the publish path working end-to-end — coverage measured at 91.0%.)

Why only master

PRs run CI and the threshold gate as usual, but they don't get a github-actions[bot] commit updating coverage.json. The badge is a master-state signal, not a per-PR signal.

Test plan

  • python3 tools/coverage_check_test.py — all 30 tests pass (6 new tests covering badge_color bands, JSON shape, parent-dir creation, threshold decoupling, and main() integration on pass + fail).
  • First push on this branch triggered the canonical Linux + Bazel 9.x runner to auto-commit 599395a, confirming the publish step works.
  • After merge, verify the README badge on master renders the brightgreen 91.0% value (or whatever post-merge coverage settles at).

Generated with Claude Code

tinder-maxwellelliott and others added 3 commits May 20, 2026 12:45
Wires up a shields.io endpoint badge sourced from coverage.json in the
repo so the README always shows the latest tested main-source coverage.

- tools/coverage_check.py gains a --badge-json PATH flag that writes the
  shields.io endpoint schema (color-banded against the 90% gate). Writing
  is decoupled from the threshold gate so a regression still surfaces in
  the badge instead of silently freezing on the last-good value.
- CI's existing coverage step is split into a Generate step (--threshold
  0, never gates) and the original strict Enforce step. A new Publish
  step commits coverage.json back to master on pushes and to the PR head
  branch on internal pull requests, so reviewers see the coverage delta
  directly in the PR diff. Skipped on fork PRs (GITHUB_TOKEN is
  read-only against forks) and on non-canonical matrix entries to avoid
  races on the same file.
- coverage.json is seeded with a "pending" placeholder so the badge
  renders correctly before the first master-merge CI run replaces it
  with the real value.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reverts the PR auto-update path: PRs no longer get a github-actions[bot]
commit updating coverage.json on each push. The badge now reflects
master's tested state, full stop.

The two-step Generate/Enforce split is collapsed back into the single
Enforce step (which still writes the badge as a side effect via
--badge-json, since the script writes before gating).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tinder-maxwellelliott tinder-maxwellelliott merged commit 748e90a into master May 20, 2026
15 checks passed
@tinder-maxwellelliott tinder-maxwellelliott deleted the add-coverage-badge branch May 20, 2026 17:37
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