WIP: Report test coverage on pull request #58

Closed
ansv7779 wants to merge 2 commits from test-coverage into develop
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,31 @@
name: Coverage report
on:
pull_request:
types:
- opened
- synchronize
paths:
- '**/src/**.java'
- '.gitea/workflows/coverage-report.yaml'
jobs:
coverage-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: ./mvnw --batch-mode --activate-profiles coverage verify
- name: Add coverage report to pull request
uses: madrapps/jacoco-report@v1.7.1
with:
paths: ${{ github.workspace }}/**/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: 'Coverage Report'
update-comment: true
debug-mode: true

23
pom.xml
View File

@ -449,4 +449,27 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>