Skip to content

Commit

Permalink
[QA-000] Add coverage config and publish report on Jenkins (#27)
Browse files Browse the repository at this point in the history
* Add coverage config and publish report on Jenkins

* Chenge test to verify in Jenkins
  • Loading branch information
JordiGiros authored Apr 12, 2023
1 parent c6ff5fd commit 74f8c3d
Show file tree
Hide file tree
Showing 13 changed files with 371 additions and 2 deletions.
22 changes: 21 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,27 @@ pipeline {

stage('Test') {
steps {
sh "mvn test"
// Verify start the verify phase so the coverage can be recorded and runs the tests
sh "mvn verify"
}
}

stage('Publish coverage') {
steps {
lockedStep(250, "graphhopper_matrix_${env.BRANCH_NAME}_publish_coverage") {
script {
// Publish Coverage HTML result
publishHTML(target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: false,
reportDir: 'coverage/target/site/jacoco-aggregate',
reportFiles: 'index.html',
reportName: 'Jacoco Report',
reportTitles: 'Jacoco Report'
])
}
}
}
}

Expand Down
29 changes: 29 additions & 0 deletions client-hc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,33 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<!-- to avoid bugs in some situations -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- create report during maven verify phase -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
24 changes: 24 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,30 @@
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<!-- to avoid bugs in some situations -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- create report during maven verify phase -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

<!-- make version available at runtime via version file -->
Expand Down
94 changes: 94 additions & 0 deletions coverage/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>graphhopper-coverage</artifactId>
<packaging>jar</packaging>
<name>GraphHopper Coverage</name>

<parent>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-parent</artifactId>
<version>2.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>directions-api-client-hc</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-example</artifactId>
<version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-map-matching</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-nav</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-reader-gtfs</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-tools</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-web</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-web-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.stuart.platform.graphhopper</groupId>
<artifactId>graphhopper-web-bundle</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
29 changes: 29 additions & 0 deletions example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,33 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<!-- to avoid bugs in some situations -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- create report during maven verify phase -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

</project>
23 changes: 23 additions & 0 deletions map-matching/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<!-- to avoid bugs in some situations -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- create report during maven verify phase -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
29 changes: 29 additions & 0 deletions navigation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,33 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<!-- to avoid bugs in some situations -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- create report during maven verify phase -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

</project>
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<maven.compiler.target>1.8</maven.compiler.target>

<jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
<!-- We always had this disabled as it is disabled by default in debian JDK builds, but when we
switched to another JDK on travis it was enabled implicitly. Our javadocs are not ready for this
so we disable it explicitly now -->
Expand Down Expand Up @@ -68,6 +68,7 @@
<module>client-hc</module>
<module>navigation</module>
<module>example</module>
<module>coverage</module>
</modules>
<dependencyManagement>
<dependencies>
Expand Down
23 changes: 23 additions & 0 deletions reader-gtfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,29 @@
<argLine>-Xmx1200m -Xms1200m -Duser.language=en</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<!-- to avoid bugs in some situations -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- create report during maven verify phase -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
23 changes: 23 additions & 0 deletions tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,29 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<!-- to avoid bugs in some situations -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- create report during maven verify phase -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Loading

0 comments on commit 74f8c3d

Please sign in to comment.