JaCoCo: гейт покрытия 90% строк + сводка/артефакты репортов в CI
PR checks / web (pull_request) Successful in 54s
PR checks / java (pull_request) Failing after 1m9s

Корневой pom: jacoco-maven-plugin 0.8.15 (prepare-agent, report+check на
verify, report раньше check — отчёт готов даже при провале гейта), surefire
argLine через @{argLine}. pr.yml/main.yml job java: Coverage summary в
step summary + артефакт jacoco-html (оба шага if: always()).

Тесты ради гейта (23 класса / 218 @Test): app ConversionService/
ApiExceptionHandler/ConversionTimeout +1 в ConvertController; core
DrawMlColor/DrawMlText + инкременты ChartSpec/PresetGeometry.
Покрытие: core 91,0%, app 92,9% строк.
This commit is contained in:
Pjandro
2026-10-24 18:39:44 +00:00
parent dfa6135701
commit 8a07597d4c
12 changed files with 1411 additions and 6 deletions
+33
View File
@@ -31,6 +31,39 @@ jobs:
- name: Build and test (PMD gate included)
run: mvn -B clean verify
- name: Coverage summary
if: always()
run: |
python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"
import os
import xml.etree.ElementTree as ET
def pct(root, kind):
for c in root.findall("counter"):
if c.get("type") == kind:
missed, covered = int(c.get("missed")), int(c.get("covered"))
return f"{100.0 * covered / (missed + covered):.1f}%"
return "—"
print("## Покрытие (JaCoCo)\n")
print("| Модуль | Строки | Ветви | Порог строк |")
print("|---|---|---|---|")
for m in ("wordpdf-core", "wordpdf-app"):
p = f"{m}/target/site/jacoco/jacoco.xml"
if not os.path.exists(p):
print(f"| {m} | нет данных | — | 90% |")
continue
r = ET.parse(p).getroot()
print(f"| {m} | {pct(r, 'LINE')} | {pct(r, 'BRANCH')} | 90% |")
PY
- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@v4
with:
name: jacoco-html
path: |
wordpdf-core/target/site/jacoco/
wordpdf-app/target/site/jacoco/
web:
runs-on: ubuntu-latest
steps: