Skip to content

Commit ab094ef

Browse files
authored
chore: generate coverage report and upload it to codecov (#5098)
1 parent c53f178 commit ab094ef

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

.github/workflows/build.yml

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Build
22
on: [push, pull_request]
3+
4+
env:
5+
COVERAGE_REPORT_PATH: "target/site/jacoco/jacoco.xml"
6+
37
jobs:
48
build:
59
runs-on: ubuntu-latest
@@ -12,3 +16,8 @@ jobs:
1216
distribution: 'adopt'
1317
- name: Build with Maven
1418
run: mvn --batch-mode --update-snapshots verify
19+
- name: Upload coverage to codecov
20+
uses: codecov/codecov-action@v3
21+
with:
22+
files: "${{ env.REPORT_NAME }}"
23+
fail_ci_if_error: true

pom.xml

+24-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@
6363
<plugins>
6464
<plugin>
6565
<artifactId>maven-surefire-plugin</artifactId>
66-
<version>2.22.2</version>
66+
<version>3.2.5</version>
67+
<configuration>
68+
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
69+
</configuration>
6770
</plugin>
6871
<plugin>
6972
<groupId>org.apache.maven.plugins</groupId>
@@ -74,6 +77,25 @@
7477
<target>17</target>
7578
</configuration>
7679
</plugin>
80+
<plugin>
81+
<groupId>org.jacoco</groupId>
82+
<artifactId>jacoco-maven-plugin</artifactId>
83+
<version>0.8.12</version>
84+
<executions>
85+
<execution>
86+
<goals>
87+
<goal>prepare-agent</goal>
88+
</goals>
89+
</execution>
90+
<execution>
91+
<id>generate-code-coverage-report</id>
92+
<phase>test</phase>
93+
<goals>
94+
<goal>report</goal>
95+
</goals>
96+
</execution>
97+
</executions>
98+
</plugin>
7799
</plugins>
78100
</build>
79-
</project>
101+
</project>

0 commit comments

Comments
 (0)