[WIP] Add code coverage grading workflow#13140
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13140 +/- ##
============================================
- Coverage 18.08% 18.08% -0.01%
- Complexity 16718 16750 +32
============================================
Files 6037 6037
Lines 542546 543894 +1348
Branches 66432 66922 +490
============================================
+ Hits 98146 98378 +232
- Misses 433378 434483 +1105
- Partials 11022 11033 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 22.71% |
| Branch coverage | 17.13% |
Grade Scale
| Grade | Line Coverage | Meaning |
|---|---|---|
| 🟢 A | ≥ 80% | Excellent |
| 🟡 B | 60–79% | Good |
| 🟠 C | 40–59% | Acceptable |
| 🔴 D | 20–39% | Marginal — meets minimum gate |
| ⛔ F | < 20% | Failing — below minimum gate |
Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 22.70% |
| Branch coverage | 17.14% |
Grade Scale
| Grade | Line Coverage | Meaning |
|---|---|---|
| 🟢 A | ≥ 80% | Excellent - this code sleeps well at night 😴 |
| 🟡 B | 60-79% | Good - almost there, don't stop now 😉 |
| 🟠 C | 40-59% | Acceptable - your code is wearing a seatbelt, but no airbags 😬 |
| 🔴 D | 20-39% | Marginal - boldly shipping where no test has gone before 🖖 |
| ⛔ F | < 20% | Failing - tests? what tests? 🔥 |
Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a CI mechanism to compute an A–F grade from JaCoCo aggregate coverage and surface it in GitHub Actions (step summary + PR comment) to encourage improving test coverage over time.
Changes:
- Added
scripts/coverage-grade.shto parse JaCoCo XML and compute line/branch coverage percentages and an A–F grade. - Updated
.github/workflows/codecov.ymlto run the grading script and post the grade as a PR comment, plus adjusted workflow permissions/conditions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
scripts/coverage-grade.sh |
New script to parse JaCoCo XML and emit coverage percentages/grade, plus GitHub Actions outputs and step summary. |
.github/workflows/codecov.yml |
Runs the grade script after coverage upload and posts the computed grade to PRs via actions/github-script. |
Comments suppressed due to low confidence (2)
.github/workflows/codecov.yml:25
- The inline comment says the permission is required to "post/update" the grade comment, but the workflow currently always creates a new comment (no update). Either adjust the comment to match behavior, or change the script to find and update a prior comment to avoid misleading documentation.
contents: read
pull-requests: write # required to post/update the grade comment on PRs
.github/workflows/codecov.yml:105
- The grade-scale text is duplicated here rather than being sourced from the script output, which makes it easy for the PR comment and the step summary/stdout report to drift over time. Consider having
coverage-grade.shemit a single markdown block (e.g., as a multiline GitHub Action output) and reuse it in the comment body.
const body = [
`## ${emoji} Test Coverage Grade: \`${grade}\` — ${label}`,
'',
'| Metric | Value |',
'|--------|-------|',
`| Line coverage | **${linePct}%** |`,
branchRow,
'',
'### Grade Scale',
'| Grade | Line Coverage | Meaning |',
'|-------|--------------|---------|',
'| 🟢 A | ≥ 80% | Excellent - this code sleeps well at night 😴 |',
'| 🟡 B | 60-79% | Good - almost there, don\'t stop now 😉 |',
'| 🟠 C | 40-59% | Acceptable - your code is wearing a seatbelt, but no airbags 😬 |',
'| 🔴 D | 20-39% | Marginal - boldly shipping where no test has gone before 🖖 |',
'| ⛔ F | < 20% | Failing - tests? what tests? 🔥 |',
'',
'> Branch coverage is shown as a secondary signal. Grade is determined by **line coverage**.',
`> [View full Actions run](${runUrl})`,
].filter(l => l !== undefined).join('\n');
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write # required to post/update the grade comment on PRs |



Description
This PR adds a github workflow to add grades to the code coverage. An attempt to encourage increasing overall test coverage of the project.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?