Skip to content

Commit 01d5501

Browse files
XC-Xinzekhatchad
authored andcommitted
Add code coverage (#143)
Add code coverage from Jacoco and send to Coveralls.
1 parent d5c114d commit 01d5501

File tree

4 files changed

+135
-2
lines changed

4 files changed

+135
-2
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,8 @@ 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 }}
55+
- name: Coveralls GitHub Action
56+
uses: coverallsapp/[email protected]

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ install:
2020
- popd
2121
script:
2222
- mvn -Dlogging.config.file=\${maven.multiModuleProjectDirectory}/logging.ci.properties verify -B
23+
- mvn -Dlogging.config.file=\${maven.multiModuleProjectDirectory}/logging.ci.properties verify -Pjacoco coveralls:report -DrepoToken=$COVERALLS_REPO_TOKEN -B
2324
before_cache:
2425
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
2526
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<module>com.ibm.wala.cast.python.jython3.test</module>
1515
<module>com.ibm.wala.cast.python.ml</module>
1616
<module>com.ibm.wala.cast.python.ml.test</module>
17+
<module>com.ibm.wala.cast.python.report</module>
1718
</modules>
1819
<distributionManagement>
1920
<repository>
@@ -34,6 +35,8 @@
3435
<maven.surefire.version>3.5.2</maven.surefire.version>
3536
<parallel>both</parallel>
3637
<logging.config.file>${maven.multiModuleProjectDirectory}/logging.properties</logging.config.file>
38+
<jacoco-version>0.8.13</jacoco-version>
39+
<argLine/>
3740
</properties>
3841
<dependencyManagement>
3942
<dependencies>
@@ -144,7 +147,7 @@
144147
<java.util.logging.config.file>${logging.config.file}</java.util.logging.config.file>
145148
</systemPropertyVariables>
146149
<forkMode>once</forkMode>
147-
<argLine>-Dpython.import.site=false</argLine>
150+
<argLine>@{argLine} -Dpython.import.site=false</argLine>
148151
<trimStackTrace>false</trimStackTrace>
149152
</configuration>
150153
</plugin>
@@ -257,4 +260,60 @@
257260
</plugin>
258261
</plugins>
259262
</reporting>
263+
<profiles>
264+
<profile>
265+
<id>jacoco</id>
266+
<activation>
267+
<activeByDefault>false</activeByDefault>
268+
</activation>
269+
<build>
270+
<pluginManagement>
271+
<plugins>
272+
<plugin>
273+
<groupId>com.github.hazendaz.maven</groupId>
274+
<artifactId>coveralls-maven-plugin</artifactId>
275+
<version>4.7.0</version>
276+
<configuration>
277+
<jacocoReports>
278+
<jacocoReport>${project.basedir}/com.ibm.wala.cast.python.report/target/site/jacoco-aggregate/jacoco.xml</jacocoReport>
279+
</jacocoReports>
280+
</configuration>
281+
<dependencies>
282+
<dependency>
283+
<groupId>javax.xml.bind</groupId>
284+
<artifactId>jaxb-api</artifactId>
285+
<version>2.3.1</version>
286+
</dependency>
287+
</dependencies>
288+
</plugin>
289+
</plugins>
290+
</pluginManagement>
291+
<plugins>
292+
<plugin>
293+
<groupId>org.jacoco</groupId>
294+
<artifactId>jacoco-maven-plugin</artifactId>
295+
<version>${jacoco-version}</version>
296+
<configuration>
297+
<propertyName>argLine</propertyName>
298+
</configuration>
299+
<executions>
300+
<execution>
301+
<goals>
302+
<goal>prepare-agent</goal>
303+
</goals>
304+
<phase>initialize</phase>
305+
</execution>
306+
<execution>
307+
<id>report</id>
308+
<goals>
309+
<goal>report</goal>
310+
</goals>
311+
<phase>verify</phase>
312+
</execution>
313+
</executions>
314+
</plugin>
315+
</plugins>
316+
</build>
317+
</profile>
318+
</profiles>
260319
</project>

0 commit comments

Comments
 (0)