diff --git a/.github/actions/scan-with-sonar/action.yml b/.github/actions/scan-with-sonar/action.yml index 09225433..cdc4f8b3 100644 --- a/.github/actions/scan-with-sonar/action.yml +++ b/.github/actions/scan-with-sonar/action.yml @@ -43,9 +43,7 @@ runs: - name: Build project for SonarQube scan run: | - mvn clean verify -ntp -B \ - -pl cds-feature-attachments,storage-targets/cds-feature-attachments-fs,storage-targets/cds-feature-attachments-oss \ - -am + mvn clean verify -ntp -B shell: bash - name: Verify JaCoCo reports exist @@ -59,6 +57,11 @@ runs: echo "Missing: $module/target/site/jacoco/jacoco.xml" fi done + if [ -f "coverage-report/target/site/jacoco-aggregate/jacoco.xml" ]; then + echo "Found: coverage-report/target/site/jacoco-aggregate/jacoco.xml" + else + echo "Missing: coverage-report/target/site/jacoco-aggregate/jacoco.xml" + fi shell: bash - name: SonarQube Scan @@ -70,4 +73,4 @@ runs: --githubToken=${{ inputs.github-token }} --version=${{ steps.get-revision.outputs.REVISION }} --inferJavaBinaries=true - --options=-Dsonar.exclusions=**/samples/**,-Dsonar.coverage.jacoco.xmlReportPaths=cds-feature-attachments/target/site/jacoco/jacoco.xml,storage-targets/cds-feature-attachments-fs/target/site/jacoco/jacoco.xml,storage-targets/cds-feature-attachments-oss/target/site/jacoco/jacoco.xml \ No newline at end of file + --options=-Dsonar.exclusions=**/samples/**,-Dsonar.coverage.jacoco.xmlReportPaths=cds-feature-attachments/target/site/jacoco/jacoco.xml,storage-targets/cds-feature-attachments-fs/target/site/jacoco/jacoco.xml,storage-targets/cds-feature-attachments-oss/target/site/jacoco/jacoco.xml,coverage-report/target/site/jacoco-aggregate/jacoco.xml \ No newline at end of file diff --git a/.pipeline/config.yml b/.pipeline/config.yml index aa968f3c..1f85e8b3 100644 --- a/.pipeline/config.yml +++ b/.pipeline/config.yml @@ -36,7 +36,7 @@ steps: - sonar.java.source=17 - sonar.exclusions=**/node_modules/**,**/target/**,**/test/** - sonar.modules=cds-feature-attachments,cds-feature-attachments-fs,cds-feature-attachments-oss - - sonar.coverage.jacoco.xmlReportPaths=cds-feature-attachments/target/site/jacoco/jacoco.xml,storage-targets/cds-feature-attachments-fs/target/site/jacoco/jacoco.xml,storage-targets/cds-feature-attachments-oss/target/site/jacoco/jacoco.xml + - sonar.coverage.jacoco.xmlReportPaths=cds-feature-attachments/target/site/jacoco/jacoco.xml,storage-targets/cds-feature-attachments-fs/target/site/jacoco/jacoco.xml,storage-targets/cds-feature-attachments-oss/target/site/jacoco/jacoco.xml,coverage-report/target/site/jacoco-aggregate/jacoco.xml - sonar.coverage.exclusions=cds-feature-attachments/src/test/**,cds-feature-attachments/src/gen/**,storage-targets/cds-feature-attachments-fs/src/test/**,storage-targets/cds-feature-attachments-oss/src/test/** - cds-feature-attachments.sonar.projectBaseDir=cds-feature-attachments - cds-feature-attachments.sonar.sources=src/main/java diff --git a/coverage-report/pom.xml b/coverage-report/pom.xml new file mode 100644 index 00000000..23414987 --- /dev/null +++ b/coverage-report/pom.xml @@ -0,0 +1,170 @@ + + + 4.0.0 + + + com.sap.cds + cds-feature-attachments-root + ${revision} + + + cds-feature-attachments-coverage-report + pom + + CDS Feature for Attachments - Coverage Report + Aggregated JaCoCo coverage report combining unit tests and integration tests. + + + + + + com.sap.cds + cds-feature-attachments + + + + + com.sap.cds.integration-tests + cds-feature-attachments-integration-tests-srv + + + + + + + + maven-deploy-plugin + + true + + + + + + com.github.spotbugs + spotbugs-maven-plugin + + true + + + + maven-pmd-plugin + + true + + + + + + maven-resources-plugin + 3.3.1 + + + copy-core-classes + + copy-resources + + generate-resources + + ${project.build.directory}/classes + + + ${project.basedir}/../cds-feature-attachments/target/classes + + + + + + + + + org.jacoco + jacoco-maven-plugin + + + + jacoco-aggregate-report + + report-aggregate + + verify + + + + + jacoco-merge + + merge + + verify + + + + ${project.basedir}/../cds-feature-attachments/target + + jacoco.exec + + + + ${project.basedir}/../integration-tests/srv/target + + jacoco.exec + + + + ${project.build.directory}/jacoco-merged.exec + + + + + + jacoco-check-aggregated + + check + + verify + + ${project.build.directory}/jacoco-merged.exec + + ${excluded.generation.package}**/* + + + + BUNDLE + + + INSTRUCTION + COVEREDRATIO + 0.95 + + + BRANCH + COVEREDRATIO + 0.95 + + + COMPLEXITY + COVEREDRATIO + 0.95 + + + CLASS + MISSEDCOUNT + 0 + + + + + + + + + + + + diff --git a/integration-tests/srv/pom.xml b/integration-tests/srv/pom.xml index 6a5b6ead..74f49e35 100644 --- a/integration-tests/srv/pom.xml +++ b/integration-tests/srv/pom.xml @@ -115,6 +115,18 @@ + + org.jacoco + jacoco-maven-plugin + + + jacoco-initialize + + prepare-agent + + + + diff --git a/pom.xml b/pom.xml index c36d8cb8..157f3ad4 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,7 @@ storage-targets/cds-feature-attachments-fs storage-targets/cds-feature-attachments-oss integration-tests + coverage-report @@ -127,6 +128,12 @@ cds-feature-attachments ${revision} + + + com.sap.cds.integration-tests + cds-feature-attachments-integration-tests-srv + ${revision} + @@ -406,6 +413,7 @@ cds-feature-attachments-integration-tests-parent cds-feature-attachments-integration-tests-db cds-feature-attachments-integration-tests-srv + cds-feature-attachments-coverage-report @@ -418,7 +426,7 @@ cds-feature-attachments storage-targets/cds-feature-attachments-fs storage-targets/cds-feature-attachments-oss - +