Skip to content

Add gcovr-based code coverage: a cmake target and a Codecov CI report - #2897

Merged
cary-ilm merged 2 commits into
AcademySoftwareFoundation:mainfrom
cary-ilm:coverage-codecov
Nov 27, 2026
Merged

cary-ilm merged 2 commits into
AcademySoftwareFoundation:mainfrom
cary-ilm:coverage-codecov

Conversation

@cary-ilm

Copy link
Copy Markdown
Member

Alternative to #2872, using codecov

Add OPENEXR_ENABLE_COVERAGE, which instruments the build with gcov and adds 'coverage', 'coverage-report' and 'coverage-clean' targets that run the tests and generate an HTML report (plus Cobertura XML and a JSON summary) with gcovr. The measured files are configured in gcovr.cfg. CONTRIBUTING.md describes how to use the targets locally.

Add coverage.yml, which builds with coverage enabled, runs the full test suite, and produces the same gcovr report. The instrumented build and full test run are slow, so it runs weekly (Sunday, after the full build), repo, on demand via workflow_dispatch on any branch, and on a pull request when a maintainer applies the 'coverage' label.

Each run:

  • uploads the HTML report as an artifact;
  • writes overall line/function/branch percentages to the job summary;
  • uploads the Cobertura report to Codecov, which tracks the coverage of main over time and shows the coverage of the changed lines on a pull request.

codecov.yml makes the Codecov project and patch statuses informational, so a pull request is never failed for low coverage.

gcovr is installed from a hash-pinned requirements file, share/ci/requirements/coverage.txt, generated from coverage.in.

Assisted-by: Copilot / Claude Sonnet 5.5

Add OPENEXR_ENABLE_COVERAGE, which instruments the build with gcov and
adds 'coverage', 'coverage-report' and 'coverage-clean' targets that run
the tests and generate an HTML report (plus Cobertura XML and a JSON
summary) with gcovr. The measured files are configured in gcovr.cfg.
CONTRIBUTING.md describes how to use the targets locally.

Add coverage.yml, which builds with coverage enabled, runs the full test
suite, and produces the same gcovr report. The instrumented build and
full test run are slow, so it runs weekly (Sunday, after the full build),
repo, on demand via workflow_dispatch on any branch, and on a pull
request when a maintainer applies the 'coverage' label.

Each run:

- uploads the HTML report as an artifact;
- writes overall line/function/branch percentages to the job summary;
- uploads the Cobertura report to Codecov, which tracks the coverage of
  main over time and shows the coverage of the changed lines on a pull
  request.

codecov.yml makes the Codecov project and patch statuses
informational, so a pull request is never failed for low coverage.

gcovr is installed from a hash-pinned requirements file,
share/ci/requirements/coverage.txt, generated from coverage.in.

Assisted-by: Copilot / Claude Sonnet 5.5

Signed-off-by: Cary Phillips <seabeepea@gmail.com>
@cary-ilm
cary-ilm merged commit 01ee8f7 into AcademySoftwareFoundation:main Nov 27, 2026
38 of 39 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