Replace Coveralls badge with self-hosted coverage badge on Pages#216
Merged
Replace Coveralls badge with self-hosted coverage badge on Pages#216
Conversation
Mirrors the active_admin_sidebar setup. SimpleCov already runs in the coverage job; this commit adds: - A step that reads coverage/.last_run.json, picks a shields.io color bucket, and writes a static badge.json in the shields endpoint format - An upload-artifact step for the badge - A deploy-coverage job (master pushes only) that downloads the badge and deploys it to GitHub Pages via actions/deploy-pages@v4 - Top-level permissions block (contents/pages/id-token) required by the Pages deployment actions The README badge is switched from the dead Coveralls endpoint (no workflow has pushed to it for years) to a shields.io endpoint badge pointing at the new gh-pages-served badge.json. After merging, the Pages source needs to be flipped from the legacy gh-pages branch to "GitHub Actions" workflow build, after which the gh-pages branch can be deleted.
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.
Summary
The README has been carrying a Coveralls badge for years, but no workflow in this repo actually pushes data to Coveralls (no
coverallsapp/github-action, nocoverallsgem). The badge has been showing whatever was last reported in the Travis era.SimpleCov already runs locally in the existing
coveragejob and producescoverage/.last_run.json. We can use that file directly to mint a static shields.io endpoint badge JSON, deploy it to GitHub Pages from CI, and have the README badge point at it. No third-party service.Changes
.github/workflows/test.ymlpermissionsblock (contents: read,pages: write,id-token: write) — required by the Pages deployment actionscoveragejob, after the SimpleCov run:badge/badge.json— readscoverage/.last_run.json, rounds the line percentage, picks a color bucket (brightgreen≥90,green≥75,yellow≥60, otherwisered), and writes a shields.io endpoint documentcoverage-badgeartifact with that filedeploy-coveragejob (only onpushtomaster):coverage-badgeartifactactions/upload-pages-artifact@v3actions/deploy-pages@v4into thegithub-pagesenvironmentREADME.md[coveralls_badge]/[coveralls_link]reference definitions![Coverage][coverage_badge]pointing athttps://img.shields.io/endpoint?url=https://activeadmin-plugins.github.io/active_admin_import/badge.jsonPost-merge steps (manual, by repo admin)
gh-pagesbranch to GitHub Actions workflow build:gh api -X POST repos/activeadmin-plugins/active_admin_import/pages/deploymentswon't do this; the source change has to go throughPUT repos/.../pagesor the UIRun workflowon master sodeploy-coveragepublishes the badgegh-pagesbranch can be deleted:git push origin --delete gh-pagesTest plan
pushto master so it won't run from this PR — it will first run after merge)