|
| 1 | +name: CI Diagnose (mvn + Tycho + Codacy) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + diag: |
| 11 | + # parallel auf 22.04 und 24.04 (t64) – zeigt sofort, ob OS/Runner die Ursache ist |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + os: [ubuntu-22.04, ubuntu-latest] |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + checks: write |
| 20 | + pull-requests: write |
| 21 | + env: |
| 22 | + DISPLAY: :0 |
| 23 | + MAVEN_OPTS: -Djava.awt.headless=true |
| 24 | + # Wenn du ein Codacy-Token hast, trage den Secret-Namen unten im Step ein. |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + fetch-depth: 0 |
| 31 | + |
| 32 | + - name: Print context |
| 33 | + run: | |
| 34 | + echo "OS: $(lsb_release -ds || cat /etc/os-release)" |
| 35 | + echo "Kernel: $(uname -a)" |
| 36 | + echo "Commit: $GITHUB_SHA" |
| 37 | + echo "Actor: $GITHUB_ACTOR | Event: $GITHUB_EVENT_NAME" |
| 38 | + echo "Java requested: 21 Temurin" |
| 39 | +
|
| 40 | + - name: Set up JDK 21 |
| 41 | + uses: actions/setup-java@v4 |
| 42 | + with: |
| 43 | + java-version: '21' |
| 44 | + distribution: 'temurin' |
| 45 | + cache: maven |
| 46 | + |
| 47 | + - name: Install system packages (GTK/X11/NSS/Audio) + start Xvfb |
| 48 | + run: | |
| 49 | + sudo apt-get update |
| 50 | + sudo apt-get install -y xvfb xauth \ |
| 51 | + libgtk-3-0 libxext6 libxrender1 libxtst6 libxi6 libxrandr2 libxfixes3 \ |
| 52 | + libnss3 libgbm1 || true |
| 53 | + # Asound: 24.04 heißt 'libasound2t64', 22.04 heißt 'libasound2' |
| 54 | + sudo apt-get install -y libasound2t64 || sudo apt-get install -y libasound2 || true |
| 55 | + sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 & |
| 56 | + echo "JAVA_HOME=$JAVA_HOME" |
| 57 | + java -version |
| 58 | +
|
| 59 | + - name: Set up Maven 3.9.9 |
| 60 | + uses: stCarolas/setup-maven@v5 |
| 61 | + with: |
| 62 | + maven-version: 3.9.9 |
| 63 | + |
| 64 | + - name: Print Maven env |
| 65 | + run: | |
| 66 | + mvn -v |
| 67 | + echo "::group::Effective settings" |
| 68 | + MAVEN_SETTINGS="${HOME}/.m2/settings.xml" |
| 69 | + test -f "$MAVEN_SETTINGS" && cat "$MAVEN_SETTINGS" || echo "(no ~/.m2/settings.xml)" |
| 70 | + echo "::endgroup::" |
| 71 | +
|
| 72 | + - name: Resolve & build (extra debug, don’t change your POMs) |
| 73 | + # sammelt *viel* Output und schreibt Logs in target/*.log |
| 74 | + run: | |
| 75 | + set -o pipefail |
| 76 | + XVFB="xvfb-run --auto-servernum" |
| 77 | + MVN_ARGS="-e -V --batch-mode -Dtycho.localArtifacts=ignore -Dmaven.plugin.validation=VERBOSE -Dorg.slf4j.simpleLogger.showDateTime=true -Dtycho.debug.resolver=true" |
| 78 | + $XVFB mvn $MVN_ARGS -Pweb,jacoco clean verify | tee build-console.log |
| 79 | +
|
| 80 | + - name: (Optional) Codacy — don’t fail the job while diagnosing |
| 81 | + continue-on-error: true |
| 82 | + uses: codacy/codacy-analysis-cli-action@v4 |
| 83 | + with: |
| 84 | + # falls vorhanden: |
| 85 | + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} |
| 86 | + # api-token: ${{ secrets.CODACY_API_TOKEN }} |
| 87 | + # api-base-url: https://<deine-codacy-instanz> # falls self-hosted |
| 88 | + upload: true |
| 89 | + verbose: true |
| 90 | + |
| 91 | + - name: Collect logs & context |
| 92 | + if: always() |
| 93 | + run: | |
| 94 | + mkdir -p diag-artifacts |
| 95 | + cp -f build-console.log diag-artifacts/ || true |
| 96 | + # alle Maven/Tycho Logs einsammeln |
| 97 | + find . -type f -path "*/target/*.log" -print -exec cp -v {} diag-artifacts/ \; || true |
| 98 | + # Surefire/Failsafe Reports (falls vorhanden) |
| 99 | + find . -type f -path "*/target/surefire-reports/*" -print -exec cp -v {} diag-artifacts/ \; || true |
| 100 | + find . -type f -path "*/target/failsafe-reports/*" -print -exec cp -v {} diag-artifacts/ \; || true |
| 101 | + # p2/Tycho resolver logs (häufig unter target/.metadata/.log) |
| 102 | + find . -type f -name ".log" -path "*/target/*" -print -exec cp -v {} diag-artifacts/ \; || true |
| 103 | +
|
| 104 | + - name: Upload diagnostics |
| 105 | + if: always() |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: diag-${{ matrix.os }} |
| 109 | + path: diag-artifacts |
| 110 | + |
| 111 | + - name: Publish JUnit Report (if any) |
| 112 | + if: always() |
| 113 | + uses: mikepenz/action-junit-report@v5 |
| 114 | + with: |
| 115 | + report_paths: '**/target/surefire-reports/TEST-*.xml' |
0 commit comments