Skip to content

Commit

Permalink
Defines Jacoo plugin to enable code coverage analysis by Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Sep 1, 2022
1 parent 26df64a commit 0169b3f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 16 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,34 @@

name: Java CI

on: [push, pull_request]
on:
pull_request:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 17 ]
java: [ '8', '11', '17' ]
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: ${{ matrix.java }}
- name: Build with Maven on Java ${{ matrix.java }}
run: mvn -V test -Ddoclint=all --file pom.xml --no-transfer-progress
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: ${{ matrix.java }}
- name: Build with Maven on Java ${{ matrix.java }}
if: matrix.java != '11'
run: mvn -V test -Ddoclint=all --file pom.xml --no-transfer-progress
- name: Code coverage
if: matrix.java == '11'
run: mvn -V test -Ddoclint=all -Pcoverage --file pom.xml --no-transfer-progress
31 changes: 31 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,37 @@
</pluginManagement>
</build>
</profile>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<formats>
<format>XML</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit 0169b3f

Please sign in to comment.