Skip to content

Commit eb697f9

Browse files
committed
Added JaCoCo for code coverage analysis.
1 parent 21a7e03 commit eb697f9

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
java-version: 11
2424
- name: Build with Maven
25-
run: mvn -B -Dgpg.skip verify
25+
run: mvn -B -Dgpg.skip jacoco:prepare-agent verify
2626
- name: Upload code coverage
2727
if: ${{ success() }}
2828
run: |

pom.xml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
<packaging>hpi</packaging>
1616
<properties>
1717
<jenkins.version>2.375.4</jenkins.version>
18-
<junit.junit.version>5.6.3</junit.junit.version>
18+
<junit.junit.version>5.8.0</junit.junit.version>
19+
<jacoco.version>0.8.7</jacoco.version>
1920
</properties>
2021
<name>Multiselect parameter</name>
2122

@@ -99,6 +100,35 @@
99100
</dependency>
100101
</dependencies>
101102
</plugin>
103+
<plugin>
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-surefire-plugin</artifactId>
106+
<version>3.0.0</version>
107+
<configuration>
108+
<forkCount>2</forkCount>
109+
<reuseForks>false</reuseForks>
110+
</configuration>
111+
</plugin>
112+
<plugin>
113+
<groupId>org.jacoco</groupId>
114+
<artifactId>jacoco-maven-plugin</artifactId>
115+
<version>${jacoco.version}</version>
116+
<executions>
117+
<execution>
118+
<goals>
119+
<goal>prepare-agent</goal>
120+
</goals>
121+
</execution>
122+
<!-- attached to Maven test phase -->
123+
<execution>
124+
<id>report</id>
125+
<phase>test</phase>
126+
<goals>
127+
<goal>report</goal>
128+
</goals>
129+
</execution>
130+
</executions>
131+
</plugin>
102132
</plugins>
103133
</pluginManagement>
104134
<plugins>
@@ -131,6 +161,22 @@
131161
</plugin>
132162
</plugins>
133163
</build>
164+
<reporting>
165+
<plugins>
166+
<plugin>
167+
<groupId>org.jacoco</groupId>
168+
<artifactId>jacoco-maven-plugin</artifactId>
169+
<version>${jacoco.version}</version>
170+
<reportSets>
171+
<reportSet>
172+
<reports>
173+
<report>report</report>
174+
</reports>
175+
</reportSet>
176+
</reportSets>
177+
</plugin>
178+
</plugins>
179+
</reporting>
134180
<scm>
135181
<connection>scm:git:https://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
136182
<developerConnection>scm:git:[email protected]:jenkinsci/${project.artifactId}-plugin.git</developerConnection>

0 commit comments

Comments
 (0)