Skip to content

coverage: emit a markdown job summary from the report generator - #440

Merged
dcalavrezo-qorix merged 2 commits into
mainfrom
dcalavrezo_coverage_job_summary
Aug 24, 2026
Merged

coverage: emit a markdown job summary from the report generator#440
dcalavrezo-qorix merged 2 commits into
mainfrom
dcalavrezo_coverage_job_summary

Conversation

@dcalavrezo-qorix

Copy link
Copy Markdown
Contributor

Every consumer that wants a human-readable coverage summary on its workflow run page has been re-parsing the LCOV itself; the report generator now emits it directly.

  • New py_binary coverage_summary (stdlib only): parses the pipeline's LCOV (which includes the exact-0% baseline records), aggregates line/branch/file totals, and renders markdown — overall table with text progress bars, raw-vs-effective when a justification report exists, a per-directory rollup (first one/two path segments, worst first), and collapsible least-covered / exact-0% file lists, closing with a pointer to the HTML artifact.
  • generate_coverage_html: new optional --summary-md ; when the flag is absent and GITHUB_STEP_SUMMARY is set (GitHub Actions), the summary is appended there automatically; with neither, behavior is unchanged. Emitted BEFORE the threshold gate decides the exit code, so a failing gate still leaves the summary on the run page.
  • Edge cases covered by unit tests: missing/empty LCOV (note instead of crash), records with LF but no BRF (branch cells render as an em dash), BRDA fallback counting, zero denominators, non-UTF8 bytes in paths, markdown cell escaping.
  • Integration workspace: asserts summary content markers, append semantics for GITHUB_STEP_SUMMARY (existing content preserved), and that the summary survives a failing gate. The test script unsets GITHUB_STEP_SUMMARY first so CI runs don't spam the real run page.
  • Docs: adoption guide (README) and COVERAGE_GUIDE updated.

Every consumer that wants a human-readable coverage summary on its
workflow run page has been re-parsing the LCOV itself; the report
generator now emits it directly.

- New py_binary coverage_summary (stdlib only): parses the pipeline's
  LCOV (which includes the exact-0% baseline records), aggregates
  line/branch/file totals, and renders markdown — overall table with
  text progress bars, raw-vs-effective when a justification report
  exists, a per-directory rollup (first one/two path segments, worst
  first), and collapsible least-covered / exact-0% file lists, closing
  with a pointer to the HTML artifact.
- generate_coverage_html: new optional --summary-md <path>; when the
  flag is absent and GITHUB_STEP_SUMMARY is set (GitHub Actions), the
  summary is appended there automatically; with neither, behavior is
  unchanged. Emitted BEFORE the threshold gate decides the exit code,
  so a failing gate still leaves the summary on the run page.
- Edge cases covered by unit tests: missing/empty LCOV (note instead of
  crash), records with LF but no BRF (branch cells render as an em
  dash), BRDA fallback counting, zero denominators, non-UTF8 bytes in
  paths, markdown cell escaping.
- Integration workspace: asserts summary content markers, append
  semantics for GITHUB_STEP_SUMMARY (existing content preserved), and
  that the summary survives a failing gate. The test script unsets
  GITHUB_STEP_SUMMARY first so CI runs don't spam the real run page.
- Docs: adoption guide (README) and COVERAGE_GUIDE updated.
@github-actions

Copy link
Copy Markdown

Coverage Report

Coverage report was generated.

Full report can be downloaded from the CI artifacts (expand Artifacts at the bottom of the run).

Overall coverage rate:

lines......: 86.6%
functions......: 54.6%

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 questions, overall as far as I can tell this looks alright.
I can see it being quiet usefull, thanks for this.

Comment thread coverage/integration_tests/run_integration_test.sh
Comment thread coverage/BUILD
Comment thread coverage/coverage_summary.py
…string

Review follow-up for #440: comment why each summary test section deletes
summary.md before its own run (stale-file false passes; the failing-gate
section must prove re-creation), note that imports=[".."] is confined to
the *_lib unit-test import helpers, and state in the docstring that the
progress bar visualizes the coverage percentage.
@github-actions

Copy link
Copy Markdown

Coverage Report

Coverage report was generated.

Full report can be downloaded from the CI artifacts (expand Artifacts at the bottom of the run).

Overall coverage rate:

lines......: 86.6%
functions......: 54.6%

@dcalavrezo-qorix
dcalavrezo-qorix merged commit 970022e into main Aug 24, 2026
17 checks passed
@dcalavrezo-qorix
dcalavrezo-qorix deleted the dcalavrezo_coverage_job_summary branch August 24, 2026 11:27
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.

3 participants