From 9eef1e69d7fcd5d1168de0f1d72fd5bccdf23cb6 Mon Sep 17 00:00:00 2001 From: Paul Flynn <43211074+pflynn-virtru@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:53:35 -0400 Subject: [PATCH] ci: SonarCloud coverage (#26) Introduced a new SonarCloud scan step in the GitHub Actions workflow to enhance code quality checks. Updated `pom.xml` to include SonarCloud configuration properties and reorganized Jacoco plugins under a new coverage profile. DSP-120 --- .github/workflows/checks.yaml | 20 +++++ nifi-tdf-nar/pom.xml | 18 +++++ nifi-tdf-processors/pom.xml | 24 ++++++ pom.xml | 144 ++++++++++++++++++---------------- settings.xml | 5 -- 5 files changed, 138 insertions(+), 73 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 3404aa7..be58781 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -47,11 +47,31 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + sonarcloud: + name: SonarCloud Scan + runs-on: ubuntu-22.04 + steps: + - name: Check out repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + fetch-depth: 0 + - name: Set up JDK + uses: actions/setup-java@5896cecc08fd8a1fbdfaf517e29b571164b031f7 + with: + java-version: "17" + distribution: "temurin" + server-id: github + - name: Maven Test Coverage + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: mvn --batch-mode clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -P coverage ci: needs: - mavenverify - pr + - sonarcloud runs-on: ubuntu-latest if: always() steps: diff --git a/nifi-tdf-nar/pom.xml b/nifi-tdf-nar/pom.xml index b48364d..144d1e4 100644 --- a/nifi-tdf-nar/pom.xml +++ b/nifi-tdf-nar/pom.xml @@ -33,6 +33,24 @@ org.apache.nifi nifi-nar-maven-plugin + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + none + + + report-aggregate + none + + + default-report-aggregate + none + + + \ No newline at end of file diff --git a/nifi-tdf-processors/pom.xml b/nifi-tdf-processors/pom.xml index 64836f9..a62f03a 100644 --- a/nifi-tdf-processors/pom.xml +++ b/nifi-tdf-processors/pom.xml @@ -103,6 +103,30 @@ org.jacoco jacoco-maven-plugin + + + prepare-agent + + prepare-agent + + + ${project.parent.basedir}/target/jacoco.exec + + + + report + test + + report + + + ${project.parent.basedir}/target/jacoco.exec + + XML + + + + diff --git a/pom.xml b/pom.xml index 7aa29b8..0af8523 100644 --- a/pom.xml +++ b/pom.xml @@ -33,6 +33,10 @@ 17 17 .7 + opentdf + opentdf_nifi + https://sonarcloud.io + ${project.basedir}/target/site/jacoco-aggregate/jacoco.xml nifi-tdf-controller-services-api @@ -60,7 +64,7 @@ io.opentdf.platform sdk - 0.6.1 + 0.7.3 org.apache.commons @@ -96,63 +100,6 @@ 1.5.1 true - - org.jacoco - jacoco-maven-plugin - 0.8.12 - - - jacoco-prepare-agent - - prepare-agent - - - - jacoco-prepare-agent-integration - - prepare-agent-integration - - - - jacoco-report - - report - - test - - - check - - check - - - - - BUNDLE - - - LINE - COVEREDRATIO - ${jacoco.line.coverage} - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.2.5 - - - 1 - - - - @@ -182,16 +129,6 @@ true - - opentdf - https://maven.pkg.github.com/opentdf/java-sdk - - true - - - true - - @@ -258,5 +195,76 @@ + + coverage + + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + jacoco-prepare-agent + + prepare-agent + + + + jacoco-prepare-agent-integration + + prepare-agent-integration + + + + jacoco-report + + report + + test + + + check + + check + + + + + BUNDLE + + + LINE + COVEREDRATIO + ${jacoco.line.coverage} + + + + + + + + report-aggregate + verify + + report-aggregate + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.5 + + + 1 + + ${argLine} + + + + + diff --git a/settings.xml b/settings.xml index 1cbc95d..3c7a40c 100644 --- a/settings.xml +++ b/settings.xml @@ -7,10 +7,5 @@ ${env.GITHUB_ACTOR} ${env.GITHUB_TOKEN} - - opentdf - ${env.GITHUB_ACTOR} - ${env.GITHUB_TOKEN} - \ No newline at end of file