chore: generate coverage report and upload it to codecov (#5098)

This commit is contained in:
Piotr Idzik
2024-04-06 17:06:30 +02:00
committed by GitHub
parent c53f178308
commit ab094ef04d
2 changed files with 33 additions and 2 deletions

View File

@ -1,5 +1,9 @@
name: Build
on: [push, pull_request]
env:
COVERAGE_REPORT_PATH: "target/site/jacoco/jacoco.xml"
jobs:
build:
runs-on: ubuntu-latest
@ -12,3 +16,8 @@ jobs:
distribution: 'adopt'
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
files: "${{ env.REPORT_NAME }}"
fail_ci_if_error: true

24
pom.xml
View File

@ -63,7 +63,10 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.2.5</version>
<configuration>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -74,6 +77,25 @@
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>generate-code-coverage-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>