diff --git a/.github/workflows/maven_unit_test.yml b/.github/workflows/maven_unit_test.yml index a69d5c4ffe3..7f689bb7b3c 100644 --- a/.github/workflows/maven_unit_test.yml +++ b/.github/workflows/maven_unit_test.yml @@ -147,7 +147,7 @@ jobs: # Get the build output from the integration test job - uses: actions/download-artifact@v8 with: - name: java-reportdir + name: java-reportdir - run: tar -xvf java-reportdir.tar # Deposit Code Coverage @@ -162,7 +162,41 @@ jobs: -DrepoToken=${COVERALLS_SECRET} -DpullRequest=${{ github.event.number }} jacoco:report coveralls:report - # NOTE: this may be extended with adding a report to the build output, leave a comment, send to Sonarcloud, ... + sonarcloud: + runs-on: ubuntu-latest + needs: integration-test + name: SonarQube Analysis and Coverage + steps: + # TODO: As part of #10618 change to setup-maven custom action + # Basic setup chores + - uses: actions/checkout@v7 + with: + # Sonarcube benefits from a full Git history in it's analysis (assign issues, etc) + fetch-depth: 0 + - uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: temurin + cache: maven + + # Get the coverage output from the integration test job + - uses: actions/download-artifact@v8 + with: + name: java-reportdir + # Get the binary class files as Sonar needs them for analysis + - uses: actions/download-artifact@v8 + with: + name: java-artifacts + - run: | + tar -xvf java-builddir.tar + tar -xvf java-reportdir.tar + + # Run Sonarcube analysis + - name: Analyze and commit to SonarCloud + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar # TODO: Add a filter step here, that avoids calling the app image release workflow if there are changes to the base image. # Use https://github.com/dorny/paths-filter to solve this. Will require and additional job or adding to integration-test job. diff --git a/modules/dataverse-parent/pom.xml b/modules/dataverse-parent/pom.xml index a31b01328ae..f5ced53eb7c 100644 --- a/modules/dataverse-parent/pom.xml +++ b/modules/dataverse-parent/pom.xml @@ -173,7 +173,6 @@ 3.7.1 5.10.2 5.11.0 - 0.8.11 9.3 @@ -198,9 +197,18 @@ 3.2.2 1.6.13 1.7.0 + 5.7.0.6970 + 0.8.14 0.48.0 + + + https://sonarcloud.io + iqss + IQSS_dataverse + ${project.groupId}:${project.artifactId} + jacoco @@ -318,6 +326,11 @@ pomchecker-maven-plugin ${pomchecker-maven-plugin.version} + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar.version} + org.sonatype.plugins nexus-staging-maven-plugin diff --git a/pom.xml b/pom.xml index 50c44586ca3..d182abbc3e2 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,9 @@ -Ddummy.jacoco.property=true -Ddummy.jacoco.property=true + ${project.reporting.outputDirectory}/jacoco-merged-test-coverage-report + ${jacoco.merged.outputdir}/jacoco.xml + war @@ -1031,7 +1034,7 @@ ${project.build.directory}/coverage-reports/merged.exec - ${project.reporting.outputDirectory}/jacoco-merged-test-coverage-report + ${jacoco.merged.outputdir} ${skipIntegrationTests}