Skip to content

ci: add GitHub Pages coverage report and restructure workflows - #28

Merged
tkhquang merged 3 commits into
mainfrom
ci/coverage-page
Mar 22, 2026
Merged

ci: add GitHub Pages coverage report and restructure workflows#28
tkhquang merged 3 commits into
mainfrom
ci/coverage-page

Conversation

@tkhquang

@tkhquang tkhquang commented Mar 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add coverage-pages.yml workflow: builds, tests, generates HTML coverage via gcovr, and deploys to GitHub Pages on every push to main.
  • Rename ci.ymlpr-check.yml to clarify its role as the PR gate (no functional changes).
  • Move generated coverage output to docs/tests/coverage/ with its own .gitignore to prevent stale file accumulation.
  • Update parse_coverage.py to accept an optional path argument (defaults to new location).
  • Rewrite docs/tests/test_coverage_guide.md to match current codebase (fix broken fences, correct file names/line counts, add integration test docs, update all commands).
  • Update README badges and add link to live coverage report.

Live coverage

https://tkhquang.github.io/DetourModKit/

Test plan

  • 597/597 tests pass
  • Coverage HTML generation verified locally (83.1% line, 94.1% function)
  • parse_coverage.py works with new default path
  • All commands in test_coverage_guide.md verified

Summary by CodeRabbit

  • New Features

    • Coverage reports are published to GitHub Pages on pushes to main (and can be deployed manually).
  • Documentation

    • Comprehensive rewrite of the test coverage guide and updated README badge/links to the published coverage site.
  • Tests

    • Coverage parsing script accepts an optional input path for flexible report processing.
  • Chores

    • PR workflow display name updated; .gitignore adjusted for coverage output directory handling.

@tkhquang tkhquang self-assigned this Mar 22, 2026
@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 19743645-4d11-4b36-943c-5d2311e33be4

📥 Commits

Reviewing files that changed from the base of the PR and between 5bfd441 and 703d588.

📒 Files selected for processing (3)
  • .gitignore
  • README.md
  • docs/tests/test_coverage_guide.md
✅ Files skipped from review due to trivial changes (1)
  • .gitignore

📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that builds with MinGW, runs tests with coverage, generates an HTML coverage report, and publishes it to GitHub Pages; also renames a PR workflow display name, adjusts .gitignore coverage rules, updates README badges/links, modifies a coverage parsing script, and rewrites the test coverage guide.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
\.github/workflows/coverage-pages.yml, \.github/workflows/pr-check.yml
Adds coverage-pages.yml to build via CMake preset mingw-debug, run tests, produce gcovr HTML coverage, upload and deploy to GitHub Pages; updates PR workflow display name.
Documentation & Guides
README.md, docs/tests/test_coverage_guide.md
README badge and links updated to point at Pages coverage; test_coverage_guide.md fully rewritten with new build/test workflows, coverage output locations, testing guidance, thresholds, and project layout changes.
Coverage Tooling Script
docs/tests/parse_coverage.py
Accepts optional CLI path for coverage JSON; defaults to computed docs/tests/coverage/coverage.json relative to script location.
Repository Ignore Rules
.gitignore
Removed broad coverage ignores; added a targeted ignore for docs/tests/coverage/ and preserved its own .gitignore.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Actions as "GitHub Actions Runner"
participant Checkout as "Repo + Submodules"
participant Build as "CMake (mingw-debug)"
participant TestExe as "Test Binary (DetourModKit_tests.exe)"
participant Coverage as "gcovr"
participant Pages as "GitHub Pages"

Note over Actions,Checkout: Trigger (push to main / manual)
Actions->>Checkout: checkout repo (recursive submodules)
Actions->>Build: configure & build with coverage
Build->>TestExe: produce test binary + copy DLL deps
Actions->>TestExe: run tests (JUnit XML output)
TestExe-->>Actions: exit code + test-results.xml
Actions->>Coverage: run gcovr against build dir -> generate HTML report
Coverage-->>Actions: coverage-report/
Actions->>Pages: upload artifact and deploy
Pages-->>Actions: return page_url

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main changes: adding a GitHub Pages coverage report workflow and restructuring CI workflows.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
.gitignore (1)

8-9: Prefer explicit allow-list for the nested ignore file.

docs/tests/coverage/ works, but it’s safer to explicitly keep docs/tests/coverage/.gitignore unignored so the directory policy remains maintainable.

