Skip to content

Commit 297e4e5

Browse files
committed
ci: more perf optimisations for merge queues
1 parent abe3bbe commit 297e4e5

1 file changed

Lines changed: 52 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ jobs:
6161
if: needs.changes.outputs.src == 'true'
6262
runs-on: ubuntu-24.04-arm
6363
timeout-minutes: 10
64+
permissions:
65+
actions: write
66+
contents: read
6467

6568
steps:
6669
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -89,6 +92,12 @@ jobs:
8992
name: dist
9093
path: packages/*/dist
9194

95+
- name: Cancel workflow on failure
96+
if: failure() && github.event_name == 'merge_group'
97+
run: gh run cancel ${{ github.run_id }} --repo ${{ github.repository }}
98+
env:
99+
GH_TOKEN: ${{ github.token }}
100+
92101
codeql:
93102
if: github.event_name != 'merge_group'
94103
runs-on: ubuntu-latest
@@ -131,6 +140,9 @@ jobs:
131140
if: github.event_name != 'push'
132141
runs-on: ${{ matrix.os }}
133142
timeout-minutes: 10
143+
permissions:
144+
actions: write
145+
contents: read
134146
needs:
135147
- build
136148
strategy:
@@ -139,6 +151,9 @@ jobs:
139151
os: [ubuntu-24.04-arm, windows-latest]
140152
module: ['bundler']
141153
# module: ["bundler", "node"]
154+
exclude:
155+
# only run ubuntu in merge queue
156+
- os: ${{ github.event_name == 'merge_group' && 'windows-latest' || '' }}
142157

143158
steps:
144159
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -165,12 +180,21 @@ jobs:
165180
- name: Typecheck (docs)
166181
run: pnpm typecheck:docs
167182

168-
lint:
183+
- name: Cancel workflow on failure
184+
if: failure() && github.event_name == 'merge_group'
185+
run: gh run cancel ${{ github.run_id }} --repo ${{ github.repository }}
186+
env:
187+
GH_TOKEN: ${{ github.token }}
188+
189+
lint-and-test:
169190
# autofix workflow will be triggered instead for PRs
170191
needs: changes
171192
if: github.event_name == 'merge_group' && needs.changes.outputs.src == 'true'
172193
runs-on: ubuntu-24.04-arm
173-
timeout-minutes: 10
194+
timeout-minutes: 15
195+
permissions:
196+
actions: write
197+
contents: read
174198

175199
steps:
176200
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -192,37 +216,25 @@ jobs:
192216
- name: Check built types
193217
run: pnpm test:attw
194218

195-
test-unit:
196-
# autofix workflow will be triggered instead for PRs
197-
needs: changes
198-
if: github.event_name == 'merge_group' && needs.changes.outputs.src == 'true'
199-
runs-on: ubuntu-24.04-arm
200-
timeout-minutes: 10
201-
202-
steps:
203-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
204-
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
205-
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
206-
with:
207-
node-version: lts/*
208-
cache: 'pnpm'
209-
210-
- name: Install dependencies
211-
run: pnpm install
212-
213-
- name: Build (stub)
214-
run: pnpm dev:prepare
215-
216219
- name: Test (nuxt runtime)
217220
run: pnpm test:runtime
218221

219222
- name: Test (unit)
220223
run: pnpm test:unit
221224

225+
- name: Cancel workflow on failure
226+
if: failure() && github.event_name == 'merge_group'
227+
run: gh run cancel ${{ github.run_id }} --repo ${{ github.repository }}
228+
env:
229+
GH_TOKEN: ${{ github.token }}
230+
222231
test-size:
223232
# already tested in merge queue
224233
if: github.event_name != 'push'
225234
runs-on: ubuntu-24.04-arm
235+
permissions:
236+
actions: write
237+
contents: read
226238
needs:
227239
- build
228240

@@ -246,6 +258,12 @@ jobs:
246258
- name: Check bundle size
247259
run: pnpm vitest run bundle
248260

261+
- name: Cancel workflow on failure
262+
if: failure() && github.event_name == 'merge_group'
263+
run: gh run cancel ${{ github.run_id }} --repo ${{ github.repository }}
264+
env:
265+
GH_TOKEN: ${{ github.token }}
266+
249267
test-benchmark:
250268
runs-on: ubuntu-latest
251269
if: github.event_name != 'merge_group'
@@ -283,6 +301,9 @@ jobs:
283301
# already tested in merge queue
284302
if: github.event_name != 'push'
285303
runs-on: ${{ matrix.os }}
304+
permissions:
305+
actions: write
306+
contents: read
286307
needs:
287308
- build
288309

@@ -358,6 +379,12 @@ jobs:
358379
with:
359380
token: ${{ secrets.CODECOV_TOKEN }}
360381

382+
- name: Cancel workflow on failure
383+
if: failure() && github.event_name == 'merge_group'
384+
run: gh run cancel ${{ github.run_id }} --repo ${{ github.repository }}
385+
env:
386+
GH_TOKEN: ${{ github.token }}
387+
361388
ci-ok:
362389
# This job is the single required check for merge queues and branch protection.
363390
# All other jobs feed into this one. Skipped jobs are treated as successful.
@@ -368,8 +395,7 @@ jobs:
368395
- build
369396
- codeql
370397
- typecheck
371-
- lint
372-
- test-unit
398+
- lint-and-test
373399
- test-size
374400
- test-fixtures
375401
steps:
@@ -381,8 +407,7 @@ jobs:
381407
"${{ needs.build.result }}" \
382408
"${{ needs.codeql.result }}" \
383409
"${{ needs.typecheck.result }}" \
384-
"${{ needs.lint.result }}" \
385-
"${{ needs.test-unit.result }}" \
410+
"${{ needs.lint-and-test.result }}" \
386411
"${{ needs.test-size.result }}" \
387412
"${{ needs.test-fixtures.result }}" \
388413
)

0 commit comments

Comments
 (0)