Skip to content

Commit a780934

Browse files
chore(ci): cancel orphaned PR runs + prune Java matrix on PR (#176)
* chore(ci): cancel orphaned PR runs + prune Java matrix on PR Sweeps the same patterns shipped on axonflow-enterprise (#2140, #2146): 1. **Concurrency**: cancel orphaned PR runs when a new commit is pushed; push-to-main keys on SHA so main runs never queue or cancel each other. Applied to ci, integration (existing block reshaped from `cancel-in-progress: true`), heartbeat-real-stack, wire-shape-contract, definition-of-done, validate-version-alignment. 2. **Matrix prune on PR** for ci.yml + integration.yml's contract-integration job: PR: java-version: [17] (current release toolchain) else: java-version: [11, 17, 21] (push, dispatch, weekly cron) Cuts the heaviest workflow in the SDK fleet from p95 ~5.2m to ~2m. Version-specific drift surfaces post-merge on push:main and the Tuesday cron (already present on integration.yml). 3. **definition-of-done.yml**: drop the `edited` PR event type — it re-runs the gate on title/body edits without any code change. Keep opened/synchronize/reopened. No app code change; CI ergonomics only. Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com> * ci: add Build Summary aggregator job The matrix prune in this PR (`[11, 17, 21]` → `[17]` on PR) means the per-version check names (`build (11)`, `build (21)`) don't report on PR runs. Branch protection requires those names, so PRs get permanently blocked. Add a `Build Summary` aggregator that always runs, reflects the overall matrix result (success/skipped → green; failure → red), and emits a stable single check name regardless of matrix shape. Branch protection should require `Build Summary` instead of the per-version names — same pattern axonflow-enterprise uses with its `Build Summary` / `Test Summary` aggregators. Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com> --------- Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
1 parent e2b5858 commit a780934

6 files changed

Lines changed: 58 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
permissions:
1010
contents: read
1111

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+
1218
env:
1319
AXONFLOW_TELEMETRY: 'off'
1420

@@ -17,8 +23,12 @@ jobs:
1723
runs-on: ubuntu-latest
1824

1925
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).
2030
matrix:
21-
java-version: [11, 17, 21]
31+
java-version: ${{ fromJson(github.event_name == 'pull_request' && '[17]' || '[11, 17, 21]') }}
2232

2333
steps:
2434
- name: Checkout code
@@ -84,6 +94,26 @@ jobs:
8494
if: matrix.java-version == 17
8595
run: mvn jacoco:check -B
8696

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+
87117
lint:
88118
runs-on: ubuntu-latest
89119

.github/workflows/definition-of-done.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ name: Definition of Done
66

77
on:
88
pull_request:
9-
types: [opened, synchronize, reopened, edited]
9+
# Trim out non-diff-changing event types: dropped `edited` (title/body
10+
# edit re-runs the gate without any code change). `reopened` retained for
11+
# PRs that were closed and reopened with new commits.
12+
types: [opened, synchronize, reopened]
1013

1114
permissions:
1215
contents: read
1316
pull-requests: read
1417

18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
20+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
21+
1522
jobs:
1623
lint-no-mocks-in-runtime-e2e:
1724
name: Lint — no mocks in runtime-e2e/

.github/workflows/heartbeat-real-stack.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
pull_request:
1313
branches: [main]
1414

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
17+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
18+
1519
env:
1620
AXONFLOW_TELEMETRY: 'off'
1721

.github/workflows/integration.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ permissions:
1515
contents: read
1616

1717
# Avoid spawning parallel docker-compose stacks for back-to-back pushes;
18-
# also cancels stale PR runs when a new commit lands.
18+
# also cancels stale PR runs when a new commit lands. Push to main keys on SHA
19+
# so main runs never queue or cancel each other.
1920
concurrency:
20-
group: integration-${{ github.ref }}
21-
cancel-in-progress: true
21+
group: integration-${{ github.event.pull_request.number || github.sha }}
22+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2223

2324
env:
2425
AXONFLOW_TELEMETRY: 'off'
@@ -33,8 +34,10 @@ jobs:
3334
timeout-minutes: 15
3435
strategy:
3536
fail-fast: false
37+
# PR runs only Java 17 (release toolchain). Push, dispatch, and weekly
38+
# cron run the full [11, 17, 21] matrix to catch version drift.
3639
matrix:
37-
java-version: [11, 17, 21]
40+
java-version: ${{ fromJson(github.event_name == 'pull_request' && '[17]' || '[11, 17, 21]') }}
3841
steps:
3942
- name: Checkout SDK
4043
uses: actions/checkout@v4

.github/workflows/validate-version-alignment.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ on:
2828
permissions:
2929
contents: read
3030

31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
33+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
34+
3135
env:
3236
AXONFLOW_TELEMETRY: 'off'
3337

.github/workflows/wire-shape-contract.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ on:
3333
permissions:
3434
contents: read
3535

36+
concurrency:
37+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
38+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
39+
3640
jobs:
3741
wire-shape:
3842
name: Validate Wire Shape

0 commit comments

Comments
 (0)