Sonar support was added with this commit on nuxeo-java-client repository.
Reports are correctly sent to sonar.io but coverage is 0.0%.
There're 8 unit tests detected, corresponding to unit tests in nuxeo-java-client module. Note that integration tests (presents in nuxeo-java-client-test) are not detected.
Aim would be to have coverage for UT but also IT (even if it's in a different maven module).
Configuration was made following the nuxeo main repository one.
About CI, nuxeo-java-client has 4 multibranch pipeline jobs (one per nuxeo maintenance version and one for master):
- https://qa2.nuxeo.org/jenkins/job/7.10/job/nuxeo-java-client-vs-7.10/
- https://qa2.nuxeo.org/jenkins/job/8.10/job/nuxeo-java-client-vs-8.10/
- https://qa2.nuxeo.org/jenkins/job/9.10/job/nuxeo-java-client-vs-9.10/
- https://qa.nuxeo.org/jenkins/job/Client/job/nuxeo-java-client-vs-master/
Only the master one do the analysis, as per:
// do analysis only on VS Nuxeo master job if (env.STATUS_CONTEXT_NAME == 'nuxeo/master') { stage('analysis') { withEnv(['MAVEN_OPTS=-Xmx1g -server']) { withCredentials([usernamePassword(credentialsId: 'c4ced779-af65-4bce-9551-4e6c0e0dcfe5', passwordVariable: 'SONARCLOUD_PWD', usernameVariable: '')]) { if (env.BRANCH_NAME != 'master') { TARGET_OPTION = "-Dsonar.branch.target=master" } else { TARGET_OPTION = "" } sh """#!/bin/bash -ex mvn clean verify sonar:sonar -Dsonar.login=$SONARCLOUD_PWD \ -Dsonar.branch.name=${env.BRANCH_NAME} $TARGET_OPTION \ -P ${env.TARGET_PLATFORM},qa,sonar \ -Dit.jacoco.destFile=$WORKSPACE/target/jacoco-it.exec """ } } } }
You can find this extracted code in Jenkinsfile
Note that analysis will be done for each branches.
A future improvement could be to put analysis report into PR status.
- is required by
-
JAVACLIENT-157 Add sonar coverage to sonar reporting
- Resolved