Skip to content

Commit f1eae45

Browse files
committed
CASL-927 - Configure code coverage in V3
Signed-off-by: mlisak <ext-michal.lisak@here.com>
1 parent cbceadd commit f1eae45

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.github/workflows/reusable-build-and-publish-v3s.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ jobs:
4848
if: success() || failure() # always run even if the previous step fails
4949
with:
5050
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
51+
- name: Publish code coverage report as PR comment
52+
uses: madrapps/jacoco-report@v1.6.1
53+
with:
54+
paths: '**/build/reports/jacoco/test/jacocoTestReport.xml'
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
min-coverage-overall: $MIN_COVERAGE_OVERALL
57+
min-coverage-changed-files: $MIN_COVERAGE_CHANGED_FILES
58+
title: Code Coverage
5159
# - name: Publish code coverage report as PR comment
5260
# id: jacoco
5361
# uses: madrapps/jacoco-report@v1.6.1

build.gradle.kts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ fun Task.configureCleanAndTestTasks() {
216216
}
217217
tasks.register("cleanAndTestAll") { configureCleanAndTestTasks() }
218218

219+
// Helper, run as `gradle jacocoTestReport`
220+
fun Task.configureCodeCoverageTasks() {
221+
allModules.forEach {
222+
when (it.value.first) {
223+
CleanAndTest.KOTLIN -> {
224+
println("Generate code coverage for ${it.key}")
225+
dependsOn(":${it.key}:jacocoTestReport")
226+
}
227+
else -> {}
228+
}
229+
}
230+
}
231+
tasks.register("jacocoTestReport") { configureCodeCoverageTasks() }
232+
219233
// Helper, run as `gradle publishToLocal`
220234
fun Task.publishToLocal() {
221235
allModules.forEach {

0 commit comments

Comments
 (0)