|
1 | 1 | name: Build |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - - develop |
8 | | - pull_request: |
9 | | - merge_group: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - develop |
| 8 | + pull_request: |
| 9 | + merge_group: |
10 | 10 |
|
11 | 11 | permissions: |
12 | | - id-token: write # This is required for requesting the JWT |
13 | | - security-events: write |
14 | | - contents: read |
15 | | - actions: read # This is required for actions/checkout |
16 | | - issues: write |
17 | | - pull-requests: write |
18 | | - checks: write # needed for spotbugs |
| 12 | + # This is required for requesting the JWT |
| 13 | + id-token: write |
| 14 | + security-events: write |
| 15 | + contents: read |
| 16 | + # This is required for actions/checkout |
| 17 | + actions: read |
| 18 | + issues: write |
| 19 | + pull-requests: write |
| 20 | + checks: write # needed for spotbugs |
| 21 | + |
| 22 | + # For reporting |
| 23 | + attestations: write |
| 24 | + checks: write |
| 25 | + # For Junit Reporting commenting |
| 26 | + pull-requests: write |
19 | 27 |
|
20 | 28 | jobs: |
21 | | - build: |
22 | | - strategy: |
23 | | - matrix: |
24 | | - os: [ubuntu-latest, windows-latest] |
25 | | - java: [11, 17] |
26 | | - fail-fast: false |
| 29 | + build: |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + os: [ ubuntu-latest, windows-latest ] |
| 33 | + java: [ 11, 17 ] |
| 34 | + fail-fast: false |
| 35 | + |
| 36 | + runs-on: ${{ matrix.os }} |
27 | 37 |
|
28 | | - runs-on: ${{ matrix.os }} |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v3 |
29 | 41 |
|
30 | | - steps: |
31 | | - - name: Checkout |
32 | | - uses: actions/checkout@v3 |
| 42 | + - name: Set up cache for ~./m2/repository |
| 43 | + uses: actions/cache@v3 |
| 44 | + with: |
| 45 | + path: ~/.m2/repository |
| 46 | + key: maven-${{ matrix.os }}-java${{ matrix.java }}-${{ hashFiles('**/pom.xml') }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }} |
| 47 | + restore-keys: | |
| 48 | + maven-${{ matrix.os }}-java${{ matrix.java }}- |
| 49 | + maven-${{ matrix.os }}- |
33 | 50 |
|
34 | | - - name: Set up cache for ~./m2/repository |
35 | | - uses: actions/cache@v3 |
36 | | - with: |
37 | | - path: ~/.m2/repository |
38 | | - key: maven-${{ matrix.os }}-java${{ matrix.java }}-${{ hashFiles('**/pom.xml') }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }} |
39 | | - restore-keys: | |
40 | | - maven-${{ matrix.os }}-java${{ matrix.java }}- |
41 | | - maven-${{ matrix.os }}- |
| 51 | + - name: Set up JDK |
| 52 | + uses: actions/setup-java@v3 |
| 53 | + with: |
| 54 | + java-version: ${{ matrix.java }} |
| 55 | + distribution: "adopt" |
42 | 56 |
|
43 | | - - name: Set up JDK |
44 | | - uses: actions/setup-java@v3 |
45 | | - with: |
46 | | - java-version: ${{ matrix.java }} |
47 | | - distribution: "adopt" |
| 57 | + - name: Build with Maven |
| 58 | + run: ./mvnw --batch-mode clean install |
48 | 59 |
|
49 | | - - name: Build with Maven |
50 | | - run: ./mvnw --batch-mode clean install |
| 60 | + - name: Publish Test Report |
| 61 | + uses: mikepenz/action-junit-report@v5 |
| 62 | + if: success() || failure() # always run even if the previous step fails |
| 63 | + with: |
| 64 | + report_paths: '**/target/*/TEST-*.xml' |
51 | 65 |
|
52 | | - - name: Run PMD checks |
53 | | - run: ./mvnw pmd:check |
| 66 | + - name: Run PMD checks |
| 67 | + run: ./mvnw pmd:check |
54 | 68 |
|
55 | | - build-results: |
56 | | - name: Build results |
57 | | - if: ${{ always() }} |
58 | | - runs-on: ubuntu-latest |
59 | | - needs: |
60 | | - - build |
61 | | - steps: |
62 | | - - run: exit 1 |
63 | | - # see https://stackoverflow.com/a/67532120/4907315 |
64 | | - if: >- |
65 | | - ${{ |
66 | | - contains(needs.*.result, 'failure') |
67 | | - || contains(needs.*.result, 'cancelled') |
68 | | - || contains(needs.*.result, 'skipped') |
69 | | - }} |
| 69 | + build-results: |
| 70 | + name: Build results |
| 71 | + if: ${{ always() }} |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: |
| 74 | + - build |
| 75 | + steps: |
| 76 | + - run: exit 1 |
| 77 | + # see https://stackoverflow.com/a/67532120/4907315 |
| 78 | + if: >- |
| 79 | + ${{ |
| 80 | + contains(needs.*.result, 'failure') |
| 81 | + || contains(needs.*.result, 'cancelled') |
| 82 | + || contains(needs.*.result, 'skipped') |
| 83 | + }} |
0 commit comments