diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 309580e..06efd58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,14 +52,10 @@ test: reports: junit: build/test-results/test/TEST-*.xml -#Runs a quality check on the code and creates a report on the codes -code_quality: +sonarqube: + image: gradle:jdk11 stage: code_quality - allow_failure: true + only: + - dev script: - - gradle cpdCheck - artifacts: - paths: - - build/reports/cpd/cpdCheck.xml - #create a report on the quality of the code - expose_as: 'Code Quality Report' + - gradle build jacocoTestReport sonarqube -Dsonar.verbose=true -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.projectKey=$CI_PROJECT_ PATH_SLUG -Dsonar.projectName=$CI_PROJECT_PATH_SLUG -Dsonar.scm.disabled=True -Dsonar.coverage.jacoco.xmlReportPaths=./build/reports/jacoco/test/jacocoTestReport.xml diff --git a/build.gradle b/build.gradle index 52470bf..4f04b96 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ plugins { id 'org.springframework.boot' version '2.2.4.RELEASE' id 'io.spring.dependency-management' version '1.0.9.RELEASE' - id "de.aaschmid.cpd" version "3.1" - id "org.sonarqube" version "2.7" id 'java' + id 'jacoco' + id "org.sonarqube" version "2.8" } group = 'ch.usi.inf.sa4.sanmarinoes' version = '0.0.1-SNAPSHOT' @@ -51,3 +51,13 @@ gradle.projectsEvaluated { test { useJUnitPlatform() } + +jacocoTestReport { + reports { + xml.enabled true + } +} + +plugins.withType(JacocoPlugin) { + tasks["test"].finalizedBy 'jacocoTestReport' +}