@@ -86,6 +86,23 @@ inputs:
8686 description : The label name for skipping tests
8787 required : false
8888 default : ' skip-tests'
89+ sonar-token :
90+ description : ' SonarCloud token'
91+ required : false
92+ aggregate-report-path :
93+ description : ' Path of the aggregated JaCoCo report'
94+ required : false
95+ project-key :
96+ description : ' SonarCloud project key'
97+ required : false
98+ sonar-host-url :
99+ description : ' SonarCloud host url'
100+ required : false
101+ default : ' https://sonarcloud.io'
102+ sonar-organization :
103+ description : ' SonarCloud organization'
104+ required : false
105+ default : ' alfresco'
89106
90107outputs :
91108 version :
@@ -240,13 +257,19 @@ runs:
240257 echo "testcontainers.reuse.enable=true" > ~/.testcontainers.properties
241258 echo "TESTCONTAINERS_RYUK_DISABLED=true" >> $GITHUB_ENV
242259
260+ - name : Set SONAR_SCANNER_OPTS
261+ if : inputs.sonar-token != ''
262+ shell : bash
263+ run : echo "SONAR_SCANNER_OPTS=sonar:sonar -Dsonar.host.url=${{ inputs.sonar-host-url }} -Dsonar.organization=${{ inputs.sonar-organization }} -Dsonar.projectKey=${{ inputs.project-key }} -Dsonar.coverage.jacoco.xmlReportPaths=${{ inputs.aggregate-report-path }}" >> $GITHUB_ENV
264+
243265 - name : Build and Test with Maven (and maybe Deploy)
244266 shell : bash
245- run : mvn ${{ steps.define_maven_command.outputs.command }} ${{ env.MAVEN_CLI_OPTS}} ${{ inputs.extra-maven-opts }}
267+ run : mvn ${{ steps.define_maven_command.outputs.command }} ${{ env.MAVEN_CLI_OPTS }} ${{ inputs.extra-maven-opts }} ${{ env.SONAR_SCANNER_OPTS }}
246268 env :
247269 MAVEN_CLI_OPTS : ${{ steps.compute-maven-options.outputs.result }} -Dlogging.root.level=off -Dspring.main.banner-mode=off -Ddocker.skip -Dmaven.build.cache.enabled=${{ env.MAVEN_BUILD_CACHE_ENABLED }}
248270 MAVEN_USERNAME : ${{ inputs.maven-username }}
249271 MAVEN_PASSWORD : ${{ inputs.maven-password }}
272+ SONAR_TOKEN : ${{ inputs.sonar-token }}
250273
251274 - name : Remove running docker containers
252275 if : inputs.reuse-testcontainers == 'true'
0 commit comments