Skip to content

Commit 022ad24

Browse files
authored
ci: Add more concurrency cancellation (#4199)
1 parent 971be90 commit 022ad24

8 files changed

Lines changed: 95 additions & 59 deletions

File tree

.github/workflows/ci-host.yaml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
uses: ./.github/workflows/test-web-assets.yaml
3131
with:
3232
skip_catalog: true
33+
concurrency:
34+
group: ci-host-test-web-assets-${{ github.head_ref || github.run_id }}
35+
cancel-in-progress: true
3336

3437
host-test:
3538
name: Host Tests
@@ -115,16 +118,16 @@ jobs:
115118

116119
- name: Upload junit report to GitHub Actions Artifacts
117120
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
118-
if: always()
121+
if: ${{ !cancelled() }}
119122
with:
120123
name: host-test-report-${{ matrix.shardIndex }}
121124
path: junit/host-${{ matrix.shardIndex }}.xml
122125
retention-days: 30
123126
- name: Print realm server logs
124-
if: always()
127+
if: ${{ !cancelled() }}
125128
run: cat /tmp/server.log
126129
- name: Extract worker and prerender logs
127-
if: always()
130+
if: ${{ !cancelled() }}
128131
run: |
129132
grep -E '^\[start:worker-development' /tmp/server.log > /tmp/worker-manager.log || true
130133
grep -E '^\[start:prerender-dev' /tmp/server.log > /tmp/prerender-server.log || true
@@ -133,64 +136,67 @@ jobs:
133136
grep -E '^\[start:test-realms|^\[start:worker-test' /tmp/server.log > /tmp/test-realms.log || true
134137
- name: Upload realm server log
135138
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
136-
if: always()
139+
if: ${{ !cancelled() }}
137140
with:
138141
name: realm-server-log-${{ matrix.shardIndex }}
139142
path: /tmp/server.log
140143
retention-days: 30
141144
- name: Upload worker manager log
142145
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
143-
if: always()
146+
if: ${{ !cancelled() }}
144147
with:
145148
name: worker-manager-log-${{ matrix.shardIndex }}
146149
path: /tmp/worker-manager.log
147150
retention-days: 30
148151
- name: Upload prerender server log
149152
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
150-
if: always()
153+
if: ${{ !cancelled() }}
151154
with:
152155
name: prerender-server-log-${{ matrix.shardIndex }}
153156
path: /tmp/prerender-server.log
154157
retention-days: 30
155158
- name: Upload prerender manager log
156159
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
157-
if: always()
160+
if: ${{ !cancelled() }}
158161
with:
159162
name: prerender-manager-log-${{ matrix.shardIndex }}
160163
path: /tmp/prerender-manager.log
161164
retention-days: 30
162165
- name: Upload start:development log
163166
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
164-
if: always()
167+
if: ${{ !cancelled() }}
165168
with:
166169
name: start-development-log-${{ matrix.shardIndex }}
167170
path: /tmp/start-development.log
168171
retention-days: 30
169172
- name: Upload test-realms log
170173
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
171-
if: always()
174+
if: ${{ !cancelled() }}
172175
with:
173176
name: test-realms-log-${{ matrix.shardIndex }}
174177
path: /tmp/test-realms.log
175178
retention-days: 30
176179
- name: Upload testem log
177180
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
178-
if: always()
181+
if: ${{ !cancelled() }}
179182
with:
180183
name: testem-log-${{ matrix.shardIndex }}
181184
path: junit/host-testem.log
182185
retention-days: 30
183186
- name: Upload icon server log
184187
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
185-
if: always()
188+
if: ${{ !cancelled() }}
186189
with:
187190
name: icon-server-log-${{ matrix.shardIndex }}
188191
path: /tmp/icon-server.log
189192
retention-days: 30
190193

191194
host-percy-finalize:
192195
name: Finalise Percy
193-
if: always()
196+
if: ${{ !cancelled() }}
197+
concurrency:
198+
group: host-percy-finalize-${{ github.head_ref || github.run_id }}
199+
cancel-in-progress: true
194200
needs: host-test
195201
runs-on: ubuntu-latest
196202

@@ -207,7 +213,10 @@ jobs:
207213

208214
host-merge-reports-and-publish:
209215
name: Merge Host reports and publish
210-
if: always()
216+
if: ${{ !cancelled() }}
217+
concurrency:
218+
group: host-merge-reports-and-publish-${{ github.head_ref || github.run_id }}
219+
cancel-in-progress: true
211220
needs: host-test
212221
runs-on: ubuntu-latest
213222

@@ -234,15 +243,15 @@ jobs:
234243

235244
- name: Upload merged report
236245
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
237-
if: always()
246+
if: ${{ !cancelled() }}
238247
with:
239248
name: host-test-report-merged
240249
path: host.xml
241250
retention-days: 30
242251

243252
- name: Publish test results
244253
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # 2.18.0
245-
if: always()
254+
if: ${{ !cancelled() }}
246255
with:
247256
junit_files: host.xml
248257
check_name: Host Test Results

.github/workflows/ci-lint.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,84 +23,84 @@ jobs:
2323
- uses: ./.github/actions/init
2424

2525
- name: Lint Boxel Icons
26-
if: always()
26+
if: ${{ !cancelled() }}
2727
run: pnpm run lint
2828
working-directory: packages/boxel-icons
2929
- name: Build Boxel Icons
3030
# To faciliate linting of projects that depend on Boxel Icons
31-
if: always()
31+
if: ${{ !cancelled() }}
3232
run: pnpm run build
3333
working-directory: packages/boxel-icons
3434
- name: Lint Boxel UI
35-
if: always()
35+
if: ${{ !cancelled() }}
3636
run: pnpm run lint
3737
working-directory: packages/boxel-ui/addon
3838
- name: Build Boxel UI
3939
# To faciliate linting of projects that depend on Boxel UI
40-
if: always()
40+
if: ${{ !cancelled() }}
4141
run: pnpm run build
4242
working-directory: packages/boxel-ui/addon
4343
- name: Lint Boxel UI Test App
44-
if: always()
44+
if: ${{ !cancelled() }}
4545
run: pnpm run lint
4646
working-directory: packages/boxel-ui/test-app
4747
- name: Lint Host
48-
if: always()
48+
if: ${{ !cancelled() }}
4949
run: pnpm run lint
5050
working-directory: packages/host
5151
- name: Lint Matrix
52-
if: always()
52+
if: ${{ !cancelled() }}
5353
run: pnpm run lint
5454
working-directory: packages/matrix
5555
- name: Lint Realm Server
56-
if: always()
56+
if: ${{ !cancelled() }}
5757
run: pnpm run lint
5858
working-directory: packages/realm-server
5959
- name: Lint Runtime Common
60-
if: always()
60+
if: ${{ !cancelled() }}
6161
run: pnpm run lint
6262
working-directory: packages/runtime-common
6363
- name: Lint Billing
64-
if: always()
64+
if: ${{ !cancelled() }}
6565
run: pnpm run lint
6666
working-directory: packages/billing
6767
- name: Lint Postgres
68-
if: always()
68+
if: ${{ !cancelled() }}
6969
run: pnpm run lint
7070
working-directory: packages/postgres
7171
- name: Lint Base Realm
72-
if: always()
72+
if: ${{ !cancelled() }}
7373
run: pnpm run lint
7474
working-directory: packages/base
7575
- name: Lint Catalog Realm
76-
if: always()
76+
if: ${{ !cancelled() }}
7777
run: pnpm run lint
7878
working-directory: packages/catalog-realm
7979
- name: Lint Experiments Realm
80-
if: always()
80+
if: ${{ !cancelled() }}
8181
run: pnpm run lint
8282
working-directory: packages/experiments-realm
8383
- name: Lint Software Factory
84-
if: always()
84+
if: ${{ !cancelled() }}
8585
run: pnpm run lint
8686
working-directory: packages/software-factory
8787
- name: Lint Boxel Tools VS Code extension
88-
if: always()
88+
if: ${{ !cancelled() }}
8989
run: pnpm run lint
9090
working-directory: packages/vscode-boxel-tools
9191
- name: Lint ESLint Plugin
92-
if: always()
92+
if: ${{ !cancelled() }}
9393
run: pnpm run lint
9494
working-directory: packages/eslint-plugin-boxel
9595
- name: Lint AI Bot
96-
if: always()
96+
if: ${{ !cancelled() }}
9797
run: pnpm run lint
9898
working-directory: packages/ai-bot
9999
- name: Lint Bot Runner
100-
if: always()
100+
if: ${{ !cancelled() }}
101101
run: pnpm run lint
102102
working-directory: packages/bot-runner
103103
- name: Lint Workspace Sync CLI
104-
if: always()
104+
if: ${{ !cancelled() }}
105105
run: pnpm run lint
106106
working-directory: packages/workspace-sync-cli

.github/workflows/ci.yaml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ jobs:
123123
needs: change-check
124124
if: needs.change-check.outputs.boxel == 'true' || needs.change-check.outputs.boxel-ui == 'true' || needs.change-check.outputs.matrix == 'true' || needs.change-check.outputs.realm-server == 'true' || needs.change-check.outputs.software-factory == 'true' || needs.change-check.outputs.vscode-boxel-tools == 'true' || needs.change-check.outputs.workspace-sync-cli == 'true' || github.ref == 'refs/heads/main' || needs.change-check.outputs.run_all == 'true'
125125
uses: ./.github/workflows/test-web-assets.yaml
126+
concurrency:
127+
group: ci-test-web-assets-${{ github.head_ref || github.run_id }}
128+
cancel-in-progress: true
126129

127130
ai-bot-test:
128131
name: AI bot Tests
@@ -329,38 +332,38 @@ jobs:
329332
run: pnpm test:group ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
330333
working-directory: packages/matrix
331334
- name: Print realm server logs
332-
if: always()
335+
if: ${{ !cancelled() }}
333336
run: cat /tmp/server.log
334337
- name: Extract worker and prerender logs
335-
if: always()
338+
if: ${{ !cancelled() }}
336339
run: |
337340
grep -E '^\[start:worker-base|^\[start:worker-development|^\[start:worker-test' /tmp/server.log > /tmp/worker-manager.log || true
338341
grep -E '^\[start:prerender-dev' /tmp/server.log > /tmp/prerender-server.log || true
339342
grep -E '^\[start:prerender-manager-dev' /tmp/server.log > /tmp/prerender-manager.log || true
340343
- name: Upload realm server log
341344
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
342-
if: always()
345+
if: ${{ !cancelled() }}
343346
with:
344347
name: matrix-test-realm-server-log-${{ matrix.shardIndex }}
345348
path: /tmp/server.log
346349
retention-days: 30
347350
- name: Upload worker manager log
348351
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
349-
if: always()
352+
if: ${{ !cancelled() }}
350353
with:
351354
name: matrix-test-worker-manager-log-${{ matrix.shardIndex }}
352355
path: /tmp/worker-manager.log
353356
retention-days: 30
354357
- name: Upload prerender server log
355358
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
356-
if: always()
359+
if: ${{ !cancelled() }}
357360
with:
358361
name: matrix-test-prerender-server-log-${{ matrix.shardIndex }}
359362
path: /tmp/prerender-server.log
360363
retention-days: 30
361364
- name: Upload prerender manager log
362365
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
363-
if: always()
366+
if: ${{ !cancelled() }}
364367
with:
365368
name: matrix-test-prerender-manager-log-${{ matrix.shardIndex }}
366369
path: /tmp/prerender-manager.log
@@ -388,9 +391,12 @@ jobs:
388391
needs:
389392
- change-check
390393
- matrix-client-test
391-
# always() makes it run even if a matrix-client-test shard fails
392-
if: always() && (needs.change-check.outputs.matrix == 'true' || github.ref == 'refs/heads/main' || needs.change-check.outputs.run_all == 'true')
394+
# !cancelled() makes it run even if a matrix-client-test shard fails, but still respects cancellation
395+
if: ${{ !cancelled() && (needs.change-check.outputs.matrix == 'true' || github.ref == 'refs/heads/main' || needs.change-check.outputs.run_all == 'true') }}
393396
runs-on: ubuntu-latest
397+
concurrency:
398+
group: matrix-client-merge-reports-${{ github.head_ref || github.run_id }}
399+
cancel-in-progress: true
394400

395401
permissions:
396402
id-token: write
@@ -585,16 +591,16 @@ jobs:
585591
env:
586592
TEST_MODULE: ${{matrix.testModule}}
587593
- name: Print realm server logs
588-
if: always()
594+
if: ${{ !cancelled() }}
589595
run: cat /tmp/server.log
590596
- name: Prepare artifact name
591597
id: artifact_name
592-
if: always()
598+
if: ${{ !cancelled() }}
593599
run: |
594600
export SAFE_ARTIFACT_NAME=$(echo ${{ matrix.testModule }} | sed 's/[/]/_/g')
595601
echo "artifact_name=$SAFE_ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
596602
- name: Extract worker and prerender logs
597-
if: always()
603+
if: ${{ !cancelled() }}
598604
run: |
599605
grep -E '^\[start:worker-development|^\[start:worker-test' /tmp/server.log > /tmp/worker-manager.log || true
600606
grep -E '^\[start:prerender-dev' /tmp/server.log > /tmp/prerender-server.log || true
@@ -603,42 +609,42 @@ jobs:
603609
grep -E '^\[start:test-realms|^\[start:worker-test' /tmp/server.log > /tmp/test-realms.log || true
604610
- name: Upload realm server log
605611
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
606-
if: always()
612+
if: ${{ !cancelled() }}
607613
with:
608614
name: realm-server-test-realm-server-log-${{steps.artifact_name.outputs.artifact_name}}
609615
path: /tmp/server.log
610616
retention-days: 30
611617
- name: Upload worker manager log
612618
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
613-
if: always()
619+
if: ${{ !cancelled() }}
614620
with:
615621
name: realm-server-test-worker-manager-log-${{steps.artifact_name.outputs.artifact_name}}
616622
path: /tmp/worker-manager.log
617623
retention-days: 30
618624
- name: Upload prerender server log
619625
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
620-
if: always()
626+
if: ${{ !cancelled() }}
621627
with:
622628
name: realm-server-test-prerender-server-log-${{steps.artifact_name.outputs.artifact_name}}
623629
path: /tmp/prerender-server.log
624630
retention-days: 30
625631
- name: Upload prerender manager log
626632
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
627-
if: always()
633+
if: ${{ !cancelled() }}
628634
with:
629635
name: realm-server-test-prerender-manager-log-${{steps.artifact_name.outputs.artifact_name}}
630636
path: /tmp/prerender-manager.log
631637
retention-days: 30
632638
- name: Upload start:development log
633639
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
634-
if: always()
640+
if: ${{ !cancelled() }}
635641
with:
636642
name: realm-server-test-start-development-log-${{steps.artifact_name.outputs.artifact_name}}
637643
path: /tmp/start-development.log
638644
retention-days: 30
639645
- name: Upload test-realms log
640646
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
641-
if: always()
647+
if: ${{ !cancelled() }}
642648
with:
643649
name: realm-server-test-test-realms-log-${{steps.artifact_name.outputs.artifact_name}}
644650
path: /tmp/test-realms.log
@@ -790,7 +796,7 @@ jobs:
790796
working-directory: packages/workspace-sync-cli
791797
- name: Upload test services log
792798
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
793-
if: always()
799+
if: ${{ !cancelled() }}
794800
with:
795801
name: workspace-sync-cli-test-services-log
796802
path: /tmp/test-services.log

.github/workflows/diff-skills.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ jobs:
1111
diff-skills:
1212
uses: cardstack/gh-actions/.github/workflows/diff-skills.yml@main
1313
secrets: inherit
14+
concurrency:
15+
group: diff-skills-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true

0 commit comments

Comments
 (0)