Skip to content

Add code coverage checks to CI - #6

Merged
thePunderWoman merged 1 commit into
mainfrom
ci/code-coverage
Aug 2, 2026
Merged

Add code coverage checks to CI#6
thePunderWoman merged 1 commit into
mainfrom
ci/code-coverage

Conversation

@thePunderWoman

Copy link
Copy Markdown
Owner

Summary

  • Instruments the native PlatformIO env with --coverage. PlatformIO's build_flags only reach the compile step, not the link step, so scripts/native_coverage_linkflags.py (wired up via extra_scripts) appends --coverage to LINKFLAGS too — otherwise the gcov runtime symbols are undefined at link time.
  • CI's native-tests job now runs gcovr against src/ (excluding main.cpp, which is Arduino-only and can't run on the native/host target) after the unit tests, writes a summary to the job summary, and fails the job if line coverage drops below 90%. No external service or account needed.
  • Documents the coverage bar in CLAUDE.md so it doesn't get quietly lowered just to unblock a PR.

Test plan

  • pio test -e native passes locally with coverage instrumentation enabled
  • gcovr --root . --filter 'src/' --exclude 'src/main\.cpp' --print-summary --fail-under-line 90 reports 100% coverage locally (macOS/clang, via --gcov-executable "xcrun llvm-cov gcov")
  • Confirm the coverage step passes on the Linux/gcc CI runner once this PR is opened

🤖 Generated with Claude Code

Instruments the native env with --coverage (gcc/clang gcov flags).
PlatformIO's build_flags only reach the compile step, not the link
step, so a small extra_scripts hook appends --coverage to LINKFLAGS
too — otherwise the gcov runtime symbols are undefined at link time.

CI now runs gcovr against src/ (excluding main.cpp, which is
Arduino-only and can't run on native) after the unit tests, prints a
summary to the job summary, and fails the job if line coverage drops
below 90%. No external service/account needed.

Also documents the coverage bar in CLAUDE.md so future changes keep
it in mind rather than lowering the threshold to unblock a PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@thePunderWoman
thePunderWoman merged commit 4a84cf5 into main Aug 2, 2026
2 checks passed
@thePunderWoman
thePunderWoman deleted the ci/code-coverage branch August 2, 2026 17:25
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