Skip to content

Conversation

@julioest
Copy link
Contributor

@julioest julioest commented Jan 31, 2026

Summary

This PR adds a local development environment for customizing gcovr HTML report templates, along with several UI fixes and improvements.

Changes

Local development setup

  • Add DEVELOPMENT.md with setup instructions
  • Add Dockerfile for generating coverage data
  • Add setup-local-venv.sh for local Python environment
  • Add setup-boost.sh to clone Boost on demand (e.g. ./setup-boost.sh json for the JSON library only)
  • Add coverage_sample.json (1.6 MB) so quick builds work without Docker
  • Add --quick flag to build.sh for faster template iteration using sample data
  • Auto-activate venv in build scripts
  • Remove generated coverage and Boost trees from version control (boost-root/, json/, full coverage.json)

Output

  • Move HTML output from templates/html/gcovr-output/ to top-level gcovr-output/
  • Switch build.sh to gcovr JSON tracefile format and simplify sample selection for quick builds

Template fixes

  • Fix toggle buttons (Covered/Uncovered) not toggling back on after click
  • Show uncovered line count in toggle button
  • Show "-" instead of "-%" for missing coverage data
  • Right-align Lines, Functions, Branches column headers to match data
  • Show clean filenames in directory listing with full path tooltips
  • Fix sidebar tree path handling for relative paths
  • Re-add navigation conditionally (ready for gcovr 8.6+ which provides navigation data)

Testing

From a fresh clone:

git clone ... && git checkout <branch>
./setup-local-venv.sh
./setup-boost.sh json
./build.sh --quick

View gcovr-output/index.html (generates ~60 HTML files)

- Updated .gitignore to include additional coverage report directories and build/test artifacts.
- Deleted obsolete configuration and build files from the boost-root directory, including logs, cache files, and object files.
- Add Docker build environment (Ubuntu 24.04, gcc-13, lcov v2.3, gcovr 8.4)
- Add setup-local-venv.sh for local Python venv setup
- Add DEVELOPMENT.md documenting the local workflow
- Update .gitignore to exclude generated coverage files and build artifacts
- Use --json-add-tracefile for coverage.json (preserves function/branch data)
- Add --merge-lines flag for line merging
- Keep LCOV/Cobertura conversion as fallback with warning
- Fix gcovr_wrapper.py shebang to use portable #!/usr/bin/env python3
These files are now gitignored and will be regenerated locally:
- json/*.info (LCOV coverage data)
- json/gcovr/* (HTML report output)
Automatically sources .venv/bin/activate if present, so users
can run ./build.sh directly without manual venv activation.
From PR cppalliance#2 - fixes display of paths with '../' prefixes:
- Add clean_path(), clean_display_name(), is_file_path() helpers
- Create intermediate directories when gcovr doesn't provide them
- Add fullPath field for proper tooltips
- Auto-detect and skip breadcrumb prefixes not in tree
- Apply coverage class coloring to tree labels
- Fix re-injection by removing existing data first

Also removes regenerated coverage output from tracking.
- Extract just filename/folder name for display instead of full paths
- Add title attribute to show full path on hover
- Improve file vs directory icon detection using extracted name
- Rename --mini to --quick/-q for clarity
- Create coverage_sample.json with 40 files (mix of small/medium/larger)
- Add coverage_sample.json to .gitignore
@julioest julioest requested a review from sdarwin January 31, 2026 09:34
@julioest julioest marked this pull request as ready for review January 31, 2026 09:34
@sdarwin
Copy link
Contributor

sdarwin commented Jan 31, 2026

It's sort of funny. The very existence of the repo was based on a request from Vinnie,

  • already include all built files
  • no Docker
  • works on Windows
  • works on any operating system with gcovr
  • just run gcovr. It easily processes the files, that already exist in the repo. The script becomes as simple as possible.

That said, if this is the direction the repository must go in, it should be fine.

@julioest
Copy link
Contributor Author

🤭 That is pretty funny.

I forgot the main reason why I couldn't run it on my machine, since I was moving so fast.

But now that I know more about this project, I can go back and look to see what I can remove (like Docker) to fulfill Vinnie's requirements.

@sdarwin
Copy link
Contributor

sdarwin commented Jan 31, 2026

If this makes the workflow the easiest and the most correct for you, it should stay.
Whatever you believe is the best for your own development methodology.
It doesn't need to go back to Vinnie's requirement.
A reason the repo did not exist before was I thought "whoever works on this can just run lcov-jenkins-gcc-13.sh", but that didn't consider macos, etc.

@sdarwin
Copy link
Contributor

sdarwin commented Jan 31, 2026

  1. I copied the templates from this PR and generated https://github.com/boostorg/json/pull/1138. Does it look correct?

  2. It's not standard practice to check-in boost-root to a repository. The very reason it was checked in, was to provide pre-built lcov output files, so someone could get started at the last part of the process, and just run gcovr. If the built files are removed, if these are removed:

boost-root/bin.v2/
boost-root/b2

then arguably the whole boost-root folder should also be deleted.

Instead, in the scripts, clone the boost superproject, and then check out all submodules, at which point a boost-root has been created. git-ignore the whole boost-root.

  1. It's arbitrary whether the output of gcovr is stored in a folder called "gcovr-output" or "gcovr". Either would work. In production it's called "gcovr", because that shows up in the URL, and it's more streamlined. In any case, would it make sense to populate the directory with output from a recent test, that has just been generated, and check it is, so the results can be see immediately? Right now you are git-ignoring the output folders:
# Generated coverage reports
json/gcovr/
json/gcovr-lcov/
json/gcovr-output/

which has a certain logic, since they should be re-generated every time, however since https://github.com/cppalliance/gcovr-development is an unusual repository, it's purely for development, with ci-automate being the production side, wouldn't it be convenient to check-in the gcovr-output, show it in the repo, so others can see what the latest output is expected to look like? Continuing this line of reasoning, if boost-root will be removed from the repo, instead of dumping output to boost-root/json/gcovr-output/ it could go in a top-level directory /gcovr-output/.

  1. As a cppalliance repo you should already have write-access. You are welcome to merge this pull request. Or, either method is possible: 1. continue to push changes to the same PR. 2. a new PR. the next one.

- Remove boost-root/ and json/ from version control (9320 files)
- Add setup-boost.sh to clone Boost on demand
- Move gcovr output to top-level gcovr-output/
- Update build.sh for new structure
- Update DEVELOPMENT.md with new workflow

Boost source should be cloned via scripts, not checked into the repo.
- coverage_sample.json (1.6 MB) allows template testing without generating
  full coverage data
- .gitignore updated to exclude full coverage.json (too large for GitHub)
@julioest
Copy link
Contributor Author

All righty Sam,

Here’s what I changed:

Repo cleanup
I removed the boost-root/ and json/ directories and added them to .gitignore. There’s a new setup-boost.sh script that clones Boost when folks need it—run ./setup-boost.sh json if you only want the JSON library.

Output location
Coverage output now lives at the top-level gcovr-output/ instead of templates/html/gcovr-output/, and I updated build.sh to match.

Coverage data
I added coverage_sample.json (1.6 MB) so people can run ./build.sh --quick without Docker. The full coverage.json (248 MB) stays local since it’s too big for GitHub.

Fresh clone test
I ran through a clean clone and everything works:

git clone ... && git checkout html-template-fixes
./setup-local-venv.sh
./setup-boost.sh json
./build.sh --quick

That produced 60 HTML files as expected.

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.

2 participants