Skip to content

Add a code coverage badge fed by the Build workflow - #148

Merged
derobins merged 2 commits into
developfrom
copilot/add-code-coverage-badge
Oct 8, 2026
Merged

derobins merged 2 commits into
developfrom
copilot/add-code-coverage-badge

Conversation

Copilot AI commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Adds a README badge that shows the library's line coverage from the Build workflow's coverage job.

Changes

  • Coverage step (hipobject-build.yml): the existing awk gate also writes build/coverage/coverage.json, the input file for a shields.io endpoint badge. A coverage value that isn't a plain number now fails the step.
    {"schemaVersion":1,"label":"coverage","message":"90.17%","color":"brightgreen"}
    The colour is brightgreen at 90% or above and yellowgreen otherwise. Below 80% the job fails, so that value is never published.
  • Upload: only the coverage job uploads the JSON as the coverage-badge artifact, and only on develop (push or workflow_dispatch), never on PRs.
  • New publish-coverage-badge job:
    • Runs after build (every matrix job must pass), on develop only, with job-level contents: write. It runs no repository code; it only copies the artifact, the same split as hipobject-documentation-deploy.yml.
    • Force-pushes a single orphan commit with only coverage.json to the badges branch, so the branch never grows. The first run creates it.
    • A job-level concurrency group allows one publish at a time.
  • README: Coverage badge next to Build, reading raw.githubusercontent.com/ROCm/hipObject/badges/coverage.json through img.shields.io/endpoint and linking to the Build workflow.
  • AGENTS.md: notes the publish step in the CI description.

Review notes

  • Branch protection: the job must be allowed to create and force-push badges. If a ruleset covers all branches, it needs an exception.
  • Only passing runs update the badge: it shows the latest develop run where every build configuration passed. A failed or below-target run leaves the previous value in place.
  • Out-of-order runs: two develop pushes close together can finish in either order, so the badge can briefly show the older commit's number. The next push corrects it.
  • No changelog entry, since this only changes CI.

Copilot AI and others added 2 commits October 8, 2026 21:59
Co-authored-by: derobins <43805+derobins@users.noreply.github.com>
Co-authored-by: derobins <43805+derobins@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The badge publication is appropriately validated, scoped, and isolated from repository code execution.

0 open findings

What changed in this PR

Adds a README coverage badge backed by the Build workflow’s successful develop coverage results.

Changes:

  • Generates and uploads validated Shields-compatible coverage JSON.
  • Publishes the artifact to an orphan badges branch.
  • Documents and displays the coverage badge.
File Description
.github/​workflows/​hipobject-build.yml Generates, uploads, and publishes badge data.
README.md Adds the coverage badge.
AGENTS.md Documents coverage publication behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@derobins
derobins merged commit c8a2a56 into develop Oct 8, 2026
22 checks passed
@derobins
derobins deleted the copilot/add-code-coverage-badge branch October 8, 2026 22:08
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.

3 participants