Skip to content

Commit 1bb2e84

Browse files
authored
Add code coverage (#143)
Add code coverage from Jacoco and send to Coveralls.
1 parent 7dfcebc commit 1bb2e84

File tree

4 files changed

+133
-5
lines changed

4 files changed

+133
-5
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ jobs:
4949
mvn install -B -q -DskipTests
5050
popd
5151
- name: Build with Maven
52-
run: mvn -Dlogging.config.file=\${maven.multiModuleProjectDirectory}/logging.ci.properties verify -B
52+
run: mvn -Dlogging.config.file=\${maven.multiModuleProjectDirectory}/logging.ci.properties verify -B -Pjacoco coveralls:report -DrepoToken=$COVERALLS_REPO_TOKEN
53+
env:
54+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
5355
- name: Deploy with Maven
5456
run: mvn -s .travis.settings.xml -Dgithub.username=$GITHUB_USERNAME -Dgithub.password=$GITHUB_TOKEN deploy -DskipTests -B
5557
env:

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ install:
1919
- mvn install -B -q -DskipTests
2020
- popd
2121
script:
22-
- mvn -Dlogging.config.file=\${maven.multiModuleProjectDirectory}/logging.ci.properties verify -B
22+
- mvn -Dlogging.config.file=\${maven.multiModuleProjectDirectory}/logging.ci.properties verify -Pjacoco coveralls:report -DrepoToken=$COVERALLS_REPO_TOKEN -B
2323
deploy:
2424
provider: script
2525
script: mvn -s .travis.settings.xml -Dgithub.username=$GITHUB_USERNAME -Dgithub.password=$GITHUB_TOKEN deploy -DskipTests
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>com.ibm.wala</groupId>
6+
<artifactId>ml</artifactId>
7+
<version>0.38.0-SNAPSHOT</version>
8+
<relativePath>..</relativePath>
9+
</parent>
10+
<artifactId>com.ibm.wala.cast.python.report</artifactId>
11+
<packaging>pom</packaging>
12+
<dependencies>
13+
<dependency>
14+
<groupId>${project.groupId}</groupId>
15+
<artifactId>com.ibm.wala.cast.python</artifactId>
16+
<version>${project.version}</version>
17+
</dependency>
18+
<dependency>
19+
<groupId>${project.groupId}</groupId>
20+
<artifactId>com.ibm.wala.cast.python.jython3</artifactId>
21+
<version>0.38.0-SNAPSHOT</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>${project.groupId}</groupId>
25+
<artifactId>com.ibm.wala.cast.python.test</artifactId>
26+
<version>${project.version}</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>${project.groupId}</groupId>
30+
<artifactId>com.ibm.wala.cast.python.jython3.test</artifactId>
31+
<version>0.38.0-SNAPSHOT</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>${project.groupId}</groupId>
35+
<artifactId>com.ibm.wala.cast.python.ml</artifactId>
36+
<version>${project.version}</version>
37+
</dependency>
38+
<dependency>
39+
<groupId>${project.groupId}</groupId>
40+
<artifactId>com.ibm.wala.cast.python.ml.test</artifactId>
41+
<version>${project.version}</version>
42+
</dependency>
43+
</dependencies>
44+
<profiles>
45+
<profile>
46+
<id>jacoco</id>
47+
<activation>
48+
<activeByDefault>false</activeByDefault>
49+
</activation>
50+
<build>
51+
<plugins>
52+
<plugin>
53+
<groupId>org.jacoco</groupId>
54+
<artifactId>jacoco-maven-plugin</artifactId>
55+
<version>${jacoco-version}</version>
56+
<executions>
57+
<execution>
58+
<goals>
59+
<goal>report-aggregate</goal>
60+
</goals>
61+
<phase>verify</phase>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
</plugins>
66+
</build>
67+
</profile>
68+
</profiles>
69+
</project>

pom.xml

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
<packaging>pom</packaging>
88
<modules>
99
<module>com.ibm.wala.cast.python</module>
10-
<module>com.ibm.wala.cast.python.jython</module>
1110
<module>com.ibm.wala.cast.python.jython3</module>
1211
<module>com.ibm.wala.cast.python.test</module>
13-
<module>com.ibm.wala.cast.python.jython.test</module>
1412
<module>com.ibm.wala.cast.python.jython3.test</module>
1513
<module>com.ibm.wala.cast.python.ml</module>
1614
<module>com.ibm.wala.cast.python.ml.test</module>
15+
<module>com.ibm.wala.cast.python.report</module>
1716
</modules>
1817
<distributionManagement>
1918
<repository>
@@ -34,6 +33,8 @@
3433
<maven.surefire.version>3.5.2</maven.surefire.version>
3534
<parallel>both</parallel>
3635
<logging.config.file>${maven.multiModuleProjectDirectory}/logging.properties</logging.config.file>
36+
<jacoco-version>0.8.13</jacoco-version>
37+
<argLine/>
3738
</properties>
3839
<dependencyManagement>
3940
<dependencies>
@@ -144,7 +145,7 @@
144145
<java.util.logging.config.file>${logging.config.file}</java.util.logging.config.file>
145146
</systemPropertyVariables>
146147
<forkMode>once</forkMode>
147-
<argLine>-Dpython.import.site=false</argLine>
148+
<argLine>@{argLine} -Dpython.import.site=false</argLine>
148149
<trimStackTrace>false</trimStackTrace>
149150
</configuration>
150151
</plugin>
@@ -257,4 +258,60 @@
257258
</plugin>
258259
</plugins>
259260
</reporting>
261+
<profiles>
262+
<profile>
263+
<id>jacoco</id>
264+
<activation>
265+
<activeByDefault>false</activeByDefault>
266+
</activation>
267+
<build>
268+
<pluginManagement>
269+
<plugins>
270+
<plugin>
271+
<groupId>com.github.hazendaz.maven</groupId>
272+
<artifactId>coveralls-maven-plugin</artifactId>
273+
<version>4.7.0</version>
274+
<configuration>
275+
<jacocoReports>
276+
<jacocoReport>${project.basedir}/com.ibm.wala.cast.python.report/target/site/jacoco-aggregate/jacoco.xml</jacocoReport>
277+
</jacocoReports>
278+
</configuration>
279+
<dependencies>
280+
<dependency>
281+
<groupId>javax.xml.bind</groupId>
282+
<artifactId>jaxb-api</artifactId>
283+
<version>2.3.1</version>
284+
</dependency>
285+
</dependencies>
286+
</plugin>
287+
</plugins>
288+
</pluginManagement>
289+
<plugins>
290+
<plugin>
291+
<groupId>org.jacoco</groupId>
292+
<artifactId>jacoco-maven-plugin</artifactId>
293+
<version>${jacoco-version}</version>
294+
<configuration>
295+
<propertyName>argLine</propertyName>
296+
</configuration>
297+
<executions>
298+
<execution>
299+
<goals>
300+
<goal>prepare-agent</goal>
301+
</goals>
302+
<phase>initialize</phase>
303+
</execution>
304+
<execution>
305+
<id>report</id>
306+
<goals>
307+
<goal>report</goal>
308+
</goals>
309+
<phase>verify</phase>
310+
</execution>
311+
</executions>
312+
</plugin>
313+
</plugins>
314+
</build>
315+
</profile>
316+
</profiles>
260317
</project>

0 commit comments

Comments
 (0)