From a4df507924785995e2e6ca1ac556b7832edb259f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Porras=20Campo?= Date: Wed, 27 May 2026 14:02:19 +0200 Subject: [PATCH 1/2] build: do not run the verify on commits to master for this we have now the snapshot workflow. --- .github/workflows/verify.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index c882693636..34eb12ca8c 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -1,7 +1,5 @@ name: verify on: - push: - branches: [master] pull_request: jobs: pmd: From 084713d6f3da7bd09684abf4b4aaa88aad61b984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Porras=20Campo?= Date: Wed, 27 May 2026 14:06:19 +0200 Subject: [PATCH 2/2] build: unify the verify and snapshot workflows --- .github/scripts/check-line-endings.sh | 14 ++++++++++++++ .github/scripts/check-surefire-reports.sh | 9 +++++++++ .github/workflows/snapshot.yml | 17 ++++++++++++++++- .github/workflows/verify.yml | 23 +++-------------------- 4 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 .github/scripts/check-line-endings.sh create mode 100644 .github/scripts/check-surefire-reports.sh diff --git a/.github/scripts/check-line-endings.sh b/.github/scripts/check-line-endings.sh new file mode 100644 index 0000000000..eeb3858ba1 --- /dev/null +++ b/.github/scripts/check-line-endings.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Verifies that no tracked files have CRLF or mixed line endings in the index. +# .bat/.cmd/.ps1 files are exempted (declared CRLF in .gitattributes). +set -euo pipefail + +violations=$(git ls-files --eol \ + | grep -E "^i/(crlf|mixed)" \ + | grep -vE "\.(bat|cmd|ps1)$" || true) + +if [ -n "$violations" ]; then + echo "::error::Files with CRLF/mixed line endings stored in the index:" + echo "$violations" + exit 1 +fi diff --git a/.github/scripts/check-surefire-reports.sh b/.github/scripts/check-surefire-reports.sh new file mode 100644 index 0000000000..5be02ea2d3 --- /dev/null +++ b/.github/scripts/check-surefire-reports.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Fails the build if no Tycho Surefire test reports were produced. +# This catches broken test discovery early. +set -euo pipefail + +if ! find . -path '*/target/surefire-reports/TEST-*.xml' -print -quit | grep -q .; then + echo "::error::No surefire reports found. Test discovery is likely broken." + exit 1 +fi diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 3d7fe72bee..12481bdd21 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -26,6 +26,9 @@ jobs: ref: ${{ github.event.inputs.branch || github.ref }} fetch-depth: 0 + - name: Check LF line endings + run: bash .github/scripts/check-line-endings.sh + - name: Set snapshot SHA id: snapshot run: echo "sha=$(git rev-parse --short=8 HEAD)" >> "$GITHUB_OUTPUT" @@ -53,8 +56,20 @@ jobs: - name: Build p2 update site run: | xvfb-run mvn clean verify \ + checkstyle:check pmd:pmd pmd:cpd pmd:check pmd:cpd-check spotbugs:check \ -f ./ddk-parent/pom.xml \ - --batch-mode + --batch-mode --fail-at-end + + - name: Fail on missing surefire reports + if: always() + run: bash .github/scripts/check-surefire-reports.sh + + - name: Archive test logs + if: failure() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: test-logs-${{ github.sha }} + path: com.avaloq.tools.ddk.xtext.test/target/work/data/.metadata/.log - name: Upload p2 update site as artifact uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 34eb12ca8c..07e9226193 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -30,20 +30,8 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - name: Check LF line endings in index - # .gitattributes declares `* text=auto eol=lf` with .bat/.cmd/.ps1 - # exempted. Git's clean filter normalizes on commit, but verify it - # explicitly in case a file is miscategorized as binary or a filter - # is bypassed. - run: | - violations=$(git ls-files --eol \ - | grep -E "^i/(crlf|mixed)" \ - | grep -vE "\.(bat|cmd|ps1)$" || true) - if [ -n "$violations" ]; then - echo "Files with CRLF/mixed line endings stored in the index:" - echo "$violations" - exit 1 - fi + - name: Check LF line endings + run: bash .github/scripts/check-line-endings.sh maven-verify: runs-on: ubuntu-24.04 steps: @@ -67,13 +55,8 @@ jobs: # This ensures all violations are collected and reported before the build fails run: xvfb-run mvn clean verify checkstyle:check pmd:pmd pmd:cpd pmd:check pmd:cpd-check spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end - name: Fail on missing surefire reports - # Tycho-Surefire writes no TEST-*.xml when discovery is empty — fail the job in that case. if: always() - run: | - if ! find . -path '*/target/surefire-reports/TEST-*.xml' -print -quit | grep -q .; then - echo "::error::No surefire reports found. Test discovery is likely broken." - exit 1 - fi + run: bash .github/scripts/check-surefire-reports.sh - name: Archive Tycho Surefire Plugin if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7