From c1a2f6b10db5674841a4ad3fd108e6cd8c26033b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 16:39:13 +0200 Subject: [PATCH 01/10] chore: suppress PMD violation --- .../avaloq/tools/ddk/xtext/generator/util/ModelValidator.java | 1 + .../xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java | 1 + ddk-parent/pom.xml | 3 +++ 3 files changed, 5 insertions(+) diff --git a/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/util/ModelValidator.java b/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/util/ModelValidator.java index f4f68292ea..6b4c3d552f 100644 --- a/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/util/ModelValidator.java +++ b/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/util/ModelValidator.java @@ -65,6 +65,7 @@ public List validate(final Resource resource, final Logger logger) { * @param logger * the logger */ + @SuppressWarnings("PMD.UnnecessaryVarargsArrayCreation") private void logIssue(final Resource resource, final Issue issue, final Logger logger) { final String message = NLS.bind(MESSAGE_TEMPLATE, new Object[] {resource.getURI().lastSegment(), issue.getLineNumber(), issue.getMessage()}); final Severity severity = issue.getSeverity(); diff --git a/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java b/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java index 27a7769b2c..df8b3441bd 100644 --- a/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java +++ b/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java @@ -81,6 +81,7 @@ protected void disconnected() { * the event */ @Override + @SuppressWarnings("PMD.UnnecessaryVarargsArrayCreation") public void propertyChange(final PropertyChangeEvent event) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(NLS.bind("Preference Change: {0} => {1} -> {2}", new Object[] {event.getProperty(), event.getOldValue(), event.getNewValue()})); //$NON-NLS-1$ diff --git a/ddk-parent/pom.xml b/ddk-parent/pom.xml index ecb5b27a4f..eb0c482321 100644 --- a/ddk-parent/pom.xml +++ b/ddk-parent/pom.xml @@ -308,6 +308,9 @@ ${pmd.ruleset} + + ${basedir}/src + ${basedir}/src-gen ${basedir}/src-model From 162f166cd08e35035f40da13417b17d1b27af3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 15:30:27 +0200 Subject: [PATCH 02/10] ci: only run spotbugs for changed modules --- .../enable-spotbugs-for-changed-modules.sh | 59 +++++++++++ .github/workflows/verify.yml | 99 +++++++++++++++++-- ddk-parent/pom.xml | 3 +- 3 files changed, 152 insertions(+), 9 deletions(-) create mode 100644 .github/scripts/enable-spotbugs-for-changed-modules.sh diff --git a/.github/scripts/enable-spotbugs-for-changed-modules.sh b/.github/scripts/enable-spotbugs-for-changed-modules.sh new file mode 100644 index 0000000000..92ee6b85a1 --- /dev/null +++ b/.github/scripts/enable-spotbugs-for-changed-modules.sh @@ -0,0 +1,59 @@ +#!/bin/bash +set -e + +# This script enables SpotBugs only for modules that have changed files + +BASE_SHA="$1" + +if [ -z "$BASE_SHA" ]; then + echo "Usage: $0 " + echo "Enabling SpotBugs for ALL modules (no base SHA provided)" + exit 0 +fi + +# Get list of changed files +CHANGED_FILES=$(git diff --name-only "$BASE_SHA" HEAD) + +# Extract unique module directories (top-level dirs with pom.xml or META-INF/MANIFEST.MF) +CHANGED_MODULES=$(echo "$CHANGED_FILES" | grep -E '^[^/]+/' | cut -d'/' -f1 | sort -u) + +echo "Detecting changed modules..." +MODULE_COUNT=0 + +for dir in $CHANGED_MODULES; do + # Check if this is a module directory + if [ -f "$dir/pom.xml" ]; then + echo " - $dir" + + # Add spotbugs.skip=false property to this module's pom.xml + # Check if pom.xml already has a section + if grep -q "" "$dir/pom.xml"; then + # Insert after opening tag + sed -i '//a\ + false' "$dir/pom.xml" + else + # Insert new section after or + sed -i '/eclipse-plugin<\/packaging>/a\ + \ + false\ + ' "$dir/pom.xml" + fi + + MODULE_COUNT=$((MODULE_COUNT + 1)) + + elif [ -f "$dir/META-INF/MANIFEST.MF" ]; then + echo " - $dir (MANIFEST only, checking for pom.xml)" + # Some modules might only have MANIFEST.MF, check if pom exists + if [ ! -f "$dir/pom.xml" ]; then + echo " Warning: $dir has no pom.xml, skipping SpotBugs" + fi + fi +done + +if [ $MODULE_COUNT -eq 0 ]; then + echo "No modules with pom.xml files were changed" + echo "SpotBugs will be skipped for all modules" +else + echo "" + echo "Enabled SpotBugs for $MODULE_COUNT module(s)" +fi diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index afb7b98dd0..4e1f37ea0e 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -3,9 +3,11 @@ on: push: branches: [master] pull_request: + jobs: + # Job 1: PMD (runs independently and in parallel) pmd: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 - uses: actions/setup-java@v5 @@ -22,31 +24,112 @@ jobs: - name: Fail build if there are violations if: steps.pmd.outputs.violations != 0 run: exit 1 + + # Job 2: Code Quality Checks (runs in parallel with PMD) + code-quality: + runs-on: ubuntu-24.04 + strategy: + fail-fast: true + matrix: + check: [checkstyle, pmd, pmd-cpd] + steps: + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.11 + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: Set up Workspace Environment Variable + run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV + - name: Cache Maven dependencies + uses: actions/cache@v4 + with: + path: /home/runner/.m2/repository + key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} + - name: Run ${{ matrix.check }} + run: | + if [ "${{ matrix.check }}" = "checkstyle" ]; then + mvn checkstyle:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + elif [ "${{ matrix.check }}" = "pmd" ]; then + mvn pmd:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + elif [ "${{ matrix.check }}" = "pmd-cpd" ]; then + mvn pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + fi + + # Job 3: Maven verify (main build, runs in parallel with static analysis) maven-verify: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Set up Maven uses: stCarolas/setup-maven@v5 with: maven-version: 3.9.11 - uses: actions/checkout@v5 + with: + fetch-depth: 0 - name: Set up JDK 21 uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '21' - - name: Set up Workspace Enviroment Variable - run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV + - name: Set up Workspace Environment Variable + run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV - name: Cache Maven dependencies uses: actions/cache@v4 - with: + with: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - - name: Build with Maven within a virtual X Server Environment - run: xvfb-run mvn clean verify checkstyle:check pmd:pmd pmd:check pmd:cpd-check spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - - name: Archive Tycho Surefire Plugin + - name: Build with Maven within a virtual X Server Environment + run: xvfb-run mvn clean verify -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + - name: Archive Tycho Surefire Plugin logs if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: tycho-surefire-plugin path: ${{ env.GITHUB_WORKSPACE }}/com.avaloq.tools.ddk.xtext.test/target/work/data/.metadata/.log + + # Job 4: SpotBugs (runs after maven-verify, only on changed modules for PRs) + spotbugs: + runs-on: ubuntu-24.04 + needs: maven-verify + steps: + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.11 + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: Set up Workspace Environment Variable + run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV + - name: Cache Maven dependencies + uses: actions/cache@v4 + with: + path: /home/runner/.m2/repository + key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} + - name: Enable SpotBugs for changed modules (PR only) + if: github.event_name == 'pull_request' + run: | + chmod +x .github/scripts/enable-spotbugs-for-changed-modules.sh + .github/scripts/enable-spotbugs-for-changed-modules.sh "${{ github.event.pull_request.base.sha }}" + - name: Enable SpotBugs for all modules (push to master) + if: github.event_name == 'push' + run: | + echo "Running SpotBugs on all modules (push to master)" + # Set spotbugs.skip=false in parent POM + sed -i 's/true<\/spotbugs.skip>/false<\/spotbugs.skip>/' ddk-parent/pom.xml + - name: Compile modules for SpotBugs analysis + run: mvn clean compile -f ./ddk-parent/pom.xml --batch-mode + - name: Run SpotBugs + run: mvn spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end diff --git a/ddk-parent/pom.xml b/ddk-parent/pom.xml index eb0c482321..a28bffef74 100644 --- a/ddk-parent/pom.xml +++ b/ddk-parent/pom.xml @@ -36,6 +36,7 @@ ${workspace}/ddk-configuration/checkstyle/avaloq-test.xml ${workspace}/ddk-configuration/findbugs/exclusion-filter.xml 2048 + true ${runtime.javaOptions} @@ -354,12 +355,12 @@ + ${spotbugs.skip} true ${spotbugs.maxHeap} 15 Low ${spotbugs.excludeFilterFile} - 1024 From 19be4ec03ae463d20821263ead295b887a2e5722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 15:45:07 +0200 Subject: [PATCH 03/10] compile once --- .github/workflows/verify.yml | 55 +++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 4e1f37ea0e..6c3c91a050 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -62,9 +62,44 @@ jobs: mvn pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end fi - # Job 3: Maven verify (main build, runs in parallel with static analysis) + # Job 3: Compile (produces artifacts for verify and spotbugs) + compile: + runs-on: ubuntu-24.04 + steps: + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.11 + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: Set up Workspace Environment Variable + run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV + - name: Cache Maven dependencies + uses: actions/cache@v4 + with: + path: /home/runner/.m2/repository + key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} + - name: Compile all modules + run: mvn clean test-compile -f ./ddk-parent/pom.xml --batch-mode + - name: Upload compiled artifacts + uses: actions/upload-artifact@v4 + with: + name: compiled-classes + path: | + **/target/classes + **/target/test-classes + retention-days: 1 + + # Job 4: Maven verify (runs tests using compiled artifacts) maven-verify: runs-on: ubuntu-24.04 + needs: compile steps: - name: Set up Maven uses: stCarolas/setup-maven@v5 @@ -85,8 +120,12 @@ jobs: with: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - - name: Build with Maven within a virtual X Server Environment - run: xvfb-run mvn clean verify -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + - name: Download compiled artifacts + uses: actions/download-artifact@v4 + with: + name: compiled-classes + - name: Run tests with Maven within a virtual X Server Environment + run: xvfb-run mvn verify -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - name: Archive Tycho Surefire Plugin logs if: ${{ failure() }} uses: actions/upload-artifact@v4 @@ -94,10 +133,10 @@ jobs: name: tycho-surefire-plugin path: ${{ env.GITHUB_WORKSPACE }}/com.avaloq.tools.ddk.xtext.test/target/work/data/.metadata/.log - # Job 4: SpotBugs (runs after maven-verify, only on changed modules for PRs) + # Job 5: SpotBugs (uses compiled artifacts, only on changed modules for PRs) spotbugs: runs-on: ubuntu-24.04 - needs: maven-verify + needs: compile steps: - name: Set up Maven uses: stCarolas/setup-maven@v5 @@ -118,6 +157,10 @@ jobs: with: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} + - name: Download compiled artifacts + uses: actions/download-artifact@v4 + with: + name: compiled-classes - name: Enable SpotBugs for changed modules (PR only) if: github.event_name == 'pull_request' run: | @@ -129,7 +172,5 @@ jobs: echo "Running SpotBugs on all modules (push to master)" # Set spotbugs.skip=false in parent POM sed -i 's/true<\/spotbugs.skip>/false<\/spotbugs.skip>/' ddk-parent/pom.xml - - name: Compile modules for SpotBugs analysis - run: mvn clean compile -f ./ddk-parent/pom.xml --batch-mode - name: Run SpotBugs run: mvn spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end From e8cf521582c1f85494f98b805dfd9311763e417d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 15:46:40 +0200 Subject: [PATCH 04/10] try combining pmd,cpd,checkstyle --- .github/workflows/verify.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 6c3c91a050..e2d996666b 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -28,10 +28,6 @@ jobs: # Job 2: Code Quality Checks (runs in parallel with PMD) code-quality: runs-on: ubuntu-24.04 - strategy: - fail-fast: true - matrix: - check: [checkstyle, pmd, pmd-cpd] steps: - name: Set up Maven uses: stCarolas/setup-maven@v5 @@ -52,15 +48,8 @@ jobs: with: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - - name: Run ${{ matrix.check }} - run: | - if [ "${{ matrix.check }}" = "checkstyle" ]; then - mvn checkstyle:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - elif [ "${{ matrix.check }}" = "pmd" ]; then - mvn pmd:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - elif [ "${{ matrix.check }}" = "pmd-cpd" ]; then - mvn pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - fi + - name: Run checkstyle, pmd, and cpd + run: mvn checkstyle:check pmd:check pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end # Job 3: Compile (produces artifacts for verify and spotbugs) compile: From 032999c4c00d9da2cbd1390ddc3c71a0a3d489c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 15:53:54 +0200 Subject: [PATCH 05/10] use 1.5C --- .github/workflows/verify.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index e2d996666b..3e55d36df6 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -48,8 +48,8 @@ jobs: with: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - - name: Run checkstyle, pmd, and cpd - run: mvn checkstyle:check pmd:check pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + - name: Run checkstyle, pmd, and cpd + run: mvn -T 1.5C checkstyle:check pmd:check pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end # Job 3: Compile (produces artifacts for verify and spotbugs) compile: @@ -74,8 +74,8 @@ jobs: with: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - - name: Compile all modules - run: mvn clean test-compile -f ./ddk-parent/pom.xml --batch-mode + - name: Compile all modules + run: mvn -T 1.5C clean test-compile -f ./ddk-parent/pom.xml --batch-mode - name: Upload compiled artifacts uses: actions/upload-artifact@v4 with: @@ -113,8 +113,8 @@ jobs: uses: actions/download-artifact@v4 with: name: compiled-classes - - name: Run tests with Maven within a virtual X Server Environment - run: xvfb-run mvn verify -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + - name: Run tests with Maven within a virtual X Server Environment + run: xvfb-run mvn -T 1.5C verify -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - name: Archive Tycho Surefire Plugin logs if: ${{ failure() }} uses: actions/upload-artifact@v4 @@ -161,5 +161,5 @@ jobs: echo "Running SpotBugs on all modules (push to master)" # Set spotbugs.skip=false in parent POM sed -i 's/true<\/spotbugs.skip>/false<\/spotbugs.skip>/' ddk-parent/pom.xml - - name: Run SpotBugs - run: mvn spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + - name: Run SpotBugs + run: mvn -T 1.5C spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end From 2490b68c9ac63fb7c918b03f1cf515942d1554f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 16:00:33 +0200 Subject: [PATCH 06/10] fix classpath location --- .github/workflows/verify.yml | 298 ++++++++++++++++------------------- 1 file changed, 138 insertions(+), 160 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 3e55d36df6..7f4b2004aa 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -1,165 +1,143 @@ -name: verify -on: - push: - branches: [master] - pull_request: - -jobs: - # Job 1: PMD (runs independently and in parallel) - pmd: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-java@v5 - with: - distribution: 'temurin' - java-version: '21' - - name: PMD - uses: pmd/pmd-github-action@v2.0.0 - id: pmd - with: - version: '7.17.0' - rulesets: 'ddk-configuration/pmd/ruleset.xml' - analyzeModifiedFilesOnly: false - - name: Fail build if there are violations - if: steps.pmd.outputs.violations != 0 - run: exit 1 - - # Job 2: Code Quality Checks (runs in parallel with PMD) - code-quality: - runs-on: ubuntu-24.04 - steps: - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.11 - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - name: Set up JDK 21 - uses: actions/setup-java@v5 - with: - distribution: 'temurin' - java-version: '21' - - name: Set up Workspace Environment Variable - run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV - - name: Cache Maven dependencies - uses: actions/cache@v4 - with: - path: /home/runner/.m2/repository - key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} +name: verify +on: + push: + branches: [master] + pull_request: + +jobs: + # Job 1: PMD (runs independently and in parallel) + pmd: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: PMD + uses: pmd/pmd-github-action@v2.0.0 + id: pmd + with: + version: '7.17.0' + rulesets: 'ddk-configuration/pmd/ruleset.xml' + analyzeModifiedFilesOnly: false + - name: Fail build if there are violations + if: steps.pmd.outputs.violations != 0 + run: exit 1 + + # Job 2: Code Quality Checks (runs in parallel with PMD) + code-quality: + runs-on: ubuntu-24.04 + steps: + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.11 + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: Set up Workspace Environment Variable + run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV + - name: Cache Maven dependencies + uses: actions/cache@v4 + with: + path: /home/runner/.m2/repository + key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - name: Run checkstyle, pmd, and cpd run: mvn -T 1.5C checkstyle:check pmd:check pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - - # Job 3: Compile (produces artifacts for verify and spotbugs) - compile: - runs-on: ubuntu-24.04 - steps: - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.11 - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - name: Set up JDK 21 - uses: actions/setup-java@v5 - with: - distribution: 'temurin' - java-version: '21' - - name: Set up Workspace Environment Variable - run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV - - name: Cache Maven dependencies - uses: actions/cache@v4 - with: - path: /home/runner/.m2/repository - key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - - name: Compile all modules - run: mvn -T 1.5C clean test-compile -f ./ddk-parent/pom.xml --batch-mode - - name: Upload compiled artifacts - uses: actions/upload-artifact@v4 - with: - name: compiled-classes - path: | - **/target/classes - **/target/test-classes - retention-days: 1 - - # Job 4: Maven verify (runs tests using compiled artifacts) - maven-verify: - runs-on: ubuntu-24.04 - needs: compile - steps: - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.11 - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - name: Set up JDK 21 - uses: actions/setup-java@v5 - with: - distribution: 'temurin' - java-version: '21' - - name: Set up Workspace Environment Variable - run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV - - name: Cache Maven dependencies - uses: actions/cache@v4 - with: - path: /home/runner/.m2/repository - key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - - name: Download compiled artifacts - uses: actions/download-artifact@v4 - with: - name: compiled-classes + + # Job 3: Compile and install (produces artifacts for verify and spotbugs) + compile: + runs-on: ubuntu-24.04 + steps: + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.11 + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: Set up Workspace Environment Variable + run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV + - name: Cache Maven dependencies + uses: actions/cache@v4 + with: + path: /home/runner/.m2/repository + key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} + - name: Compile and install all modules + run: mvn -T 1.5C clean install -f ./ddk-parent/pom.xml --batch-mode -DskipTests + + # Job 4: Maven verify (runs tests) + maven-verify: + runs-on: ubuntu-24.04 + needs: compile + steps: + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.11 + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: Set up Workspace Environment Variable + run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV + - name: Cache Maven dependencies + uses: actions/cache@v4 + with: + path: /home/runner/.m2/repository + key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - name: Run tests with Maven within a virtual X Server Environment run: xvfb-run mvn -T 1.5C verify -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - - name: Archive Tycho Surefire Plugin logs - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: tycho-surefire-plugin - path: ${{ env.GITHUB_WORKSPACE }}/com.avaloq.tools.ddk.xtext.test/target/work/data/.metadata/.log - - # Job 5: SpotBugs (uses compiled artifacts, only on changed modules for PRs) - spotbugs: - runs-on: ubuntu-24.04 - needs: compile - steps: - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.11 - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - name: Set up JDK 21 - uses: actions/setup-java@v5 - with: - distribution: 'temurin' - java-version: '21' - - name: Set up Workspace Environment Variable - run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV - - name: Cache Maven dependencies - uses: actions/cache@v4 - with: - path: /home/runner/.m2/repository - key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - - name: Download compiled artifacts - uses: actions/download-artifact@v4 - with: - name: compiled-classes - - name: Enable SpotBugs for changed modules (PR only) - if: github.event_name == 'pull_request' - run: | - chmod +x .github/scripts/enable-spotbugs-for-changed-modules.sh - .github/scripts/enable-spotbugs-for-changed-modules.sh "${{ github.event.pull_request.base.sha }}" - - name: Enable SpotBugs for all modules (push to master) - if: github.event_name == 'push' - run: | - echo "Running SpotBugs on all modules (push to master)" - # Set spotbugs.skip=false in parent POM - sed -i 's/true<\/spotbugs.skip>/false<\/spotbugs.skip>/' ddk-parent/pom.xml + + # Job 5: SpotBugs + spotbugs: + runs-on: ubuntu-24.04 + needs: compile + steps: + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.11 + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: Set up Workspace Environment Variable + run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV + - name: Cache Maven dependencies + uses: actions/cache@v4 + with: + path: /home/runner/.m2/repository + key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} + - name: Enable SpotBugs for changed modules (PR only) + if: github.event_name == 'pull_request' + run: | + chmod +x .github/scripts/enable-spotbugs-for-changed-modules.sh + .github/scripts/enable-spotbugs-for-changed-modules.sh "${{ github.event.pull_request.base.sha }}" + - name: Enable SpotBugs for all modules (push to master) + if: github.event_name == 'push' + run: | + echo "Running SpotBugs on all modules (push to master)" + # Set spotbugs.skip=false in parent POM + sed -i 's/true<\/spotbugs.skip>/false<\/spotbugs.skip>/' ddk-parent/pom.xml - name: Run SpotBugs - run: mvn -T 1.5C spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + run: mvn -T 1.5C spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end \ No newline at end of file From a460c1551cc7d15e647bb71af299e7f713b03510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 16:08:34 +0200 Subject: [PATCH 07/10] pass the artifacts correctly post installation --- .github/workflows/verify.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 7f4b2004aa..2ccf438979 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -76,6 +76,12 @@ jobs: key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - name: Compile and install all modules run: mvn -T 1.5C clean install -f ./ddk-parent/pom.xml --batch-mode -DskipTests + - name: Upload installed module JARs + uses: actions/upload-artifact@v4 + with: + name: installed-jars + path: /home/runner/.m2/repository/com/avaloq/tools/ddk/ + retention-days: 1 # Job 4: Maven verify (runs tests) maven-verify: @@ -101,6 +107,11 @@ jobs: with: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} + - name: Download installed module JARs + uses: actions/download-artifact@v4 + with: + name: installed-jars + path: /home/runner/.m2/repository/com/avaloq/tools/ddk/ - name: Run tests with Maven within a virtual X Server Environment run: xvfb-run mvn -T 1.5C verify -f ./ddk-parent/pom.xml --batch-mode --fail-at-end @@ -128,6 +139,11 @@ jobs: with: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} + - name: Download installed module JARs + uses: actions/download-artifact@v4 + with: + name: installed-jars + path: /home/runner/.m2/repository/com/avaloq/tools/ddk/ - name: Enable SpotBugs for changed modules (PR only) if: github.event_name == 'pull_request' run: | @@ -140,4 +156,4 @@ jobs: # Set spotbugs.skip=false in parent POM sed -i 's/true<\/spotbugs.skip>/false<\/spotbugs.skip>/' ddk-parent/pom.xml - name: Run SpotBugs - run: mvn -T 1.5C spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end \ No newline at end of file + run: mvn -T 1.5C spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end From 1d09e3c7519a9bf08bb7aaec166b1a4018e124f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 16:11:08 +0200 Subject: [PATCH 08/10] chore: fix PMD violation --- .../xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java | 1 - 1 file changed, 1 deletion(-) diff --git a/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java b/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java index df8b3441bd..27a7769b2c 100644 --- a/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java +++ b/com.avaloq.tools.ddk.xtext.ui/src/com/avaloq/tools/ddk/xtext/ui/editor/model/ResponsiveXtextDocumentProvider.java @@ -81,7 +81,6 @@ protected void disconnected() { * the event */ @Override - @SuppressWarnings("PMD.UnnecessaryVarargsArrayCreation") public void propertyChange(final PropertyChangeEvent event) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(NLS.bind("Preference Change: {0} => {1} -> {2}", new Object[] {event.getProperty(), event.getOldValue(), event.getNewValue()})); //$NON-NLS-1$ From bc0bcf6eae84ccd65d19dbf35fa13915fe456e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 16:22:48 +0200 Subject: [PATCH 09/10] place target files in the right place --- .github/workflows/verify.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 2ccf438979..e7dffc05b3 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -82,6 +82,15 @@ jobs: name: installed-jars path: /home/runner/.m2/repository/com/avaloq/tools/ddk/ retention-days: 1 + - name: Upload compiled target directories + uses: actions/upload-artifact@v4 + with: + name: target-dirs + path: | + **/target/classes + **/target/test-classes + **/target/*.jar + retention-days: 1 # Job 4: Maven verify (runs tests) maven-verify: @@ -112,6 +121,11 @@ jobs: with: name: installed-jars path: /home/runner/.m2/repository/com/avaloq/tools/ddk/ + - name: Download compiled target directories + uses: actions/download-artifact@v4 + with: + name: target-dirs + path: . - name: Run tests with Maven within a virtual X Server Environment run: xvfb-run mvn -T 1.5C verify -f ./ddk-parent/pom.xml --batch-mode --fail-at-end @@ -144,6 +158,11 @@ jobs: with: name: installed-jars path: /home/runner/.m2/repository/com/avaloq/tools/ddk/ + - name: Download compiled target directories + uses: actions/download-artifact@v4 + with: + name: target-dirs + path: . - name: Enable SpotBugs for changed modules (PR only) if: github.event_name == 'pull_request' run: | From 570583a26b3c687234ba9f4da9f2527e6fe7b8e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dinis=20Ferreira?= Date: Sat, 18 Oct 2025 16:54:07 +0200 Subject: [PATCH 10/10] ci: collect all PMD errors before failing --- .github/workflows/verify.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index e7dffc05b3..f1dc3ae8ad 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -49,7 +49,9 @@ jobs: path: /home/runner/.m2/repository key: ${{ runner.os }}-maven-0-${{ hashFiles('**/pom.xml') }} - name: Run checkstyle, pmd, and cpd - run: mvn -T 1.5C checkstyle:check pmd:check pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end + # Run pmd:pmd and pmd:cpd first to generate reports for all modules, then run pmd:check and pmd:cpd-check + # This ensures all violations are collected and reported before the build fails + run: mvn -T 1.5C checkstyle:check pmd:pmd pmd:cpd pmd:check pmd:cpd-check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end # Job 3: Compile and install (produces artifacts for verify and spotbugs) compile: