From 57f87b1b8fc36a782e85d2ec8ae605492b02c26b Mon Sep 17 00:00:00 2001 From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de> Date: Sun, 16 Feb 2020 17:10:25 +0100 Subject: [PATCH 1/5] coverage --- .gitlab-ci.yml | 24 ++++++++++++++++++++++-- build.gradle | 11 +++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6cbaf2d..b68c883 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,11 +13,16 @@ variables: stages: - build - test + - deploy build: image: gradle:jdk8 stage: build script: gradle --build-cache assemble + artifacts: + paths: + - build/libs/*.jar + expire_in: 1 week cache: key: "$CI_COMMIT_REF_NAME" policy: push @@ -25,14 +30,18 @@ build: - build - .gradle - test: image: gradle:jdk8 stage: test - script: gradle check + script: + - gradle check + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' build/reports/jacoco/test/jacocoTestReport.csv + coverage: \d+.\d+ \% covered artifacts: reports: junit: build/test-results/test/TEST-*.xml + paths: + - build/reports/jacoco/ cache: key: "$CI_COMMIT_REF_NAME" policy: pull @@ -40,3 +49,14 @@ test: - build - .gradle +pages: + stage: deploy + dependencies: + - test + script: + - mkdir public + - mv build/reports/jacoco/test/html/* public + artifacts: + paths: + - public + diff --git a/build.gradle b/build.gradle index 5f9dea1..e4c826e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,7 @@ plugins { apply plugin: 'java' apply plugin: 'io.spring.dependency-management' +apply plugin: 'jacoco' group = 'info.textgrid.rep' version = '3.0.1-SNAPSHOT' @@ -67,3 +68,13 @@ task copyFonts(type: Copy, dependsOn: npmInstall) { // execute task: gradle -q copyAssets task copyAssets(dependsOn: [copyJS, copyImages, copyFonts]) +test { + finalizedBy jacocoTestReport +} + +jacocoTestReport { + reports { + csv.enabled true + } +} + -- GitLab From 17e1c094e9aad08f9d3e68c2ea9f02cb18a391bd Mon Sep 17 00:00:00 2001 From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de> Date: Sun, 16 Feb 2020 17:12:38 +0100 Subject: [PATCH 2/5] regexp fix --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b68c883..064b6d2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ test: script: - gradle check - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' build/reports/jacoco/test/jacocoTestReport.csv - coverage: \d+.\d+ \% covered + coverage: '\d+.\d+ \% covered' artifacts: reports: junit: build/test-results/test/TEST-*.xml -- GitLab From d25eb9b18bdffe71c3cf6a9dbc6f030f3c3ad474 Mon Sep 17 00:00:00 2001 From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de> Date: Sun, 16 Feb 2020 17:16:06 +0100 Subject: [PATCH 3/5] regexp fix --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 064b6d2..0165710 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ test: script: - gradle check - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' build/reports/jacoco/test/jacocoTestReport.csv - coverage: '\d+.\d+ \% covered' + coverage: /\d+.\d+ \% covered/ artifacts: reports: junit: build/test-results/test/TEST-*.xml -- GitLab From 5c75a69c61cfc6ff3d26d93b634e062548a14dce Mon Sep 17 00:00:00 2001 From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de> Date: Sun, 16 Feb 2020 19:37:46 +0100 Subject: [PATCH 4/5] restrict coverage report publishing to master --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0165710..6e968ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,4 +59,6 @@ pages: artifacts: paths: - public + only: + - develop -- GitLab From 89d09ef42c029d2d59f78c042ae39cb47b13325a Mon Sep 17 00:00:00 2001 From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de> Date: Sun, 16 Feb 2020 19:42:51 +0100 Subject: [PATCH 5/5] deploy to pages subfolder? --- .gitlab-ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e968ba..a951638 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,10 +2,10 @@ image: docker:latest services: - docker:dind -include: - - template: SAST.gitlab-ci.yml - - template: Dependency-Scanning.gitlab-ci.yml - - template: Code-Quality.gitlab-ci.yml +#include: +# - template: SAST.gitlab-ci.yml +# - template: Dependency-Scanning.gitlab-ci.yml +# - template: Code-Quality.gitlab-ci.yml variables: GRADLE_OPTS: "-Dorg.gradle.daemon=false" @@ -55,10 +55,10 @@ pages: - test script: - mkdir public - - mv build/reports/jacoco/test/html/* public + - mv build/reports/jacoco/test/html public/coverage artifacts: paths: - public - only: - - develop +# only: +# - develop -- GitLab