diff --git a/.github/scripts/coverage_report.py b/.github/scripts/coverage_report.py new file mode 100755 index 00000000..cd427126 --- /dev/null +++ b/.github/scripts/coverage_report.py @@ -0,0 +1,305 @@ +#!/usr/bin/env python3 +"""Turn jacoco XML reports into a Markdown coverage report for a pull request comment. + +Reads one report per Gradle module, plus the list of files the pull request touched, and +writes: + + * a per-module line and branch coverage table + * coverage of the source files this pull request actually changed, which is the part a + reviewer can act on + * the least covered classes, as a standing to-do list + * the test failure count, so nobody reads coverage numbers off a broken run + +Exit code is 0 unless a configured minimum is missed and enforcement is switched on, so the +job can start out advisory and become a gate later without touching this script. + +Usage: + coverage_report.py --out coverage-report.md + --changed-files changed.txt + --module