cppalliance / ci-automation

0 stars 1 forks source link

Customize gcovr reports #2

Open sdarwin opened 1 year ago

sdarwin commented 1 year ago

Coverage reports are being generated on pull requests at https://github.com/boostorg/url . For example, in https://github.com/boostorg/url/pull/649 it shows:

GCOVR code coverage report https://649.url.prtest.cppalliance.org/gcovr/index.html LCOV code coverage report https://649.url.prtest.cppalliance.org/genhtml/index.html Coverage Diff https://649.url.prtest.cppalliance.org/gcovr/coverage_diff.txt

The GCOVR report is created by running this command:

gcovr -p --html-details --exclude '.*/test/.*' --exclude '.*/extra/.*' --filter ".*/url/.*" --html --output $BOOST_CI_SRC_FOLDER/gcovr/index.html

However that requires the C++ source code to be available and to have been built so it's useful to have a more complete script. This example script https://github.com/CPPAlliance/ci-automation/blob/master/scripts/jenkins.sh will build everything from scratch.

Run jenkins.sh in an ubuntu 22.04 container. gcovr html output will be generated in:

./url_job_folder/gcovr/

and json files, discussed in the other github issue, will be here:

./url_job_folder/json/ ./url/json/

Goals:

The aim of the project is to make the html more closely resemble the earlier codecov design before their recent updates.

Codecov results: https://app.codecov.io/github/CPPAlliance/http_proto/tree/develop/include/boost/http_proto . Vinnie will comment further about what's correct or incorrect in those webpages.

Methods:

cc @vinniefalco @gregnewman

sdarwin commented 1 year ago

@gregnewman, the current script is running these commands:

gcovr --html-details

and

gcovr --json-summary

If the html reports are only minimally customized I had been imagining gcovr --html-details would continue to be used, modifying the output in various ways.

However, for the most flexibility in the design it is possible to replace that step. Instead of --html-details run --json-summary. That produces plain json data. Create html pages from scratch based on the data.

Here's an example of a webpage that generates javascript charts based on benchmark statistics which have been include in a textarea field https://github.com/boostorg/json/blob/develop/bench/results.html