Suggested `.gitignore` tweak
-# Coverage reports (generated into docs/tests/coverage/, has its own .gitignore)
-docs/tests/coverage/
+# Coverage reports (generated into docs/tests/coverage/)
+docs/tests/coverage/*
+!docs/tests/coverage/.gitignore
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.gitignore around lines 8 - 9, The ignore rule "docs/tests/coverage/"
currently ignores the entire directory including its .gitignore, which makes
managing per-directory ignores brittle; update .gitignore to explicitly allow
the nested keep-file by adding an explicit negation for that file (e.g., add a
line to unignore docs/tests/coverage/.gitignore) so the directory-level policy
remains maintainable while keeping the coverage artefacts ignored.
.github/workflows/coverage-pages.yml (1)

47-49: Pin gcovr to a tested version for CI reproducibility.

The workflow uses --gcov-ignore-parse-errors=negative_hits.warn_once_per_file (introduced in gcovr 6.0), so pinning to at least pip install "gcovr>=6.0" ensures both consistent behavior and feature support. Unpinned installs risk breakage when new releases change CLI behavior—latest version 8.6 was released in January 2026.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coverage-pages.yml around lines 47 - 49, Update the CI
step that currently runs the command `pip install gcovr` (the step named
"Install gcovr") to pin a tested version that supports the
`--gcov-ignore-parse-errors=negative_hits.warn_once_per_file` flag; change the
command to install a minimum version, e.g. `pip install "gcovr>=6.0"`, so CI
behavior is reproducible and robust against upstream CLI changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/coverage-pages.yml:
- Around line 51-57: The workflow currently caches the CMake build directory
("Cache CMake build" step) at path build/mingw-debug using the key
cmake-build-${{ runner.os }}-... which can reuse stale coverage artifacts;
remove or disable this cache step (or change it to exclude any coverage output)
from the coverage/publish job so published coverage is always generated from a
fresh build, ensuring accuracy when running the coverage/publish workflow.

In `@docs/tests/parse_coverage.py`:
- Around line 4-7: The fallback coverage_path uses a CWD-relative literal which
breaks when the script is run from other directories; change the coverage_path
assignment to compute a path relative to the script file (use __file__ and
pathlib.Path.resolve().parent) and join it with 'coverage/coverage.json' so the
default points to the repo docs/tests/coverage file regardless of CWD, and
ensure pathlib.Path is imported if not already; keep handling of sys.argv[1]
unchanged and then open that resolved path before calling json.load.

In `@docs/tests/test_coverage_guide.md`:
- Around line 35-37: The gcovr invocation uses --filter "include/DetourModKit/"
which differs from CI's --filter "include/" and can cause inconsistent coverage;
update the gcovr commands (the lines containing python -m gcovr --root .
--filter "src/" --filter "include/DetourModKit/" --exclude ...) to use the same
--filter "include/" as CI (and make the same replacement in the other
occurrences noted near the same sections), ensuring local and CI coverage
filters match exactly.

In `@README.md`:
- Line 198: Update the sentence that currently reads "a 80% minimum line
coverage gate" to use the correct article: change "a 80% minimum line coverage
gate" to "an 80% minimum line coverage gate" in the README text (the line
mentioning CI PR Check workflow and coverage gate).

---

Nitpick comments:
In @.github/workflows/coverage-pages.yml:
- Around line 47-49: Update the CI step that currently runs the command `pip
install gcovr` (the step named "Install gcovr") to pin a tested version that
supports the `--gcov-ignore-parse-errors=negative_hits.warn_once_per_file` flag;
change the command to install a minimum version, e.g. `pip install
"gcovr>=6.0"`, so CI behavior is reproducible and robust against upstream CLI
changes.

In @.gitignore:
- Around line 8-9: The ignore rule "docs/tests/coverage/" currently ignores the
entire directory including its .gitignore, which makes managing per-directory
ignores brittle; update .gitignore to explicitly allow the nested keep-file by
adding an explicit negation for that file (e.g., add a line to unignore
docs/tests/coverage/.gitignore) so the directory-level policy remains
maintainable while keeping the coverage artefacts ignored.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 084106ae-cd15-452f-be1e-971dcfc30298

📥 Commits

Reviewing files that changed from the base of the PR and between 6d6ce1e and e772863.

📒 Files selected for processing (6)
  • .github/workflows/coverage-pages.yml
  • .github/workflows/pr-check.yml
  • .gitignore
  • README.md
  • docs/tests/parse_coverage.py
  • docs/tests/test_coverage_guide.md

Comment thread .github/workflows/coverage-pages.yml Outdated
Comment thread docs/tests/parse_coverage.py Outdated
Comment thread docs/tests/test_coverage_guide.md Outdated
Comment thread README.md Outdated
@tkhquang
tkhquang merged commit f14c39d into main Mar 22, 2026
2 checks passed
@tkhquang
tkhquang deleted the ci/coverage-page branch March 23, 2026 21:21
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