From e7478e1534aa55e8e773ced0640e7875f2d736b6 Mon Sep 17 00:00:00 2001 From: Marvin Lindner Date: Mon, 9 Mar 2026 17:10:25 +0100 Subject: [PATCH 1/3] add coverage module --- coverage-report/pom.xml | 176 ++++++++++++++++++++++++++++++++++ integration-tests/srv/pom.xml | 12 +++ pom.xml | 4 +- 3 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 coverage-report/pom.xml diff --git a/coverage-report/pom.xml b/coverage-report/pom.xml new file mode 100644 index 000000000..e56a67f6e --- /dev/null +++ b/coverage-report/pom.xml @@ -0,0 +1,176 @@ + + + 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 + ${revision} + + + + + + + + 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 + + + **/integration-tests/db/** + + + + + + + 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 6a5b6eada..74f49e35b 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 c36d8cb82..506884b86 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 @@ -406,6 +407,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 +420,7 @@ cds-feature-attachments storage-targets/cds-feature-attachments-fs storage-targets/cds-feature-attachments-oss - + From 8b66bcb8a57892f7808714ea4383c5d953d4c4c9 Mon Sep 17 00:00:00 2001 From: Marvin Lindner Date: Mon, 9 Mar 2026 17:10:31 +0100 Subject: [PATCH 2/3] add sonarqube support --- .github/actions/scan-with-sonar/action.yml | 11 +++++++---- .pipeline/config.yml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/actions/scan-with-sonar/action.yml b/.github/actions/scan-with-sonar/action.yml index 092254339..cdc4f8b34 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 aa968f3c7..1f85e8b3d 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 From 345ce20c95c0a4d246a26fb0246bca820dbb60c5 Mon Sep 17 00:00:00 2001 From: Marvin Lindner Date: Mon, 9 Mar 2026 17:18:10 +0100 Subject: [PATCH 3/3] adress suggestions --- coverage-report/pom.xml | 6 ------ pom.xml | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/coverage-report/pom.xml b/coverage-report/pom.xml index e56a67f6e..234149877 100644 --- a/coverage-report/pom.xml +++ b/coverage-report/pom.xml @@ -26,7 +26,6 @@ com.sap.cds.integration-tests cds-feature-attachments-integration-tests-srv - ${revision} @@ -94,11 +93,6 @@ report-aggregate verify - - - **/integration-tests/db/** - - diff --git a/pom.xml b/pom.xml index 506884b86..157f3ad49 100644 --- a/pom.xml +++ b/pom.xml @@ -128,6 +128,12 @@ cds-feature-attachments ${revision} + + + com.sap.cds.integration-tests + cds-feature-attachments-integration-tests-srv + ${revision} +