From 269f1515c8b2862aafb1993022ded9c9550008d1 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 2 Jun 2021 17:35:04 +0200 Subject: [PATCH] add sonarqube --- Jenkinsfile | 18 +++++++++++++++++- goofy-client/package.json | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c45db17484..32f98bd9c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,13 +39,19 @@ pipeline { } sh 'npm run ci-test' + + if (env.BRANCH_NAME == 'master') { + withSonarQubeEnv('sonarqube-ozg-sh'){ + sh 'npm run ci-sonar' + } + } } } } } post { always{ - junit testResults: 'goofy-client/junit.xml', skipPublishingChecks: true + junit testResults: 'goofy-client/test-report.xml', skipPublishingChecks: true } } } @@ -60,6 +66,16 @@ pipeline { sh 'mvn --version' sh 'mvn -s $MAVEN_SETTINGS -pl -goofy-client clean install spring-boot:build-image -Dmaven.wagon.http.retryHandler.count=3' } + + script { + if (env.BRANCH_NAME == 'master') { + dir('goofy-server'){ + withSonarQubeEnv('sonarqube-ozg-sh'){ + sh 'mvn sonar:sonar' + } + } + } + } } } post { diff --git a/goofy-client/package.json b/goofy-client/package.json index b46f8f1358..3efb87a1fd 100644 --- a/goofy-client/package.json +++ b/goofy-client/package.json @@ -15,7 +15,7 @@ "test:debug:lib": "run-s \"ng -- test {1} --detectOpenHandles --watchAll\" --", "ci-build": "ng build --outputHashing=all", "ci-prodBuild": "ng build --prod --outputHashing=all --prod", - "ci-test": "jest test a --ci --testResultsProcessor='jest-junit'", + "ci-test": "node --expose-gc ./node_modules/.bin/jest --ci --testResultsProcessor='jest-sonar-reporter' --logHeapUsage", "ci-sonar": "sonar-scanner", "lint": "nx workspace-lint && ng lint", "affected:apps": "nx affected:apps", @@ -43,7 +43,7 @@ "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:pre-merge ; npm run cypress:generate-report ; exit $test", "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" + "sonar-scanner": "npm test -- --testResultsProcessor='jest-sonar-reporter' && sonar-scanner -Dsonar.host.url=https://sonarqube.ozg-sh.de/ -Dsonar.login=364c6e09430714838730a83f55d3369a7ffda0e9" }, "private": true, "dependencies": { -- GitLab