diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0aca2c3fe90eb23ea0bd455ed7806b541973a5f8..68cb23770a3f5eb413f289d9574344fca7a5311a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,7 @@ variables: test_frontend: stage: test + coverage: '/Statements[:\ ]+(\d+.\d+)\%/' script: - cd frontend-js - npm install @@ -20,6 +21,7 @@ test_frontend: test_backend 1 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: #xvfb is for X11 connection used by some parts of the java code: https://stackoverflow.com/a/47575851/1127920 - apt-get update @@ -29,129 +31,158 @@ test_backend 1 15: - mvn -DskipTests=true clean install -pl commons -am - mvn test -pl commons + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' commons/target/site/jacoco/jacoco.csv test_backend 2 15: image: maven:3.6.0-jdk-8 services: - postgres:9.6 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mkdir /etc/minerva/ - cp test-db-ci.properties /etc/minerva/db.properties - mvn -DskipTests=true clean install -pl annotation -am - mvn test -pl annotation + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' annotation/target/site/jacoco/jacoco.csv test_backend 3 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mvn -DskipTests=true clean install -pl CellDesigner-plugin -am - mvn test -pl CellDesigner-plugin + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' CellDesigner-plugin/target/site/jacoco/jacoco.csv test_backend 4 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mvn -DskipTests=true clean install -pl converter -am - mvn test -pl converter + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter/target/site/jacoco/jacoco.csv test_backend 5 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mvn -DskipTests=true clean install -pl converter-graphics -am - mvn test -pl converter-graphics + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-graphics/target/site/jacoco/jacoco.csv test_backend 6 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mvn -DskipTests=true clean install -pl converter-CellDesigner -am - mvn test -pl converter-CellDesigner + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-CellDesigner/target/site/jacoco/jacoco.csv test_backend 7 15: image: maven:3.6.0-jdk-8 services: - postgres:9.6 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mkdir /etc/minerva/ - cp test-db-ci.properties /etc/minerva/db.properties - mvn -DskipTests=true clean install -pl converter-SBGNML -am - mvn test -pl converter-SBGNML + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-SBGNML/target/site/jacoco/jacoco.csv test_backend 8 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mvn -DskipTests=true clean install -pl converter-sbml -am - mvn test -pl converter-sbml + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' converter-sbml/target/site/jacoco/jacoco.csv test_backend 9 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mvn -DskipTests=true clean install -pl model -am - mvn test -pl model + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' model/target/site/jacoco/jacoco.csv test_backend 10 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mvn -DskipTests=true clean install -pl model-command -am - mvn test -pl model-command + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' model-command/target/site/jacoco/jacoco.csv test_backend 11 15: image: maven:3.6.0-jdk-8 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mvn -DskipTests=true clean install -pl pathvisio -am - mvn test -pl pathvisio + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' pathvisio/target/site/jacoco/jacoco.csv test_backend 12 15: image: maven:3.6.0-jdk-8 services: - postgres:9.6 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mkdir /etc/minerva/ - cp test-db-ci.properties /etc/minerva/db.properties - mvn -DskipTests=true clean install -pl persist -am - mvn test -pl persist + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' persist/target/site/jacoco/jacoco.csv test_backend 13 15: image: maven:3.6.0-jdk-8 services: - postgres:9.6 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mkdir /etc/minerva/ - cp test-db-ci.properties /etc/minerva/db.properties - mvn -DskipTests=true clean install -pl reactome -am - mvn test -pl reactome + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' reactome/target/site/jacoco/jacoco.csv test_backend 14 15: image: maven:3.6.0-jdk-8 services: - postgres:9.6 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mkdir /etc/minerva/ - cp test-db-ci.properties /etc/minerva/db.properties - mvn -DskipTests=true clean install -pl rest-api -am - mvn test -pl rest-api + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' rest-api/target/site/jacoco/jacoco.csv test_backend 15 15: image: maven:3.6.0-jdk-8 services: - postgres:9.6 stage: test + coverage: '/(\d+.\d+) \% covered/' script: - mkdir /etc/minerva/ - cp test-db-ci.properties /etc/minerva/db.properties - mvn -DskipTests=true clean install -pl service -am - mvn test -pl service + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, "instructions covered"; print 100*covered/instructions,"% covered" }' service/target/site/jacoco/jacoco.csv build_war: image: maven:3.6.0-jdk-8 diff --git a/pom.xml b/pom.xml index c6cbff9814714288b971db5f98a5802f5e44f3a7..a069d78f0f5c681b9a3d1822b1fe1561e32acf65 100644 --- a/pom.xml +++ b/pom.xml @@ -173,6 +173,25 @@ <surefire.rerunFailingTestsCount>4</surefire.rerunFailingTestsCount> </configuration> </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.9</version> + <executions> + <execution> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>generate-code-coverage-report</id> + <phase>test</phase> + <goals> + <goal>report</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build>