Skip to content

Commit bb74ef1

Browse files
committed
ci: add TEMPORARY windows-latest spawn check for #19 Verifies the Windows fix without AWS: reproduces the raw execFileSync('npx') ENOENT, then asserts the runSync/spawnCommand helper spawns the npx/npm shims on windows-latest. Triggered on the ci/win branch and via workflow_dispatch. Delete this workflow once #19 is verified/merged.
1 parent 41aa0c4 commit bb74ef1

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# ⚠️ TEMPORARY — delete before/after merging the fix for issue #19.
2+
#
3+
# Verifies the Windows fix for "Deployment failing in Windows" (#19), where
4+
# `npm run deploy` crashed with `spawnSync npx ENOENT`. The root cause is purely
5+
# how child processes are spawned (npm/npx are `.cmd` shims on Windows), which
6+
# happens BEFORE any AWS call — so this needs no AWS credentials or real deploy.
7+
#
8+
# Two checks:
9+
# 1. (informational) the original bug still reproduces with a raw
10+
# `execFileSync('npx', ...)` on the Windows runner.
11+
# 2. (gate) the shipped `runSync`/`spawnCommand` helper spawns the npx/npm
12+
# shims on Windows without ENOENT.
13+
name: TEMP Windows deploy check (#19)
14+
15+
on:
16+
workflow_dispatch:
17+
push:
18+
branches: ['ci/win']
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
windows-spawn-check:
25+
name: Windows npx/npm spawn (#19)
26+
runs-on: windows-latest
27+
timeout-minutes: 20
28+
steps:
29+
- uses: actions/checkout@v5
30+
31+
- uses: actions/setup-node@v5
32+
with:
33+
node-version-file: '.nvmrc'
34+
cache: npm
35+
36+
- name: Install dependencies
37+
run: npm ci
38+
39+
# Only the packages the verification imports — core and its hosting dep.
40+
- name: Build @aws-blocks/core
41+
shell: bash
42+
run: |
43+
npm run build --workspace=@aws-blocks/hosting
44+
npm run build --workspace=@aws-blocks/core
45+
46+
- name: Reproduce issue #19 (informational)
47+
shell: bash
48+
run: |
49+
cat > repro-19.mjs <<'EOF'
50+
import { execFileSync } from 'node:child_process';
51+
try {
52+
const out = execFileSync('npx', ['--version'], { encoding: 'utf-8' });
53+
console.log(`::warning::Could not reproduce #19 — raw execFileSync('npx') succeeded (${out.trim()})`);
54+
} catch (e) {
55+
if (e.code === 'ENOENT') {
56+
console.log("Reproduced #19: raw execFileSync('npx') threw ENOENT on Windows.");
57+
} else {
58+
console.log(`raw execFileSync('npx') failed with: ${e.code || e.message}`);
59+
}
60+
}
61+
EOF
62+
node repro-19.mjs
63+
64+
- name: Verify fix — runSync/spawnCommand spawn shims on Windows
65+
shell: bash
66+
run: |
67+
cat > verify-19.mjs <<'EOF'
68+
import { runSync, spawnCommand } from './packages/core/dist/scripts/run-command.js';
69+
console.log('platform:', process.platform);
70+
71+
// These are the exact shim invocations that broke deploy/sandbox/destroy.
72+
// A regression would throw ENOENT here and fail the job.
73+
runSync('npx', ['--version'], { stdio: 'inherit' });
74+
runSync('npm', ['--version'], { stdio: 'inherit' });
75+
76+
await new Promise((resolve, reject) => {
77+
const cp = spawnCommand('npm', ['--version'], { stdio: 'ignore' });
78+
cp.on('error', reject);
79+
cp.on('exit', (code) => (code === 0 ? resolve() : reject(new Error(`exit ${code}`))));
80+
});
81+
82+
console.log('OK: npx/npm shims spawned on Windows without ENOENT — #19 fixed.');
83+
EOF
84+
node verify-19.mjs

0 commit comments

Comments
 (0)