summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-12-10 09:35:01 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-12-10 13:52:49 +0100
commit360df2054cdc5a8bc194f7701b2bfa5a9c39dd0d (patch)
tree90f9b8b0187a4bb4d033ccd57cc15e72b27791ae
parentba4489b7666e4ee669a1c91bfe36ae4ac90b1d93 (diff)
downloadEAAF-Components-360df2054cdc5a8bc194f7701b2bfa5a9c39dd0d.tar.gz
EAAF-Components-360df2054cdc5a8bc194f7701b2bfa5a9c39dd0d.tar.bz2
EAAF-Components-360df2054cdc5a8bc194f7701b2bfa5a9c39dd0d.zip
first test with code-coverage in CI pipe
-rw-r--r--.gitlab-ci.yml23
-rw-r--r--build_reporting/pom.xml78
-rw-r--r--pom.xml61
3 files changed, 150 insertions, 12 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ef026155..9ec05060 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,6 +18,7 @@ include:
stages:
- assemble
+ - visualize
- test
- package
- release
@@ -36,7 +37,27 @@ assemble:
when: always
reports:
junit: "**/target/surefire-reports/TEST-*.xml"
-
+ paths:
+ - build_reporting/target/site/jacoco-aggregate-ut/jacoco.xml
+
+coverage:
+ stage: visualize
+ image: haynes/jacoco2cobertura:1.0.4
+ script:
+ - mkdir -p target/site
+ # convert report from jacoco to cobertura
+ - 'python /opt/cover2cover.py build_reporting/target/site/jacoco-aggregate-ut/jacoco.xml eaaf_core_api/src/main/java eaaf_core_utils/src/main/java eaaf_core/src/main/java eaaf_modules/eaaf_module_auth_sl20/src/main/java eaaf_modules/eaaf_module_moa-sig/src/main/java eaaf_modules/eaaf_module_pvp2_core/src/main/java eaaf_modules/eaaf_module_pvp2_idp/src/main/java eaaf_modules/eaaf_module_pvp2_sp/src/main/java > target/site/cobertura.xml'
+ # read the <source></source> tag and prepend the path to every filename attribute
+ #- 'python /opt/source2filename.py target/site/cobertura.xml'
+ needs:
+ - job: assemble
+ dependencies:
+ - assemble
+ artifacts:
+ reports:
+ cobertura: target/site/cobertura.xml
+
+
publishToGitlab:
stage: package
except:
diff --git a/build_reporting/pom.xml b/build_reporting/pom.xml
new file mode 100644
index 00000000..5300ff74
--- /dev/null
+++ b/build_reporting/pom.xml
@@ -0,0 +1,78 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>eaaf</artifactId>
+ <version>1.1.11-SNAPSHOT</version>
+ </parent>
+ <artifactId>build_reporting</artifactId>
+ <packaging>pom</packaging>
+ <name>Reporting Module</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_core_api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_core_utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_auth_sl20</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_moa-sig</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_pvp2_core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_pvp2_idp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_pvp2_sp</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>${jacoco-maven-plugin.version}</version>
+ <executions>
+ <!-- aggregated unit test coverage report -->
+ <execution>
+ <id>aggregate-reports-ut</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report-aggregate</goal>
+ </goals>
+ <configuration>
+ <title>Maven Multimodule Coverage Demo: Coverage of Unit Tests</title>
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate-ut</outputDirectory>
+ <dataFileExcludes>
+ <!-- exclude coverage data of integration tests -->
+ <dataFileExclude>**/target/jacoco-it.exec</dataFileExclude>
+ </dataFileExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project> \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 40920657..585310ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -207,6 +207,7 @@
<module>eaaf_core_utils</module>
<module>eaaf_core</module>
<module>eaaf_modules</module>
+ <module>build_reporting</module>
</modules>
<dependencyManagement>
@@ -220,7 +221,38 @@
<groupId>at.gv.egiz.eaaf</groupId>
<artifactId>eaaf_core_utils</artifactId>
<version>${egiz.eaaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf-core</artifactId>
+ <version>${egiz.eaaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_auth_sl20</artifactId>
+ <version>${egiz.eaaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_moa-sig</artifactId>
+ <version>${egiz.eaaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_pvp2_core</artifactId>
+ <version>${egiz.eaaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_pvp2_idp</artifactId>
+ <version>${egiz.eaaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf_module_pvp2_sp</artifactId>
+ <version>${egiz.eaaf.version}</version>
</dependency>
+
<dependency>
<groupId>at.gv.egiz.components</groupId>
<artifactId>eventlog-api</artifactId>
@@ -597,6 +629,8 @@
<version>${surefire.version}</version>
<configuration>
<threadCount>1</threadCount>
+ <!-- Sets the VM argument line used when unit tests are run. -->
+ <argLine>${surefireArgLine}</argLine>
</configuration>
<dependencies>
<dependency>
@@ -649,6 +683,9 @@
<goals>
<goal>prepare-agent</goal>
</goals>
+ <configuration>
+ <propertyName>surefireArgLine</propertyName>
+ </configuration>
</execution>
<execution>
<id>post-unit-report</id>
@@ -659,7 +696,7 @@
<configuration>
<outputDirectory>target/jacoco-report</outputDirectory>
</configuration>
- </execution>
+ </execution>
<execution>
<id>post-unit-check</id>
<phase>test</phase>
@@ -686,7 +723,7 @@
</rule>
</rules>
</configuration>
- </execution>
+ </execution>
</executions>
</plugin>
@@ -747,18 +784,20 @@
</build>
<reporting>
- <plugins>
+ <plugins>
<plugin>
<groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <reportSets>
- <reportSet>
- <reports>
- <report>report</report>
- </reports>
- </reportSet>
- </reportSets>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <configuration>
+ <title>Maven Multimodule Coverage Demo: Coverage of Unit Tests</title>
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate-ut</outputDirectory>
+ <dataFileExcludes>
+ <!-- exclude coverage data of integration tests -->
+ <dataFileExclude>**/target/jacoco-it.exec</dataFileExclude>
+ </dataFileExcludes>
+ </configuration>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>