Skip to content

Commit 6802ccd

Browse files
committed
fix(ci): run the embedded CLI app with the same isolated lifecycle as the other HTTP end-to-end apps
1 parent 6304f50 commit 6802ccd

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

‎.github/workflows/test-build.yml‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ jobs:
206206
# immediately, and either way the server log tail lands in the job log. No
207207
# step timeout: the job's bound covers a hang without cutting a slow but
208208
# healthy suite short of writing its report.
209+
#
210+
# Every `next dev` app in this job shares apps/sim/.next, so each one follows the
211+
# same lifecycle. It starts from an empty Turbopack dev cache: a cache written under
212+
# other NEXT_PUBLIC_* values, by a server that `next dev` SIGKILLs 100ms after
213+
# SIGTERM, can panic Turbopack or wedge a route compile on restore. It runs in its
214+
# own session, and stop-session.sh returns only once all of it has exited, so no app
215+
# starts beside one still writing .next/dev.
209216
- name: Verify SCIM, administration and workflow comparisons over real HTTP
210217
working-directory: apps/sim
211218
env:
@@ -285,16 +292,21 @@ jobs:
285292
report_dir="$RUNNER_TEMP/e2e"
286293
server_log="$report_dir/cli-next.log"
287294
mkdir -p "$report_dir"
288-
node ../../node_modules/next/dist/bin/next dev --hostname 127.0.0.1 --port 3018 > "$server_log" 2>&1 &
295+
rm -rf .next/dev
296+
setsid node ../../node_modules/next/dist/bin/next dev --hostname 127.0.0.1 --port 3018 > "$server_log" 2>&1 &
289297
server_pid=$!
290298
finish() {
291-
kill "$server_pid" 2>/dev/null || true
299+
status=$?
300+
bash ../../.github/scripts/stop-session.sh "$server_pid" || status=1
292301
wait "$server_pid" 2>/dev/null || true
302+
if [ "$status" -ne 0 ]; then
303+
tail -n 200 "$server_log"
304+
exit "$status"
305+
fi
293306
}
294307
trap finish EXIT
295308
fail_startup() {
296309
echo "::error::$1"
297-
tail -n 200 "$server_log"
298310
exit 1
299311
}
300312
started=$SECONDS
@@ -315,12 +327,6 @@ jobs:
315327
# A self-hosted app: hosted billing admits a run only through a Redis usage
316328
# reservation, and the SCIM suite above asserts PostgreSQL rate-limit storage,
317329
# so workflow execution gets its own app rather than adding Redis to that one.
318-
#
319-
# The apps in this job share apps/sim/.next. Each starts from an empty Turbopack
320-
# dev cache: one written under other NEXT_PUBLIC_* values, by a server `next dev`
321-
# SIGKILLs 100ms after SIGTERM, can panic Turbopack or wedge a route compile on
322-
# restore. Each runs in its own session, and stop-session.sh returns only once
323-
# all of it has exited, so no app starts beside one still writing .next/dev.
324330
- name: Verify single-block workflow runs over real HTTP
325331
working-directory: apps/sim
326332
env:

0 commit comments

Comments
 (0)