Skip to content

feat(ci): add code coverage to unit tests in CI

Lucas SCHMIDT requested to merge test-covering into dev

Description

This merge request will add code coverage to unit tests in CI using gcovr.

Closes #783 (closed)

Requires !639 (merged)

How to test it?

Check if the CI still works, download the artifacts generated by the new "build:linux-21.04-coverage-gcc" CI rule, check if they look good (all the relevant source files are reported with the good name, the reported code coverage sounds possible...).

Some results

Gitlab will get these reports to display the number on each merge requests. coverage_number

It will also display the code coverage in the "Changes" tab in the merge requests. coverage_merge_request

An HTML report should be generated on each merge, and should be available at https://sight.pages.ircad.fr/sight/coverage as soon as this MR is merged. coverage_html_report

Finally, Gitlab Premium adds the ability to block an MR as long as the code coverage is too low.

DWE edit

Itook the opportunity of this MR since we needed to ease a bit CI CPU pressure, to add Ubuntu 21.10 support. Globally, there are now 4 build target:

  • gcc debug on Ubuntu 21.04 with package generation
  • gcc release on Ubuntu 21.04 with package generation
  • clang RelWithDebInfo on Ubuntu 21.10 without package generation
  • gcc debug on Ubuntu 21.10 with documentation and with coverage without package generation

Once Ubuntu 21.10 have matured a bit, I propose to remove the 21.04 build an only keep 3 "flavor":

  • gcc debug on Ubuntu 21.10 with package generation
  • gcc release on Ubuntu 21.10 with package generation
  • clang debug on Ubuntu 21.10 without package generation with documentation and with coverage
Edited by Didier WECKMANN

Merge request reports