18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 09:15:01 +01:00

ci: measure the coverage of the core library by the unit tests

A new Coverage workflow builds the unit tests with GCC and gcov (unoptimised, the tests and the core library only), runs them and reports with gcovr: the totals and the per-file table in the summary of the run, the HTML report and the SonarQube generic coverage file in the unit-test-coverage artifact.

The report isn't sent to SonarQube Cloud. The project's quality gate (Sonar way) fails a pull request whose new code is covered in less than 80%; that condition isn't evaluated today because sonar-project.properties excludes every file from coverage, and sending the report would turn it on.
This commit is contained in:
jerrrrycho
2026-11-11 10:49:03 +01:00
parent 10c7527a64
commit c01007b9dd
2 changed files with 133 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ Coverage was measured on Windows with MSVC's SanitizerCoverage (`/fsanitize-cove
The aim is branch coverage with the rest explained below, not 100%.
The numbers above are from 2026-11-01. Since then the **Coverage** workflow (`.github/workflows/coverage.yml`) measures every push and pull request: a GCC build of the unit tests with gcov, lines, functions and branches per source file of the core library. The totals and the per-file table are in the summary of the workflow run, and the HTML report with the lines marked is in its `unit-test-coverage` artifact. Its counts are source lines and gcov's branches, so they differ somewhat from the blocks in the table. The report isn't sent to SonarQube Cloud: the project's quality gate would then require 80% coverage of the new code of every pull request.
## Code nothing in the game runs
Nothing creates these objects or calls these functions anywhere in the game, which was checked against the whole source tree. A refactor can delete them, or leave them untested.