From 4308ba2bac94f1876d0c1cac7f13a7fcfefd7183 Mon Sep 17 00:00:00 2001 From: Yonatan Karp-Rudin Date: Sat, 20 Jun 2026 15:53:24 +0200 Subject: [PATCH] feat: per-module detail in the coverage comment Replace the terse Lines/Branches-only table with a section per module that lists all five JaCoCo counters (Line, Branch, Instruction, Method, Class) with covered/missed counts, matching the richer report format used by hand-rolled pipelines. The overall total line is kept for an at-a-glance summary. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d96815..ed16aa2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,18 +127,31 @@ jobs: for c in root.findall("counter") } - rows = [] + metric_order = ["LINE", "BRANCH", "INSTRUCTION", "METHOD", "CLASS"] + + sections = [] totals = {} for path in files: root = ET.parse(path).getroot() name = root.attrib.get("name") or path module = counters(root) - line = module.get("LINE", (0, 0)) - branch = module.get("BRANCH", (0, 0)) - rows.append(f"| {name} | {percentage(*line)} | {percentage(*branch)} |") for counter_type, (covered, missed) in module.items(): acc_covered, acc_missed = totals.get(counter_type, (0, 0)) totals[counter_type] = (acc_covered + covered, acc_missed + missed) + metric_rows = [ + f"| {counter_type.title()} | {percentage(*module[counter_type])} " + f"| {module[counter_type][0]} | {module[counter_type][1]} |" + for counter_type in metric_order + if counter_type in module + ] + sections += [ + f"### {name}", + "", + "| Metric | Coverage | Covered | Missed |", + "| --- | ---: | ---: | ---: |", + *metric_rows, + "", + ] total_line = totals.get("LINE", (0, 0)) total_branch = totals.get("BRANCH", (0, 0)) @@ -150,10 +163,7 @@ jobs: f"**Total** — Lines {percentage(*total_line)} · " f"Branches {percentage(*total_branch)}", "", - "| Module | Lines | Branches |", - "| --- | ---: | ---: |", - *rows, - "", + *sections, ] ) with open("jvm-coverage-summary.md", "w", encoding="utf-8") as handle: