Resolve "Setup SonarQube pipeline for development branch"

- Remove de.aaschmid.cpd, and sonarqube v2.7 gradle plugins
 - Add sonarqube and jacopo gradle plugins
 - Remove code_quality job and add sonarqube job in code_quality stage
 - Limit sonarqube analysis to dev branch only
This commit is contained in:
Luca Ponzanelli 2020-05-07 13:39:08 +02:00
parent 5a31f4cf98
commit 028983072d
2 changed files with 17 additions and 11 deletions

View file

@ -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

View file

@ -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'
}