Repository navigation
283 lines (269 loc) · 10.4 KB
/
Copy pathci.yml
File metadata and controls
283 lines (269 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: CI
on:
pull_request:
push:
branches: [main]
# Deny by default; every job opts in to exactly what it needs.
permissions: {}
env:
COREPACK_ENABLE_PROJECT_SPEC: "0"
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# why: `pnpm check` runs these one after another in ~5 min; split, the slowest part (one e2e
# shard) sets the wall time. Keep the steps below in step with `pnpm check`.
static:
name: Static checks
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# why: the comment lint diffs against origin/main.
fetch-depth: 0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Enable Corepack
run: |
corepack enable
corepack prepare pnpm@11.22.0+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Typecheck
run: pnpm run typecheck && pnpm run typecheck:e2e
- name: Lint
run: pnpm run lint && pnpm run lint:comments
- name: Format
run: pnpm run format:check
unit:
name: Unit tests
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Enable Corepack
run: |
corepack enable
corepack prepare pnpm@11.22.0+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Unit tests
run: pnpm run test:unit
timing:
name: Timing tests
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Enable Corepack
run: |
corepack enable
corepack prepare pnpm@11.22.0+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Timing tests
run: pnpm run test:timing
e2e:
name: E2E (${{ matrix.shard }}/3)
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 10
strategy:
# why: one red shard must not cancel the others, or their failures go unreported.
fail-fast: false
matrix:
shard: [1, 2, 3]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Enable Corepack
run: |
corepack enable
corepack prepare pnpm@11.22.0+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Build
run: pnpm run build && pnpm run build:e2e
- name: E2E tests
env:
SHARD: ${{ matrix.shard }}
run: pnpm exec vitest run --project e2e --tags-filter='!slow' --shard="$SHARD/3"
# why: branch protection requires the check named Quality, so this job stands for all of the
# above. `always()` makes it report a failure when a job it needs fails, where a job skipped
# by a failed need would count as passed.
quality:
name: Quality
needs: [static, unit, timing, e2e]
if: always()
runs-on: ubuntu-24.04
permissions: {}
timeout-minutes: 5
steps:
- name: Every job passed
env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
echo "results: $RESULTS"
for result in $RESULTS; do
case $result in
success | skipped) ;;
*) echo "a job Quality needs ended $result" >&2; exit 1 ;;
esac
done
# Decides whether the Console job has work to do. A workflow-level `paths` filter would leave
# the required Console check pending forever on a PR it skips; a job skipped by `if` reports
# success instead. Pushes to main always run the console lane.
changes:
name: Changes
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 5
outputs:
console: ${{ steps.filter.outputs.console }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# A pull_request run checks out the merge commit; its first parent is the base.
fetch-depth: 2
- name: Files the console lane depends on
id: filter
run: |
if [ "$GITHUB_EVENT_NAME" != pull_request ]; then
echo "console=true" >>"$GITHUB_OUTPUT"
echo "browsers=all" >>"$GITHUB_OUTPUT"
exit 0
fi
# The daemon and the CLI the console fixtures start reach almost all of src/, so any
# source file counts; so do the UI, the console specs, their helpers and the build
# config. Unit tests, docs, agent config and the other e2e files do not.
# --no-renames lists a moved file's old path too.
changed=$(git diff --name-only --no-renames HEAD^1 HEAD)
if printf '%s\n' "$changed" | grep -v -E '^(src|ui)/.*\.test\.tsx?$' | grep -q -E \
'^(src/|ui/|e2e/(console|fake-driver|helpers)/|playwright\.config\.ts$|package\.json$|pnpm-lock\.yaml$|pnpm-workspace\.yaml$|tsconfig[^/]*\.json$|\.github/workflows/ci\.yml$)'; then
echo "console=true" >>"$GITHUB_OUTPUT"
else
echo "console=false" >>"$GITHUB_OUTPUT"
fi
console-lane:
name: Console (${{ matrix.shard }}/4)
needs: changes
# Runs unless Changes said there is nothing to test, so a broken Changes job runs the lane.
if: ${{ !cancelled() && needs.changes.outputs.console != 'false' }}
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 15
strategy:
# why: one red shard must not cancel the others, or their failures go unreported.
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Enable Corepack
run: |
corepack enable
corepack prepare pnpm@11.22.0+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps chromium
- name: Browser lane
env:
SHARD: ${{ matrix.shard }}
run: pnpm test:console --project=chromium --shard="$SHARD/4"
# why: branch protection requires the check named Console, so this job stands for the sharded
# lane. `always()` makes it report a failure when a shard fails, where a job skipped by a failed
# need would count as passed; a lane skipped by Changes leaves it green.
console:
name: Console
needs: [changes, console-lane]
if: always()
runs-on: ubuntu-24.04
permissions: {}
timeout-minutes: 5
steps:
- name: Every job passed
env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
echo "results: $RESULTS"
for result in $RESULTS; do
case $result in
success | skipped) ;;
*) echo "a job Console needs ended $result" >&2; exit 1 ;;
esac
done
fallow:
name: Fallow
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Enable Corepack
run: |
corepack enable
corepack prepare pnpm@11.22.0+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Fallow analysis
run: pnpm fallow --ci
# why: checked on the PR's merge commit, so a PR whose bump main has already taken (two PRs
# moving 34 to 35) fails here although its own branch passes.
protocol-bump:
name: Protocol bump
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Contract shape and protocol range change together
env:
BASE_REF: ${{ github.base_ref }}
run: node .agents/scripts/protocol-bump-check.mjs --base "origin/$BASE_REF"