|
9 | 9 | permissions: |
10 | 10 | contents: read |
11 | 11 |
|
| 12 | +# Cancel orphaned PR runs when a new commit is pushed; push to main uses SHA so |
| 13 | +# main runs never queue or cancel each other. |
| 14 | +concurrency: |
| 15 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 16 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 17 | + |
12 | 18 | env: |
13 | 19 | AXONFLOW_TELEMETRY: 'off' |
14 | 20 |
|
|
17 | 23 | runs-on: ubuntu-latest |
18 | 24 |
|
19 | 25 | strategy: |
| 26 | + # PR runs only Java 17 (current release toolchain). Push to main and |
| 27 | + # workflow_dispatch run the full [11, 17, 21] matrix to validate |
| 28 | + # version-specific drift before the next tag. Cuts PR-time wallclock |
| 29 | + # ~2/3 (5.2m → ~2m on the heaviest workflow in the SDK fleet). |
20 | 30 | matrix: |
21 | | - java-version: [11, 17, 21] |
| 31 | + java-version: ${{ fromJson(github.event_name == 'pull_request' && '[17]' || '[11, 17, 21]') }} |
22 | 32 |
|
23 | 33 | steps: |
24 | 34 | - name: Checkout code |
|
84 | 94 | if: matrix.java-version == 17 |
85 | 95 | run: mvn jacoco:check -B |
86 | 96 |
|
| 97 | + # Aggregator that always reports a single check name regardless of the |
| 98 | + # matrix shape (PR-time matrix is `[17]`; push/dispatch is `[11, 17, 21]`). |
| 99 | + # Branch protection requires `Build Summary`, not the per-version names, |
| 100 | + # so matrix changes don't strand required checks. |
| 101 | + build-summary: |
| 102 | + name: Build Summary |
| 103 | + needs: [build] |
| 104 | + if: always() |
| 105 | + runs-on: ubuntu-latest |
| 106 | + steps: |
| 107 | + - name: Aggregate build matrix result |
| 108 | + run: | |
| 109 | + result="${{ needs.build.result }}" |
| 110 | + echo "build matrix result: $result" |
| 111 | + if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then |
| 112 | + echo "::error::build matrix did not all pass (result: $result)" |
| 113 | + exit 1 |
| 114 | + fi |
| 115 | + echo "Build matrix OK" |
| 116 | +
|
87 | 117 | lint: |
88 | 118 | runs-on: ubuntu-latest |
89 | 119 |
|
|
0 commit comments