Skip to content

Commit f3043d1

Browse files
committed
fix: stabilize native release CI
1 parent 2a24ed1 commit f3043d1

3 files changed

Lines changed: 33 additions & 13 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ jobs:
2626
# the binary on first require. Parallel vitest workers racing that download
2727
# corrupt the extract on macOS (EEXIST on the Electron Framework symlink),
2828
# so do it once, serially, up front. Idempotent - exits early if present.
29-
- run: npm run install-electron
29+
- name: Install Electron binary
30+
shell: bash
31+
run: |
32+
for attempt in 1 2 3; do
33+
npm run install-electron && exit 0
34+
if [ "$attempt" -eq 3 ]; then exit 1; fi
35+
echo "Electron download failed (attempt $attempt/3); retrying in 10 seconds..."
36+
sleep 10
37+
done
3038
- run: npm run typecheck
3139
- run: npm test

‎.github/workflows/release.yml‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,29 @@ jobs:
4949
# corrupt the extract on macOS (EEXIST on the Electron Framework symlink),
5050
# so do it once, serially, up front. Idempotent - exits early if present.
5151
- name: Install Electron binary
52-
run: npm run install-electron
53-
54-
# package.json sets npmRebuild:false, so node-pty is NOT rebuilt for
55-
# Electron's ABI automatically. Without this the packaged app dies on
56-
# first terminal spawn.
57-
- name: Rebuild native modules for Electron
58-
run: npm run rebuild
52+
shell: bash
53+
run: |
54+
for attempt in 1 2 3; do
55+
npm run install-electron && exit 0
56+
if [ "$attempt" -eq 3 ]; then exit 1; fi
57+
echo "Electron download failed (attempt $attempt/3); retrying in 10 seconds..."
58+
sleep 10
59+
done
5960
6061
- name: Typecheck
6162
run: npm run typecheck
6263

64+
# Tests load node-pty under Node.js, so they must run before the native
65+
# addon is rebuilt for Electron's different ABI.
6366
- name: Test
6467
run: npm test
6568

69+
# package.json sets npmRebuild:false, so node-pty is NOT rebuilt for
70+
# Electron's ABI automatically. Rebuild only after Node-based tests pass;
71+
# otherwise macOS tests load the Electron-ABI addon and PTY output stalls.
72+
- name: Rebuild native modules for Electron
73+
run: npm run rebuild
74+
6675
# A tag like v0.2.0-nightly.1 must land as a GitHub *prerelease*, because
6776
# that is exactly what the app's nightly channel filters on
6877
# (autoUpdater.allowPrerelease). A stable tag must not be flagged.

‎src/main/remote-access-server.test.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,16 @@ describe('remote access server', () => {
9696
}
9797
})
9898
})
99-
// /bin/sh does not exist on Windows. node is the one interpreter guaranteed
100-
// to be present wherever this suite runs.
101-
// Keep the process alive briefly after the write completes. A zero-lived
102-
// process can exit before macOS's native PTY dispatches its final data event.
103-
const script = 'process.stdout.write("remote-pty-ok", () => setTimeout(() => process.exit(0), 50))'
99+
// /bin/sh does not exist on Windows. Node is the one interpreter guaranteed
100+
// to be present wherever this suite runs. Keep it alive until input arrives
101+
// so native PTY startup and immediate process exit cannot race on macOS.
102+
const script = 'process.stdin.once("data", () => process.stdout.write("remote-pty-ok"))'
104103
const create = await rpc('pty', 'pty.create', { paneId: 'web-test', cwd: root, shell: process.execPath, argv: ['-e', script] })
105104
expect(create.status).toBe(200)
105+
const createBody = await create.json() as { ok: boolean; result?: { ok?: boolean; error?: string } }
106+
expect(createBody).toMatchObject({ ok: true, result: { ok: true } })
107+
const write = await rpc('pty-write', 'pty.write', { paneId: 'web-test', data: 'go\n' })
108+
expect(write.status).toBe(200)
106109
await expect(output).resolves.toContain('remote-pty-ok')
107110
socket.close()
108111
})

0 commit comments

Comments
 (0)