Skip to content

Commit d9c9ba3

Browse files
#303 - Add code coverage support improve (#304)
* #303 - Add code coverage support improve - Added support for code coverage GitHub action check as part of PR. - Used Absa fork of JaCoCo solution - with scala method filtering.
1 parent 0bc3293 commit d9c9ba3

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,31 @@ jobs:
3535
- name: Switch scala version
3636
run: ./mvnw scala-cross-build:change-version --no-transfer-progress -Pscala-${{ matrix.scala }},spark-${{ matrix.spark }}
3737
- name: Build and run tests
38-
run: ./mvnw clean verify --no-transfer-progress -Pscala-${{ matrix.scala }},spark-${{ matrix.spark }},all-tests,no-upgraded-snappy
38+
run: ./mvnw clean verify --no-transfer-progress -Pscala-${{ matrix.scala }},spark-${{ matrix.spark }},all-tests,no-upgraded-snappy,code-coverage
39+
- name: Add coverage to PR
40+
id: jacoco
41+
uses: madrapps/[email protected]
42+
with:
43+
paths: >
44+
${{ github.workspace }}/api/target/site/jacoco/jacoco.xml,
45+
${{ github.workspace }}/compatibility-provider/target/site/jacoco/jacoco.xml,
46+
${{ github.workspace }}/compatibility_spark-${{ matrix.spark }}/target/site/jacoco/jacoco.xml,
47+
${{ github.workspace }}/component-scanner/target/site/jacoco/jacoco.xml,
48+
${{ github.workspace }}/driver/target/site/jacoco/jacoco.xml,
49+
${{ github.workspace }}/ingestor-default/target/site/jacoco/jacoco.xml,
50+
${{ github.workspace }}/shared/target/site/jacoco/jacoco.xml
51+
token: ${{ secrets.GITHUB_TOKEN }}
52+
min-coverage-overall: 0.0
53+
min-coverage-changed-files: 80.0
54+
title: JaCoCo code coverage report - Scala ${{ matrix.scala }} & Spark ${{ matrix.spark }}
55+
update-comment: true
56+
- name: Get the Coverage info
57+
run: |
58+
echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}"
59+
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}"
60+
- name: Fail PR if changed files coverage is less than 80%
61+
if: ${{ steps.jacoco.outputs.coverage-changed-files < 80.0 }}
62+
uses: actions/github-script@v6
63+
with:
64+
script: |
65+
core.setFailed('Changed files coverage is less than 80%!')

parent-conf/pom.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
<!--Other properties-->
8181
<skip.docker.tests>true</skip.docker.tests>
82-
<jacoco.plugin.version>0.8.8</jacoco.plugin.version>
82+
<jacoco.plugin.version>0.8.9</jacoco.plugin.version>
8383
<spark-commons-test>0.4.0</spark-commons-test>
8484
</properties>
8585

@@ -418,12 +418,12 @@
418418
<profile>
419419
<id>code-coverage</id>
420420
<properties>
421-
<skip.docker.tests>false</skip.docker.tests>
421+
<skip.docker.tests>true</skip.docker.tests>
422422
</properties>
423423
<build>
424424
<plugins>
425425
<plugin>
426-
<groupId>org.jacoco</groupId>
426+
<groupId>za.co.absa.jacoco</groupId>
427427
<artifactId>jacoco-maven-plugin</artifactId>
428428
<version>${jacoco.plugin.version}</version>
429429
<configuration>
@@ -445,6 +445,11 @@
445445
<goals>
446446
<goal>report</goal>
447447
</goals>
448+
<configuration>
449+
<title>${project.name} - scala:${scala.version}</title>
450+
<doMethodFiltration>true</doMethodFiltration>
451+
<doScalaMethodFiltration>true</doScalaMethodFiltration>
452+
</configuration>
448453
</execution>
449454
</executions>
450455
</plugin>

0 commit comments

Comments
 (0)