diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6cbaf2d18da1158cea5709dd98aefbd42a705f73..a951638f381e8e077786a38013c19455c52ae3d1 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" @@ -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,16 @@ test: - build - .gradle +pages: + stage: deploy + dependencies: + - test + script: + - mkdir public + - mv build/reports/jacoco/test/html public/coverage + artifacts: + paths: + - public +# only: +# - develop + diff --git a/build.gradle b/build.gradle index 5f9dea1057226b04daf5aae7c07ca9a66aea178f..e4c826eb58f93d7a27cb7f6050db8844b9e1af78 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 + } +} +