Skip to content

Commit 1b8f44b

Browse files
authored
ci: Add JaCoCo coverage reporting to workflows and build setup (#193)
Fixes #126 Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
1 parent 62d73f7 commit 1b8f44b

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ jobs:
115115
path: |
116116
**/build/test-results/**/*.xml
117117
test-report-aggregation/build/reports/tests/test/aggregated-results/**
118+
test-report-aggregation/build/reports/jacoco/testCodeCoverageReport/**
118119
retention-days: 7
119120

120121
docs:

.github/workflows/test-reporting.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ jobs:
4949
run-id: ${{ github.event.workflow_run.id }}
5050
github-token: ${{ secrets.GITHUB_TOKEN }}
5151

52+
- name: Publish JaCoCo report as PR comment
53+
id: jacoco
54+
uses: madrapps/jacoco-report@50d3aff4548aa991e6753342d9ba291084e63848 # 1.7.2
55+
with:
56+
token: ${{ secrets.GITHUB_TOKEN }}
57+
paths: build-reports-artifacts/**/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
58+
update-comment: true
59+
title: "# :java_duke: JaCoCo coverage report"
60+
min-coverage-overall: 50
61+
min-coverage-changed-files: 60
62+
comment-type: both
63+
pr-number: ${{ needs.get-pr-info.outputs.pr_number}}
64+
pass-emoji: ':green_circle:'
65+
fail-emoji: ':red_circle:'
66+
5267
- name: Publish JUnit test report (PR comment with collapsed failures)
5368
uses: mikepenz/action-junit-report@e08919a3b1fb83a78393dfb775a9c37f17d8eea6 # v6.0.1
5469
env:

buildSrc/src/main/kotlin/docling-java-shared.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id("docling-shared")
33
`java-library`
4+
`jacoco`
45
}
56

67
repositories {
@@ -36,10 +37,16 @@ testing {
3637
}
3738
}
3839

40+
jacoco {
41+
toolVersion = libs.findVersion("jacoco").get().toString()
42+
}
43+
3944
tasks.withType<Test> {
4045
// Use JUnit Platform for unit tests.
4146
useJUnitPlatform()
4247

48+
finalizedBy(tasks.named("jacocoTestReport"))
49+
4350
testLogging {
4451
events("PASSED", "FAILED", "SKIPPED", "STANDARD_OUT", "STANDARD_ERROR")
4552
showStandardStreams = true

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
assertj = "3.27.6"
33
jackson2 = "2.20.1"
44
jackson3 = "3.0.3"
5+
jacoco = "0.8.14"
56
jreleaser = "1.20.0"
67
jspecify = "1.0.0"
78
junit = "6.0.1"

test-report-aggregation/build.gradle.kts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@ plugins {
22
id("docling-shared")
33
`java-library`
44
`test-report-aggregation`
5+
`jacoco-report-aggregation`
56
}
67

78
repositories {
89
mavenCentral()
910
}
1011

1112
dependencies {
13+
testReportAggregation(project(":docling-core"))
1214
testReportAggregation(project(":docling-serve-api"))
1315
testReportAggregation(project(":docling-serve-client"))
1416
testReportAggregation(project(":docling-testcontainers"))
1517
testReportAggregation(project(":docling-version-tests"))
1618

19+
jacocoAggregation(project(":docling-core"))
20+
jacocoAggregation(project(":docling-serve-api"))
21+
jacocoAggregation(project(":docling-serve-client"))
22+
jacocoAggregation(project(":docling-testcontainers"))
23+
jacocoAggregation(project(":docling-version-tests"))
24+
1725
api(platform(libs.testcontainers.bom))
1826
api(platform(libs.jackson.bom))
1927

@@ -24,5 +32,8 @@ dependencies {
2432
}
2533

2634
tasks.named("check") {
27-
dependsOn(tasks.named<TestReport>("testAggregateTestReport"))
35+
dependsOn(
36+
tasks.named<TestReport>("testAggregateTestReport"),
37+
tasks.named<JacocoReport>("testCodeCoverageReport")
38+
)
2839
}

0 commit comments

Comments
 (0)