diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a8f1fc3..eb80133 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -44,3 +44,9 @@ jobs: - name: Build run: npm run build + + - name: Pack and verify the release like a session + timeout-minutes: 5 + run: | + npm run pack + npm run verify:release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3da1a5..b648e52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,6 +56,7 @@ jobs: npm run pack - name: Verify the release like a session + timeout-minutes: 5 run: npm run verify:release - name: Publish pre-release v${{ github.run_number }} diff --git a/AGENTS.md b/AGENTS.md index 928dcc2..52e30ca 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -52,7 +52,7 @@ Server routes: ## Testing Guidelines -- CI checks in `.github/workflows/pr.yml`: `lint`, `build:packages`, `typecheck`, `test`, `build`. +- CI checks in `.github/workflows/pr.yml`: `lint`, `build:packages`, `typecheck`, `test`, `build`, `pack` + `verify:release`. - `.github/workflows/release.yml` publishes every merge to `main` as pre-release `vN` and moves the `prerelease` channel; promote a tested build to `latest` by hand. - `.codesignal/` mirrors the session scripts of the CodeSignal base task; it is not run from the repository. - Every workspace with logic uses Vitest (`npm --workspace run test`). The engine and server suites use a stub LLM; the server's SDK suite runs the real Agents SDK against a scripted model, so no API key is needed. diff --git a/scripts/verify-release.mjs b/scripts/verify-release.mjs index 28058f7..5486ba2 100644 --- a/scripts/verify-release.mjs +++ b/scripts/verify-release.mjs @@ -64,7 +64,8 @@ try { const env = { ...process.env, PORT: String(PORT), PROJECT_ROOT: dir }; delete env.OPENAI_API_KEY; delete env.ANTHROPIC_API_KEY; - server = spawn('npm', ['run', 'start:prod'], { cwd: dir, env, stdio: ['ignore', 'pipe', 'pipe'] }); + // Its own process group, so stopping it also stops the node process npm starts. + server = spawn('npm', ['run', 'start:prod'], { cwd: dir, env, stdio: ['ignore', 'pipe', 'pipe'], detached: true }); server.stdout.on('data', (chunk) => (output += chunk)); server.stderr.on('data', (chunk) => (output += chunk)); await waitForServer(server); @@ -96,6 +97,14 @@ try { if (output) console.error(`Server output:\n${output}`); process.exitCode = 1; } finally { - server?.kill(); + if (server?.pid) { + try { + process.kill(-server.pid, 'SIGTERM'); + } catch { + // already stopped + } + } + server?.stdout.destroy(); + server?.stderr.destroy(); fs.rmSync(dir, { recursive: true, force: true }); }