Skip to content

Add a coverage job and badge - #9

Merged
donald-heddesheimer merged 2 commits into
mainfrom
ci/coverage
Aug 16, 2026
Merged

Add a coverage job and badge#9
donald-heddesheimer merged 2 commits into
mainfrom
ci/coverage

Conversation

@donald-heddesheimer

Copy link
Copy Markdown
Owner

The CI is the strongest thing in this repo and nothing surfaced it. This adds a coverage job and a badge, plus a paragraph in the README that says out loud what the matrix already does.

The scoping problem solves itself

CADENCE_HAS_CUDA comes from __has_include(<cuda_runtime.h>) in platform.h, so on a runner with no CUDA toolkit every device path is preprocessed away before gcov sees it. That means no gcovr filter gymnastics and, more importantly, no dishonest denominator: the figure is what the no-GPU tests genuinely reach, not one diluted by lines only a GPU could execute. Those lines are compile-checked by the cuda job in the same run and exercised by cadence_device_tests on real hardware.

The number, measured in advance

Run locally against main with the same configuration the job uses:

include/cadence/cadence.h                      8        8   100%
include/cadence/detail/config.h               46       33    71%
include/cadence/detail/labels.h               20       20   100%
include/cadence/detail/nvtx.h                  4        4   100%
include/cadence/detail/registry.h            228      222    97%
include/cadence/detail/report.h              216      173    80%
include/cadence/detail/scopes.h               15       15   100%
include/cadence/detail/stats.h                66       65    98%
include/cadence/detail/thread_state.h          4        4   100%
include/cadence/detail/trace.h                62       54    87%
TOTAL                                        669      598    89%

89.4% lines, 98.7% functions. The two soft spots are honest ones: config.h is environment-override parsing that a test would have to setenv its way through, and report.h's gap is almost entirely WriteSummary, which #8 covers.

The gate is set below the number, deliberately

--fail-under-line 85 against a current 89.4%. A threshold pinned to the high-water mark turns every honest refactor into a coverage failure; this job is here to catch a regression, not to make the number a ratchet. The gate is what fails a bad change — Codecov is presentation, so fail_ci_if_error: false keeps a third-party outage from turning the job red.

The number is also written to $GITHUB_STEP_SUMMARY, so it is readable on the run page without opening a log or depending on Codecov at all.

Needs you before merging

  1. Authorize the Codecov app on this repo.
  2. Add CODECOV_TOKEN to Actions secrets.

Until then the job runs and gates correctly, but the README badge will read "unknown" rather than a percentage. Worth holding the merge until the token is in, or merging now and accepting a grey badge for a day — your call.

@donald-heddesheimer
donald-heddesheimer merged commit 935a69b into main Aug 16, 2026
9 checks passed
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.

1 participant