Commit 37931e8
ci: add coverage workflows (per-module + global gcovr, two-stage) (nasa#5167)
* ci: add coverage workflows (per-module + global gcovr)
Adds two GitHub Actions workflows under .github/workflows/ that call
the shared nasa/fprime-actions/coverage-common composite action:
coverage-check.yml - PR job. Triggers on pull_request to devel.
Computes per-module + global coverage on the
PR head, then writes a sticky comment to the
PR with the delta vs. the baseline stored at
nasa/fprime-coverage's coverage/<base_ref>
branch.
coverage-update.yml - Push job. Triggers on push to devel. Computes
coverage on the new tip and mirrors it into
nasa/fprime-coverage at coverage/devel for
future PR-jobs to baseline against.
Both workflows pin runs-on: ubuntu-24.04 because gcov-11 (the default
on ubuntu-22.04) has counter-overflow bugs (gcc#68080) and pathological
slowness on heavily-templated test code; gcov-13 (the default on
ubuntu-24.04) fixes both regressions. See the runner-version section
in nasa/fprime-actions/coverage-common/README.md for details.
For v1 the workflows are comment-only -- no merge gating, no required
status check. The sticky PR comment surfaces global headline coverage
+ per-module table + Largest Changes table so reviewers and the PR
author can see the impact of their changes without leaving the PR.
The PR comment renders module rows for every register_fprime_module(...)
directory that also declares register_fprime_ut(...). Modules whose
UT build fails (or whose gcovr run fails) surface as 'no coverage' rows
rather than killing the job (lenient by default; the action exposes a
'strict: true' input for callers that want hard gating).
Touches only the .github/ tree and the spell-check expect list. No
runtime code or tests are modified.
* ci(coverage): split into pull_request + workflow_run stages
Cross-fork PRs (e.g. JPL-Devin/fprime -> nasa/fprime) cannot post a
sticky coverage comment from the pull_request workflow: GitHub strips
write permissions from GITHUB_TOKEN on fork-triggered pull_request
events, so the POST returns 403 'Resource not accessible by
integration' regardless of what permissions: block requests.
Adopt the GitHub-recommended two-stage pattern matching the upstream
nasa/fprime-actions split (coverage-check + coverage-comment):
coverage-check.yml (event: pull_request)
Runs on fork content with permissions: contents: read only.
coverage-check@devel now generates the comment + regressions data
and uploads them as a workflow artifact (also writes the body to
GITHUB_STEP_SUMMARY so reviewers see the data on the Actions run
page). Drop pull-requests: write from the permissions block since
it is no longer needed and is silently ignored on fork PRs anyway.
coverage-comment.yml (event: workflow_run) [new file]
Triggered when Coverage Check completes successfully on a
pull_request event. Runs under the base repo's elevated token
with permissions: actions: read + pull-requests: write. Calls
coverage-comment@devel, which downloads the artifact from the
triggering run and upserts the sticky comment. Safe to grant
write because no fork code executes here.
The two-stage pattern means coverage-comment.yml must itself be on
nasa/fprime's default branch before workflow_run can fire it. For
this PR that means: the artifact-upload + step-summary path will run
on every push, but the actual PR comment will start posting only on
PRs landing AFTER this change merges to devel. This is an unavoidable
consequence of workflow_run requiring the listener workflow file to
exist on the default branch.
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 6a9b2c6 commit 37931e8
3 files changed
Lines changed: 139 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| 297 | + | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
0 commit comments