Repository navigation
313 lines (276 loc) · 13 KB
/
Copy pathci-test.yml
File metadata and controls
313 lines (276 loc) · 13 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
# ============================================================================
# 🧪 CI · Test
# ----------------------------------------------------------------------------
# Purpose : Run unit + Playwright e2e tests across Linux & Windows
# Trigger : Push to `main`, PRs targeting `main`, manual dispatch
# Jobs : unit — `bun turbo test` + config_assistant Go tests on linux
# only (windows dropped — see
# unit-tests matrix comment; free windows-latest runners
# can't fit the suite in a reasonable CI budget)
# e2e — Playwright chromium on linux + windows (matrix)
# Gate : The full unit, HttpAPI, generated-code and Linux/Windows E2E
# suite runs on every PR targeting `main` before merge, and on
# every push to `main`. Required status checks retain their names.
# Notes : `cancel-in-progress: false` — every main push gets a full run
# No trigger on feat/* or fix/* (frequent changes).
# Runners : All events use GitHub-hosted Ubuntu and Windows runners.
# ============================================================================
name: 🧪 CI · Test
on:
push:
branches:
- main
pull_request:
# Re-run checks when a draft becomes ready for review.
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ format('{0}-{1}', github.workflow, github.run_id) }}
cancel-in-progress: false
permissions:
contents: read
actions: read
checks: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
GOTOOLCHAIN: local
jobs:
unit-tests:
name: Unit Tests (${{ matrix.settings.name }})
strategy:
fail-fast: false
matrix:
settings:
- name: linux
host: ubuntu-latest
# windows dropped: this fork runs on free windows-latest runners
# (not the paid Blacksmith 4vCPU hosts upstream uses), and the
# opencode:test suite (3048 tests, many spawning real CLI
# subprocesses) doesn't fit the standard runner's slower
# process-spawn/IO within a reasonable CI budget. E2E Tests
# (windows) is unaffected and still covers the platform.
runs-on: ${{ matrix.settings.host }}
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup GitHub CLI
uses: ./.github/actions/setup-gh
- name: Check previously verified content
id: evidence
uses: ./.github/actions/verified-content
with:
check: unit
job-name: Unit Tests (${{ matrix.settings.name }})
runner-label: ${{ matrix.settings.host }}
- name: Setup Go
if: steps.evidence.outputs.reused != 'true' && (runner.os == 'Linux')
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: config_assistant/go.mod
cache-dependency-path: config_assistant/go.sum
- name: Setup Bun
if: steps.evidence.outputs.reused != 'true'
uses: ./.github/actions/setup-bun
with:
# ci-typecheck.yml's Linux job is the designated Linux cache
# saver (runs on every push, fast, low collision risk) — this job
# only restores, to avoid racing on the same {OS}-bun-{hash} key.
save-cache: false
- name: Verify Go toolchain
if: steps.evidence.outputs.reused != 'true' && runner.os == 'Linux'
run: node script/toolchain.mjs check --go
- name: Configure Git Identity
if: steps.evidence.outputs.reused != 'true'
run: |
git config --global user.email "bot@opencode.ai"
git config --global user.name "opencode"
- name: Ensure ripgrep prerequisite
if: steps.evidence.outputs.reused != 'true'
# tool.glob tests hit ripgrep; without the system binary, binary.ts
# downloads rg from GitHub releases every run (temp XDG per preload),
# gambling on network stability — ECONNRESET fails the test.
run: |
if command -v rg >/dev/null 2>&1; then
exit 0
fi
sudo apt-get update && sudo apt-get install -y ripgrep
- name: Cache Turbo
if: steps.evidence.outputs.reused != 'true'
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: node_modules/.cache/turbo
key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-${{ github.sha }}
restore-keys: |
turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-
turbo-${{ runner.os }}-
- name: Run context-folding lifecycle preflight
if: steps.evidence.outputs.reused != 'true' && (runner.os == 'Linux')
working-directory: packages/opencode
timeout-minutes: 3
run: |
bun test --timeout 30000 --only-failures test/session/prompt.test.ts \
--test-name-pattern '^(runs builtin read/grep/glob settlement through stored history into the next (AI SDK|Native) request|automatically compacts (AI SDK|Native) folded history at the token threshold|recovers (AI SDK|Native) overflow through an unprojected summary and a continued turn|terminates (AI SDK|Native) overflow when the full compaction request is also rejected)$'
- name: Run unit tests
if: steps.evidence.outputs.reused != 'true'
# opencode:test alone (244 files / 3048 tests, many spawning real CLI
# subprocesses via cliIt) measured at 803s / 13m24s locally, and this
# job has been seen at 16-17m in CI. turbo buffers a concurrent
# task's output until it completes, so the step is silent the whole
# time it runs — that silence can look like a hang but isn't one.
# 20m was never sized against real data; give it margin above the
# measured baseline instead of racing it.
# Hosted runners execute workspace tasks one at a time. This avoids
# CPU contention between builds and tests timing out 250ms Node workers.
timeout-minutes: 35
run: GITHUB_ACTIONS=false bun turbo test --concurrency=1
env:
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
- name: Run config assistant tests
if: steps.evidence.outputs.reused != 'true' && (runner.os == 'Linux')
working-directory: config_assistant
run: go test ./...
- name: Run VS Code connection tests
if: steps.evidence.outputs.reused != 'true' && runner.os == 'Linux'
working-directory: sdks/vscode
timeout-minutes: 5
run: |
bun install --frozen-lockfile
bun run test:unit
- name: Check generated client
if: steps.evidence.outputs.reused != 'true' && (runner.os == 'Linux')
working-directory: packages/client
run: bun run check:generated
- name: Check generated SDK
if: steps.evidence.outputs.reused != 'true' && (runner.os == 'Linux')
working-directory: packages/sdk/js
run: bun run check:generated
- name: Run HttpAPI Exerciser Gates
if: steps.evidence.outputs.reused != 'true' && (runner.os == 'Linux')
working-directory: packages/opencode
# The exerciser aggregates its report and prints it in one flush, so
# this step is silent while it runs. A latent uninterruptible hang
# (bare Effect.promise in scenario call/cleanup paths that the 30s
# scenario timeout cannot interrupt) froze the effect mode twice on
# 2026-07-27 — with no step timeout that occupies the runner for the
# default 6h. The full gate baseline is ~6m in CI, so 15m is generous;
# test:httpapi:ci adds --progress/--trace to effect mode so the log
# names the exact scenario and phase if it ever hangs again.
# 2026-08-05: a native-level freeze survived every in-process guard
# (timers die with the event loop) and burned the full 15m silently.
# --progress now also arms an out-of-process watchdog that SIGKILLs
# the runner after 120s without progress, naming the last scenario/
# phase — the step timeout stays as the final backstop.
timeout-minutes: 15
run: bun run test:httpapi:ci
- name: Record successful verification
if: success() && steps.evidence.outputs.reused != 'true'
uses: ./.github/actions/record-verification
with:
key: ${{ steps.evidence.outputs.key }}
path: ${{ steps.evidence.outputs.path }}
job-name: Unit Tests (${{ matrix.settings.name }})
e2e-tests:
name: E2E Tests (${{ matrix.settings.name }})
strategy:
fail-fast: false
matrix:
settings:
- name: linux
host: ubuntu-latest
- name: windows
host: windows-latest
runs-on: ${{ matrix.settings.host }}
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
# Browser installation below checks extraction on the shared Node pin.
uses: ./.github/actions/setup-node
- name: Setup GitHub CLI
uses: ./.github/actions/setup-gh
- name: Check previously verified content
id: evidence
uses: ./.github/actions/verified-content
with:
check: e2e
job-name: E2E Tests (${{ matrix.settings.name }})
runner-label: ${{ matrix.settings.host }}
- name: Setup Bun
if: steps.evidence.outputs.reused != 'true'
uses: ./.github/actions/setup-bun
with:
# Windows cache archiving can stall before DAG and Playwright tests.
# Linux unit tests remain the single Linux cache saver.
save-cache: false
- name: Read Playwright version
if: steps.evidence.outputs.reused != 'true'
id: playwright-version
run: |
version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
if: steps.evidence.outputs.reused != 'true'
id: playwright-cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ github.workspace }}/.playwright-browsers
key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
- name: Install Playwright system dependencies
if: steps.evidence.outputs.reused != 'true' && (runner.os == 'Linux')
working-directory: packages/app
run: bunx playwright install-deps chromium
- name: Install Playwright browsers
if: steps.evidence.outputs.reused != 'true' && (steps.playwright-cache.outputs.cache-hit != 'true')
working-directory: packages/app
run: bunx playwright install chromium
- name: Verify DAG artifact storage on Windows
if: steps.evidence.outputs.reused != 'true' && runner.os == 'Windows'
working-directory: packages/opencode
run: bun test --timeout 30000 --only-failures test/dag/dag-output-ref.test.ts test/dag/dag-output-ref-result.test.ts test/dag/dag-input-mapping-runtime.test.ts test/dag/dag-artifact-permissions.test.ts
timeout-minutes: 5
- name: Verify shared Markdown in Chromium
if: steps.evidence.outputs.reused != 'true'
working-directory: packages/web
run: bun test test/sanitize-markdown.test.ts --timeout 30000 --only-failures
env:
OPENCODE_TEST_BROWSER: "1"
timeout-minutes: 3
- name: Run app e2e tests
if: steps.evidence.outputs.reused != 'true'
run: bun --cwd packages/app test:e2e:local
env:
CI: true
timeout-minutes: 30
- name: Upload Playwright artifacts
if: steps.evidence.outputs.reused != 'true' && (always())
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
if-no-files-found: ignore
retention-days: 7
path: |
packages/app/e2e/test-results
packages/app/e2e/playwright-report
- name: Record successful verification
if: success() && steps.evidence.outputs.reused != 'true'
uses: ./.github/actions/record-verification
with:
key: ${{ steps.evidence.outputs.key }}
path: ${{ steps.evidence.outputs.path }}
job-name: E2E Tests (${{ matrix.settings.name }})