|
15 | 15 | description: Open SSH session in the runner |
16 | 16 | required: false |
17 | 17 | default: false |
18 | | - |
| 18 | + |
19 | 19 | jobs: |
20 | 20 | build: |
21 | | - uses: metricshub/workflows/.github/workflows/maven-build.yml@v4 |
22 | | - with: |
23 | | - jdkVersion: "17" |
24 | | - debug: ${{ github.event_name == 'workflow_dispatch' && inputs.debug }} |
25 | | - ssh: ${{ github.event_name == 'workflow_dispatch' && inputs.ssh }} |
| 21 | + name: Build on ${{ matrix.os }} |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + checks: write |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + os: |
| 30 | + - ubuntu-latest |
| 31 | + - windows-latest |
| 32 | + steps: |
| 33 | + - name: Checkout repository |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Set up Temurin JDK 17 |
| 37 | + uses: actions/setup-java@v4 |
| 38 | + with: |
| 39 | + distribution: temurin |
| 40 | + java-version: "17" |
| 41 | + cache: maven |
| 42 | + |
| 43 | + - name: Open SSH session |
| 44 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.ssh }} |
| 45 | + uses: mxschmitt/action-tmate@v3 |
| 46 | + with: |
| 47 | + limit-access-to-actor: true |
| 48 | + |
| 49 | + - name: Enable Maven debug flag |
| 50 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug }} |
| 51 | + shell: bash |
| 52 | + run: echo "MAVEN_DEBUG=-X" >> "$GITHUB_ENV" |
| 53 | + |
| 54 | + - name: Display environment details |
| 55 | + shell: bash |
| 56 | + run: | |
| 57 | + java -version |
| 58 | + mvn -version |
| 59 | +
|
| 60 | + - name: Build with Maven |
| 61 | + shell: bash |
| 62 | + run: | |
| 63 | + mvn -B -V ${MAVEN_DEBUG:-} verify site |
| 64 | +
|
| 65 | + - name: Upload Surefire reports |
| 66 | + if: always() |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: surefire-reports-${{ runner.os }} |
| 70 | + path: target/surefire-reports |
| 71 | + if-no-files-found: ignore |
| 72 | + |
| 73 | + - name: Upload Failsafe reports |
| 74 | + if: always() |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: failsafe-reports-${{ runner.os }} |
| 78 | + path: target/failsafe-reports |
| 79 | + if-no-files-found: ignore |
| 80 | + |
| 81 | + - name: Attach Maven artifacts to the build |
| 82 | + if: ${{ runner.os == 'Linux' && always() }} |
| 83 | + uses: sentrysoftware/upload-buildinfo-outputs@v2 |
| 84 | + |
| 85 | + - name: Upload Checkstyle reports to GitHub |
| 86 | + if: ${{ runner.os == 'Linux' && always() }} |
| 87 | + uses: jwgmeligmeyling/checkstyle-github-action@v1.2 |
| 88 | + with: |
| 89 | + path: "**/checkstyle-result.xml" |
| 90 | + |
| 91 | + - name: Upload Spotbugs reports to GitHub |
| 92 | + if: ${{ runner.os == 'Linux' && always() }} |
| 93 | + uses: jwgmeligmeyling/spotbugs-github-action@v1.2 |
| 94 | + with: |
| 95 | + path: "**/spotbugsXml.xml" |
| 96 | + |
| 97 | + - name: Upload PMD reports to GitHub |
| 98 | + if: ${{ runner.os == 'Linux' && always() }} |
| 99 | + uses: jwgmeligmeyling/pmd-github-action@v1.2 |
| 100 | + with: |
| 101 | + path: "**/pmd.xml" |
| 102 | + |
| 103 | + - name: Upload static analysis reports |
| 104 | + if: always() |
| 105 | + uses: actions/upload-artifact@v4 |
| 106 | + with: |
| 107 | + name: static-analysis-${{ runner.os }} |
| 108 | + path: | |
| 109 | + target/checkstyle-result.xml |
| 110 | + target/pmd.xml |
| 111 | + target/spotbugsXml.xml |
| 112 | + if-no-files-found: ignore |
| 113 | + |
| 114 | + - name: Upload Maven site |
| 115 | + if: always() |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: site-${{ runner.os }} |
| 119 | + path: target/site |
| 120 | + if-no-files-found: ignore |
0 commit comments