Status: Accepted Date: 2025-12-13
We want to display dynamic code quality badges in the README that update automatically from CI runs. These badges should show:
- Line coverage (JaCoCo)
- Mutation score (PITest)
- SpotBugs status
Options considered:
- Static badges - Manual updates required, always stale
- Codecov/SonarCloud - External services, require accounts and configuration
- Shields.io endpoint badges - Self-hosted JSON files, no external accounts needed
Use Shields.io endpoint badges that read from JSON files committed to the /ci/badges/ directory.
The CI workflow uses three jobs with artifact-based data transfer:
- build-test - Runs tests, JaCoCo, Checkstyle, SpotBugs on all pushes/PRs
- Uploads test results and SpotBugs XML as artifacts
- mutation-test - Runs PITest mutation testing on 03 modules only (main branch only)
- Uploads mutation results as artifacts
- update-badges - Runs after both jobs complete (main branch only)
- Downloads artifacts from previous jobs
- Python script (
scripts/ci_metrics_summary.py) parses XML reports - Generates badge JSON files and commits with
[skip ci]
Shields.io fetches JSON from raw.githubusercontent.com and renders the badge.
{
"schemaVersion": 1,
"label": "coverage",
"message": "85.2%",
"color": "16A34A"
}[]- No external dependencies - No accounts, API keys, or third-party services
- Full control - We define colors, thresholds, and label text
- Automatic updates - Badges update on every main branch push
- Extensible - Easy to add new metrics (just add JSON file)
- Requires write access - CI needs permission to push to repo
- Main branch only - Badges don't update from PR builds
- Cache delay - GitHub raw content may be cached for a few minutes
| Metric | Green (90%+) | Amber (75%+) | Orange (60%+) | Red (<60%) |
|---|---|---|---|---|
| Coverage | 16A34A | F59E0B | EA580C | DC2626 |
| Mutation | 16A34A | F59E0B | EA580C | DC2626 |
| SpotBugs | 16A34A (0 issues) | - | - | DC2626 (any issues) |
- Shields.io Endpoint Badges
- Inspired by contact-suite-spring-react CI implementation