Skip to content

Commit 4a71f11

Browse files
committed
Add code coverage
Run the GitHub action with the `coverage` profile to generate a code coverage report in target/site/jacoco and associate it to the GH Action runs Signed-off-by: Jeff Mesnil <[email protected]>
1 parent db598e9 commit 4a71f11

File tree

2 files changed

+67
-9
lines changed

2 files changed

+67
-9
lines changed

Diff for: .github/workflows/build.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: SmallRye Module Info Build
1+
name: Build StAXMapper
22

33
on:
44
push:
@@ -11,15 +11,19 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
name: build with JDK 11
14-
1514
steps:
16-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1716
name: checkout
18-
19-
- uses: AdoptOpenJDK/install-jdk@v1
20-
name: set up JDK 11
17+
- name: Set up JDK 11
18+
uses: actions/setup-java@v3
2119
with:
22-
version: 11
23-
20+
java-version: '11'
21+
distribution: 'temurin'
22+
cache: maven
2423
- name: Build
25-
run: mvn -B install --file pom.xml
24+
run: mvn -B install --file pom.xml -P coverage
25+
- name: Upload code coverage report
26+
uses: 'actions/upload-artifact@v2'
27+
with:
28+
name: jacoco
29+
path: target/site/jacoco

Diff for: pom.xml

+54
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,58 @@
9393
</plugin>
9494
</plugins>
9595
</build>
96+
97+
<profiles>
98+
<profile>
99+
<id>coverage</id>
100+
<build>
101+
<plugins>
102+
<plugin>
103+
<groupId>org.jacoco</groupId>
104+
<artifactId>jacoco-maven-plugin</artifactId>
105+
<version>0.8.10</version>
106+
<executions>
107+
<execution>
108+
<id>prepare-agent</id>
109+
<goals>
110+
<goal>prepare-agent</goal>
111+
</goals>
112+
<phase>generate-test-resources</phase>
113+
</execution>
114+
<execution>
115+
<id>report</id>
116+
<phase>prepare-package</phase>
117+
<goals>
118+
<goal>report</goal>
119+
</goals>
120+
</execution>
121+
<execution>
122+
<id>merge</id>
123+
<goals>
124+
<goal>merge</goal>
125+
</goals>
126+
<configuration>
127+
<fileSets>
128+
<fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
129+
<directory>.</directory>
130+
<includes>
131+
<include>**/*.exec</include>
132+
</includes>
133+
</fileSet>
134+
</fileSets>
135+
</configuration>
136+
</execution>
137+
<execution>
138+
<id>aggregate-report</id>
139+
<phase>verify</phase>
140+
<goals>
141+
<goal>report-aggregate</goal>
142+
</goals>
143+
</execution>
144+
</executions>
145+
</plugin>
146+
</plugins>
147+
</build>
148+
</profile>
149+
</profiles>
96150
</project>

0 commit comments

Comments
 (0)