Repository navigation
353 lines (341 loc) · 14.5 KB
/
Copy pathci.yml
File metadata and controls
353 lines (341 loc) · 14.5 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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
# Keep download caches outside the checkout and still install from the lockfile.
env:
CI_APT_CACHE_DIR: /tmp/openpi-apt-download-cache
jobs:
test-node:
name: Runtime Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
node-version: [22.19.0, 24, 26]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: ${{ matrix.node-version }}
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Install dependencies
env:
BUN_INSTALL_CACHE_DIR: ${{ runner.temp }}/bun-install-cache
run: bun install --frozen-lockfile
- run: bun run check
- name: Verify committed Web build
run: |
changes="$(git status --porcelain=v1 --untracked-files=all -- web/dist)"
if [[ -n "$changes" ]]; then
printf '%s\n' "$changes"
echo "web/dist is missing or stale; run bun run build:web and commit the result"
exit 1
fi
- run: bun run test node
- name: Smoke-test Pi package discovery
run: |
agent_dir="$(mktemp -d)"
trap 'rm -rf "$agent_dir"' EXIT
PI_CODING_AGENT_DIR="$agent_dir" ./node_modules/.bin/pi install "$PWD"
output="$(PI_CODING_AGENT_DIR="$agent_dir" ./node_modules/.bin/pi --offline --no-session --mode rpc </dev/null)"
grep -q '"statusKey":"plan-mode"' <<<"$output"
- name: Smoke-test packed extensions without optional peers
run: |
root="$(mktemp -d)"
trap 'rm -rf "$root"' EXIT
mkdir "$root/app" "$root/agent"
printf '{"private":true}\n' >"$root/app/package.json"
npm pack --ignore-scripts --silent --pack-destination "$root" >/dev/null
tarballs=("$root"/*.tgz)
test "${#tarballs[@]}" -eq 1
npm install --prefix "$root/app" --ignore-scripts --legacy-peer-deps --no-audit --no-fund "${tarballs[0]}"
test ! -e "$root/app/node_modules/ioredis"
package="$root/app/node_modules/@tt-a1i/openpi"
PI_CODING_AGENT_DIR="$root/agent" ./node_modules/.bin/pi \
--offline \
--mode rpc \
--no-extensions \
--extension "$package/extensions/git-read/index.ts" \
--extension "$package/extensions/git-info/index.ts" \
--extension "$package/extensions/ai-providers/index.ts" \
</dev/null
- name: Smoke-test managed Web CLI with a separate locked Pi host
run: |
root="$(mktemp -d)"
server_pid=""
cleanup() {
if [[ -n "$server_pid" ]] && kill -0 "$server_pid" 2>/dev/null; then
kill -TERM "$server_pid"
wait "$server_pid"
fi
rm -rf "$root"
}
trap cleanup EXIT
mkdir "$root/app" "$root/workspace" "$root/agent"
printf '{"private":true}\n' >"$root/app/package.json"
npm pack --ignore-scripts --silent --pack-destination "$root" >/dev/null
tarballs=("$root"/*.tgz)
test "${#tarballs[@]}" -eq 1
npm install --prefix "$root/app" --ignore-scripts --legacy-peer-deps --no-audit --no-fund "${tarballs[0]}"
test ! -e "$root/app/node_modules/@earendil-works/pi-ai"
test ! -e "$root/app/node_modules/@earendil-works/pi-coding-agent"
test ! -e "$root/app/node_modules/@earendil-works/pi-server"
PI_CODING_AGENT_DIR="$root/agent" \
OPENPI_PI_CODING_AGENT_ENTRY="$PWD/node_modules/@earendil-works/pi-coding-agent/dist/index.js" \
OPENPI_WEB_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
"$root/app/node_modules/.bin/openpi" web "$root/workspace" --port 0 --no-open \
>"$root/host.log" 2>&1 &
server_pid=$!
for _ in {1..100}; do
grep -q '^OpenPI Web Workbench is running at ' "$root/host.log" && break
kill -0 "$server_pid"
sleep 0.1
done
origin="$(sed -n 's/^OpenPI Web Workbench is running at //p' "$root/host.log" | tail -n 1)"
test -n "$origin"
curl --fail --silent --show-error --output "$root/index.html" "$origin/"
grep -q '<div id="root"></div>' "$root/index.html"
grep -Eq '<script type="module"[^>]*src="/app\.js"' "$root/index.html"
grep -Eq '<link rel="stylesheet"[^>]*href="/styles\.css"' "$root/index.html"
grep -q 'href="/favicon.svg"' "$root/index.html"
if grep -Eq '(src|href)="https?://' "$root/index.html"; then
echo "packed Web entrypoint references a remote asset"
exit 1
fi
curl --fail --silent --show-error --output "$root/app.js" "$origin/app.js"
curl --fail --silent --show-error --output "$root/styles.css" "$origin/styles.css"
curl --fail --silent --show-error --output "$root/favicon.svg" "$origin/favicon.svg"
test -s "$root/app.js"
test -s "$root/styles.css"
test -s "$root/favicon.svg"
kill -TERM "$server_pid"
wait "$server_pid"
server_pid=""
- name: Smoke-test committed Git Web source
if: matrix.node-version == '22.19.0'
run: |
root="$(mktemp -d)"
server_pid=""
cleanup() {
if [[ -n "$server_pid" ]] && kill -0 "$server_pid" 2>/dev/null; then
kill -TERM "$server_pid"
wait "$server_pid"
fi
rm -rf "$root"
}
trap cleanup EXIT
mkdir "$root/source" "$root/workspace"
git archive HEAD | tar -x -C "$root/source"
test -s "$root/source/web/dist/index.html"
test -s "$root/source/web/dist/app.js"
test -s "$root/source/web/dist/styles.css"
test -s "$root/source/web/dist/favicon.svg"
npm install --prefix "$root/source" --ignore-scripts --omit=dev --no-audit --no-fund
test ! -e "$root/source/node_modules/@earendil-works/pi-coding-agent"
# Exercise the CLI with the lockfile's Pi host, not package-owned peers.
mkdir -p "$root/source/node_modules/@earendil-works"
ln -s "$PWD/node_modules/@earendil-works/pi-coding-agent" \
"$root/source/node_modules/@earendil-works/pi-coding-agent"
OPENPI_WEB_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
node "$root/source/bin/openpi.js" web "$root/workspace" --port 0 --no-open \
>"$root/host.log" 2>&1 &
server_pid=$!
for _ in {1..100}; do
grep -q '^OpenPI Web Workbench is running at ' "$root/host.log" && break
kill -0 "$server_pid"
sleep 0.1
done
origin="$(sed -n 's/^OpenPI Web Workbench is running at //p' "$root/host.log" | tail -n 1)"
test -n "$origin"
curl --fail --silent --show-error --output "$root/source-index.html" "$origin/"
grep -q '<div id="root"></div>' "$root/source-index.html"
kill -TERM "$server_pid"
wait "$server_pid"
server_pid=""
web-e2e-shards:
name: Web E2E shard ${{ matrix.shard }}/2
strategy:
fail-fast: false
matrix:
shard: [1, 2]
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22.19.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Install dependencies
env:
BUN_INSTALL_CACHE_DIR: ${{ runner.temp }}/bun-install-cache
run: bun install --frozen-lockfile
- name: Cache Playwright browsers
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('bun.lock') }}
- name: Prepare system dependency download cache
run: |
mkdir -p "$CI_APT_CACHE_DIR"
sudo tee /etc/apt/apt.conf.d/99-openpi-ci-cache >/dev/null <<EOF
Dir::Cache::archives "$CI_APT_CACHE_DIR";
APT::Keep-Downloaded-Packages "true";
Binary::apt-get::APT::Keep-Downloaded-Packages "true";
Acquire::Retries "2";
Acquire::http::Timeout "30";
Acquire::https::Timeout "30";
EOF
- name: Cache Chromium system package downloads
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ env.CI_APT_CACHE_DIR }}/*.deb
key: apt-${{ runner.os }}-${{ runner.arch }}-ubuntu24-${{ hashFiles('bun.lock') }}
restore-keys: apt-${{ runner.os }}-${{ runner.arch }}-ubuntu24-
- name: Install Chromium and D-Bus
timeout-minutes: 10
run: |
bunx playwright install --with-deps chromium
sudo apt-get install --no-install-recommends -y dbus-daemon
# Independent runners isolate each shard's server, settings and filesystem.
- run: dbus-run-session -- bun run test:web:e2e --shard=${{ matrix.shard }}/2
env:
# The runner's installed Chrome has Ubuntu's native sandbox profile.
OPENPI_CHROME_PATH: /opt/google/chrome/chrome
- name: Test Plan Ready provider handoff
if: matrix.shard == 1
run: bunx playwright test --config tests/web/playwright.plan-provider.config.ts
- name: Upload Playwright failure artifacts
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: openpi-web-playwright-results-${{ matrix.shard }}
path: |
/tmp/openpi-web-playwright-results
/tmp/openpi-web-plan-provider-playwright-results
if-no-files-found: ignore
retention-days: 7
windows-node:
name: Runtime Node (Windows ${{ matrix.group }})
runs-on: windows-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- group: parallel 1/2
arguments: node-parallel --shard=1/2
- group: parallel 2/2
arguments: node-parallel --shard=2/2
- group: isolated processes
arguments: node-serial
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22.19.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Cache Bun downloads
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ runner.temp }}/bun-install-cache
key: bun-${{ runner.os }}-${{ runner.arch }}-1.3.14-${{ hashFiles('bun.lock') }}
restore-keys: bun-${{ runner.os }}-${{ runner.arch }}-1.3.14-
- name: Install dependencies
env:
BUN_INSTALL_CACHE_DIR: ${{ runner.temp }}/bun-install-cache
run: bun install --frozen-lockfile
- name: Test Windows Node suite with process isolation
# Process tests stay serial inside their own VM; ordinary files are
# split into disjoint shards on separate VMs, with every shard required.
timeout-minutes: 10
run: bun run test ${{ matrix.arguments }}
test-ui:
name: UI ${{ matrix.os }} Node ${{ matrix.node-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [22.19.0, 24, 26]
include:
- os: windows-latest
node-version: 22.19.0
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: ${{ matrix.node-version }}
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Cache Bun downloads
if: runner.os == 'Windows'
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ runner.temp }}/bun-install-cache
key: bun-${{ runner.os }}-${{ runner.arch }}-1.3.14-${{ hashFiles('bun.lock') }}
restore-keys: bun-${{ runner.os }}-${{ runner.arch }}-1.3.14-
- name: Install dependencies
env:
BUN_INSTALL_CACHE_DIR: ${{ runner.temp }}/bun-install-cache
run: bun install --frozen-lockfile
- run: bun run test ui
# Keep existing check names for branch protection. always() makes skipped,
# cancelled and failed dependencies fail the gates rather than bypass them.
test:
name: Node ${{ matrix.node-version }}
if: always()
needs: [test-node, test-ui, windows-node, web-e2e-shards]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.19.0, 24, 26]
steps:
- name: Require all test jobs
env:
NODE_RESULT: ${{ needs.test-node.result }}
UI_RESULT: ${{ needs.test-ui.result }}
WINDOWS_RESULT: ${{ needs.windows-node.result }}
E2E_RESULT: ${{ needs.web-e2e-shards.result }}
run: |
test "$NODE_RESULT" = success
test "$UI_RESULT" = success
test "$WINDOWS_RESULT" = success
test "$E2E_RESULT" = success
windows-background-terminals:
name: Background terminals (Windows)
if: always()
needs: [windows-node, test-ui]
runs-on: ubuntu-latest
steps:
- name: Require Windows runtime and UI tests
env:
NODE_RESULT: ${{ needs.windows-node.result }}
UI_RESULT: ${{ needs.test-ui.result }}
run: test "$NODE_RESULT" = success && test "$UI_RESULT" = success
web-e2e:
name: Web E2E (Node 22.19.0)
if: always()
needs: [web-e2e-shards]
runs-on: ubuntu-latest
steps:
- name: Require every E2E shard and provider handoff
env:
E2E_RESULT: ${{ needs.web-e2e-shards.result }}
run: test "$E2E_RESULT" = success