Skip to content
Snippets Groups Projects
Commit 245dea0f authored by OZGCloud's avatar OZGCloud
Browse files

OZG-199 add sonarqube

parent c91db317
No related branches found
No related tags found
No related merge requests found
...@@ -34,24 +34,16 @@ pipeline { ...@@ -34,24 +34,16 @@ pipeline {
else { else {
sh 'npm run ci-build' sh 'npm run ci-build'
} }
withSonarQubeEnv('sonarqube'){
sh 'npm run ci-test' sh 'npm run ci-sonar'
}
} }
} }
} }
} }
post { post {
always{ always{
junit testResults: 'goofy-client/junit.xml', skipPublishingChecks: true junit testResults: 'goofy-client/test-report.xml', skipPublishingChecks: true
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'goofy-client/coverage/lcov-report',
reportFiles: 'index.html',
reportName: "Goofy-Client code coverage"
])
} }
} }
} }
...@@ -62,11 +54,15 @@ pipeline { ...@@ -62,11 +54,15 @@ pipeline {
FAILED_STAGE=env.STAGE_NAME FAILED_STAGE=env.STAGE_NAME
} }
container("maven-11"){ container("maven-11"){
configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) { withSonarQubeEnv('sonarqube'){
sh 'mvn --version' configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn --version'
sh 'mvn -s $MAVEN_SETTINGS -pl -goofy-client clean install' sh 'mvn -s $MAVEN_SETTINGS -pl -goofy-client clean install'
} dir('goofy-server'){
sh 'mvn sonar:sonar'
}
}
}
} }
} }
post { post {
...@@ -74,7 +70,7 @@ pipeline { ...@@ -74,7 +70,7 @@ pipeline {
junit testResults: '**/target/surefire-reports/*.xml', skipPublishingChecks: true junit testResults: '**/target/surefire-reports/*.xml', skipPublishingChecks: true
} }
} }
} }
stage('Openshift build') { stage('Openshift build') {
steps { steps {
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
junit.xml junit.xml
/apps/goofy-e2e/reports /apps/goofy-e2e/reports
/apps/goofy-e2e/recordings /apps/goofy-e2e/recordings
.scannerwork
test-report.xml
# dependencies # dependencies
/node_modules /node_modules
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
"test:debug:lib": "run-s \"ng -- test {1} --detectOpenHandles --watchAll\" --", "test:debug:lib": "run-s \"ng -- test {1} --detectOpenHandles --watchAll\" --",
"ci-build": "ng build --outputHashing=all", "ci-build": "ng build --outputHashing=all",
"ci-prodBuild": "ng build --prod --outputHashing=all", "ci-prodBuild": "ng build --prod --outputHashing=all",
"ci-test": "jest test a --ci --coverage --testResultsProcessor='jest-junit'", "ci-test": "jest test a --ci --coverage --testResultsProcessor='jest-sonar-reporter'",
"ci-sonar": "npm run ci-test && sonar-scanner",
"lint": "nx workspace-lint && ng lint", "lint": "nx workspace-lint && ng lint",
"affected:apps": "nx affected:apps", "affected:apps": "nx affected:apps",
"affected:libs": "nx affected:libs", "affected:libs": "nx affected:libs",
...@@ -40,7 +41,8 @@ ...@@ -40,7 +41,8 @@
"cypress:delete-old-reports": "node apps/goofy-e2e/src/support/delete-old-reports.ts", "cypress:delete-old-reports": "node apps/goofy-e2e/src/support/delete-old-reports.ts",
"cypress:generate-report": "npm run cypress:merge-report ; npm run cypress:generate-html", "cypress:generate-report": "npm run cypress:merge-report ; npm run cypress:generate-html",
"cypress:ci-run": "npm run cypress:delete-old-reports ; npm run cypress:run -- --config-file ./cypress-ci.json ; test=$(echo \"$?\") ; npm run cypress:generate-report ; exit $test", "cypress:ci-run": "npm run cypress:delete-old-reports ; npm run cypress:run -- --config-file ./cypress-ci.json ; test=$(echo \"$?\") ; npm run cypress:generate-report ; exit $test",
"workspace-generator": "nx workspace-generator" "workspace-generator": "nx workspace-generator",
"sonar-scanner": "jest test a --coverage --testResultsProcessor='jest-sonar-reporter' && sonar-scanner -Dsonar.host.url=https://sonarqube.ozg-sh.de/ -Dsonar.login=25dfb9ee83a79b0f4af445c63405651fcf391ee8"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
...@@ -100,8 +102,10 @@ ...@@ -100,8 +102,10 @@
"jest-createspyobj": "^2.0.0", "jest-createspyobj": "^2.0.0",
"jest-junit": "^12.0.0", "jest-junit": "^12.0.0",
"jest-marbles": "^2.5.1", "jest-marbles": "^2.5.1",
"jest-preset-angular": "8.3.2", "jest-preset-angular": "8.3.2",
"prettier": "2.2.1", "jest-sonar-reporter": "^2.0.0",
"prettier": "2.2.1",
"sonarqube-scanner": "^2.8.0",
"ts-jest": "26.4.0", "ts-jest": "26.4.0",
"ts-node": "9.1.1", "ts-node": "9.1.1",
"tslint": "6.1.3", "tslint": "6.1.3",
......
sonar.projectKey=goofy-client
sonar.sources=apps/goofy/src,libs
sonar.tests=apps/goofy/src,libs
sonar.test.inclusions=**/*.spec.ts
sonar.typescript.lcov.reportPaths=coverage/lcov.info
sonar.testExecutionReportPaths=test-report.xml
sonar.sourceEncoding=UTF-8
\ No newline at end of file
...@@ -173,13 +173,42 @@ ...@@ -173,13 +173,42 @@
</compilerArgs> </compilerArgs>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<executions>
<execution>
<id>start-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>surefire.jacoco.args</propertyName>
</configuration>
</execution>
<execution>
<id>generate-report</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>${surefire.jacoco.args}</argLine>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${surefire.jacoco.args}</argLine>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
sonar.java.coveragePlugin=jacoco
sonar.jacoco.reportPath=target/jacoco.exec
\ No newline at end of file
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<maven.surefire.version>3.0.0-M5</maven.surefire.version> <maven.surefire.version>3.0.0-M5</maven.surefire.version>
<maven.failsafe.version>3.0.0-M5</maven.failsafe.version> <maven.failsafe.version>3.0.0-M5</maven.failsafe.version>
<git-comit-id.plugin.version>4.0.3</git-comit-id.plugin.version> <git-comit-id.plugin.version>4.0.3</git-comit-id.plugin.version>
<sonarqube.version>3.8.0.2131</sonarqube.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
...@@ -142,6 +143,12 @@ ...@@ -142,6 +143,12 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${sonarqube.version}</version>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment