Repository navigation
334 lines (289 loc) · 11.8 KB
/
Copy pathtest.yml
File metadata and controls
334 lines (289 loc) · 11.8 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
name: test
on:
# Pull requests compile once: the typecheck, nothing more. The release build compiles
# again on every target. Core tests, the HttpApi gates, the engine suite and the Windows
# legs run only by hand (Actions -> test -> Run workflow), where `changes` always
# reports heavy=true and every job below runs.
workflow_dispatch:
# Pull requests only. A merge to `develop` or `main` is a pull request that already
# passed, so running again on push would repeat the same checks.
pull_request:
concurrency:
# One run per pull request; a new push cancels the stale run.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
checks: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
# Required checks on develop and main: `typecheck`, `core (linux)`, `httpapi (linux)`,
# `unit (linux)`. Keep those job names exactly. A job skipped by `if:` reports as passing,
# so a docs-only or version-only pull request satisfies them without running anything.
#
# The engine suite is sharded across JOBS rather than parallelised across workers inside
# one; see docs/TEST-PARALLELISM.md. It takes ~10 runner-minutes, so it is dispatch-only.
jobs:
changes:
name: changes
runs-on: ubuntu-latest
outputs:
heavy: ${{ steps.diff.outputs.heavy }}
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
# The pull request merge commit and its first parent (the base) are enough for a
# two-dot diff; no merge base lookup is needed.
fetch-depth: 2
- name: Docs-only or version-only?
id: diff
run: |
set -euo pipefail
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "heavy=true" >> "$GITHUB_OUTPUT"
exit 0
fi
heavy=false
while IFS= read -r f; do
[ -z "$f" ] && continue
case "$f" in
# Docs.
*.md|docs/*|LICENSE*|CHANGELOG*) continue ;;
# Whole-file version markers.
VERSION|REDROB_VERSION|UPSTREAM_VERSION|*-version.txt|*/VERSION) continue ;;
# Manifests and lockfiles: allowed only if every changed line is a version string.
package.json|*/package.json|bun.lock|Cargo.toml|*/Cargo.toml|Cargo.lock|*/Cargo.lock)
if git diff -U0 HEAD^1 HEAD -- "$f" \
| grep -E '^[+-]' | grep -vE '^(\+\+\+|---) ' \
| grep -vE '^[+-][[:space:]]*("version":[[:space:]]*"[^"]*",?|version[[:space:]]*=[[:space:]]*"[^"]*")[[:space:]]*$' >/dev/null; then
echo "non-version change in $f"
heavy=true
fi
;;
*)
echo "code change: $f"
heavy=true
;;
esac
done < <(git diff --name-only HEAD^1 HEAD)
echo "heavy=$heavy"
echo "heavy=$heavy" >> "$GITHUB_OUTPUT"
typecheck:
name: typecheck
needs: changes
if: needs.changes.outputs.heavy == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Bun
uses: ./.github/actions/setup-bun
- name: Run typecheck
# Bound turbo's fan-out. tsgo peaks at ~5.3 GB on packages/redrob and
# ~2.4 GB each on core and tui, so turbo's default concurrency of 10
# co-schedules them and the 16 GB ubuntu-latest runner OOM-kills the
# workers (exit 137 on client/protocol/tui/redrob). tsgo is already
# internally parallel across the 4 vCPUs, so 2 tasks at a time costs no
# wall time: all 30 packages finish in ~43s at either 2 or 3, and 2
# keeps combined tsgo RSS near 6 GB.
run: bun turbo typecheck --concurrency=2
# Dispatch only. Required check: skipped on a pull request, which counts as passing.
core:
name: core (linux)
needs: changes
if: needs.changes.outputs.heavy == 'true' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
- name: Setup Bun
uses: ./.github/actions/setup-bun
- name: Provision ripgrep
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq ripgrep
rg --version | head -1
- name: Configure git identity
run: |
git config --global user.email "44862514+savagemanage@users.noreply.github.com"
git config --global user.name "redrob"
# Not sharded: 933 tests in ~22s.
- name: Run core tests
working-directory: packages/core
run: bun test --timeout 30000 --only-failures
- name: Check generated client
working-directory: packages/client
run: bun run check:generated
# The JSON Schemas the Console serves (config.json, tui.json, theme.json) are committed under
# packages/redrob/schema and regenerated from the live Effect schemas; a stale copy fails here.
- name: Check generated schemas
working-directory: packages/redrob
run: bun run check:generated
# Dispatch only. Required check: skipped on a pull request, which counts as passing.
httpapi:
name: httpapi (linux)
needs: changes
if: needs.changes.outputs.heavy == 'true' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
- name: Setup Bun
uses: ./.github/actions/setup-bun
- name: Provision ripgrep
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq ripgrep
rg --version | head -1
- name: Configure git identity
run: |
git config --global user.email "44862514+savagemanage@users.noreply.github.com"
git config --global user.name "redrob"
- name: Run HttpApi exerciser gates
working-directory: packages/redrob
run: bun run test:httpapi
# Dispatch only: ~10 runner-minutes across four shards.
engine:
name: engine (linux ${{ matrix.shard }}/4)
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
# Every shard reports. Cancelling siblings on the first failure hides how much else
# is broken, which is the thing you want to know from a red run.
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
- name: Setup Bun
uses: ./.github/actions/setup-bun
# The ripgrep tests resolve `rg` from PATH, then a cache dir, and only then download
# it from github.com. Relying on that download made tests hang to the harness timeout
# with nothing in the log naming the cause, so it is provisioned up front.
- name: Provision ripgrep
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq ripgrep
rg --version | head -1
- name: Configure git identity
run: |
git config --global user.email "44862514+savagemanage@users.noreply.github.com"
git config --global user.name "redrob"
- name: Run engine tests
run: ./scripts/test-shard.sh packages/redrob ${{ matrix.shard }} 4
env:
REDROB_EXPERIMENTAL_DISABLE_FILEWATCHER: "false"
# `unit (linux)` is an aggregator that does no work. It exists so the required status check
# keeps a stable name while the jobs underneath it change shape.
unit:
name: unit (linux)
needs: [changes, typecheck, core, httpapi, engine]
# `always()` so a failing dependency still reports here rather than leaving the required
# check permanently "expected". Skipped dependencies (docs/version-only pull requests, and
# the dispatch-only engine shards on a pull request) count as passing.
if: always()
runs-on: ubuntu-latest
steps:
- name: Report
run: |
set -euo pipefail
printf 'changes %s\ntypecheck %s\ncore %s\nhttpapi %s\nengine %s\n' \
"${{ needs.changes.result }}" "${{ needs.typecheck.result }}" "${{ needs.core.result }}" \
"${{ needs.httpapi.result }}" "${{ needs.engine.result }}"
for result in "${{ needs.changes.result }}" "${{ needs.typecheck.result }}" "${{ needs.core.result }}" \
"${{ needs.httpapi.result }}" "${{ needs.engine.result }}"; do
case "$result" in
success|skipped) ;;
*) echo "::error::a linux test job did not succeed"; exit 1 ;;
esac
done
echo "all linux test jobs succeeded or were skipped"
# Dispatch only, advisory. The engine suite takes ~15 minutes across four Windows shards.
windows:
name: unit (windows ${{ matrix.shard }}/4)
if: github.event_name == 'workflow_dispatch'
runs-on: windows-latest
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
continue-on-error: true
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
- name: Setup Bun
uses: ./.github/actions/setup-bun
- name: Provision ripgrep
run: |
choco install ripgrep -y --no-progress
rg --version | head -1
- name: Configure git identity
run: |
git config --global user.email "44862514+savagemanage@users.noreply.github.com"
git config --global user.name "redrob"
- name: Run engine tests
run: ./scripts/test-shard.sh packages/redrob ${{ matrix.shard }} 4
env:
REDROB_EXPERIMENTAL_DISABLE_FILEWATCHER: "true"
windows-core:
name: unit (windows core)
if: github.event_name == 'workflow_dispatch'
runs-on: windows-latest
timeout-minutes: 25
continue-on-error: true
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
- name: Setup Bun
uses: ./.github/actions/setup-bun
- name: Provision ripgrep
run: |
choco install ripgrep -y --no-progress
rg --version | head -1
- name: Configure git identity
run: |
git config --global user.email "44862514+savagemanage@users.noreply.github.com"
git config --global user.name "redrob"
- name: Run core tests
working-directory: packages/core
run: bun test --timeout 30000 --only-failures
env:
REDROB_EXPERIMENTAL_DISABLE_FILEWATCHER: "true"