Skip to content

Commit 2e9d074

Browse files
committed
fix(ci): mark a broken dev cache on every panic, not only at exit
1 parent ebdb3da commit 2e9d074

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎.github/workflows/checks.yml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ jobs:
469469
clear_cache() {
470470
find "$GITHUB_WORKSPACE/apps/sim/.next/dev" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
471471
}
472+
# A sticky disk keeps nothing from a failed job, so a clear here sticks only when the job
473+
# passes. The marker names the cache for desktop-live-cache-reset, which empties it after
474+
# a failed job; written on each panic, it survives the restart truncating the log.
475+
mark_cache_broken() {
476+
jq -r .version "$GITHUB_WORKSPACE/node_modules/next/package.json" > "$report_dir/turbopack-cache-broken"
477+
}
472478
# SIGINT first: `next dev` SIGKILLs its server 100ms after SIGTERM, which discards a cache
473479
# write in flight. stop-session.sh then removes anything still running.
474480
# SIGINT is best-effort; the cleanup always runs, since workers and the detached telemetry
@@ -488,12 +494,10 @@ jobs:
488494
stop_sim || status=1
489495
bash "$GITHUB_WORKSPACE/.github/scripts/stop-session.sh" "$realtime_pid" "$realtime_tag" || status=1
490496
wait "$server_pid" "$realtime_pid" 2>/dev/null || true
491-
# A sticky disk keeps nothing from a failed job, so this clear sticks only when the job
492-
# passes; the marker hands a failed job's cache to desktop-live-cache-reset.
493497
if cache_broken; then
494498
echo "::warning::Turbopack reported a broken dev cache; clearing it for the next run."
499+
mark_cache_broken
495500
clear_cache
496-
jq -r .version "$GITHUB_WORKSPACE/node_modules/next/package.json" > "$report_dir/turbopack-cache-broken"
497501
fi
498502
exit "$status"
499503
}
@@ -514,6 +518,7 @@ jobs:
514518
if [ "$retried" = 0 ] && cache_broken; then
515519
echo "::warning::Turbopack rejected the restored dev cache; restarting from an empty cache."
516520
bash "$GITHUB_WORKSPACE/.github/scripts/stop-session.sh" "$server_pid" "$server_tag"
521+
mark_cache_broken
517522
clear_cache
518523
: > "$next_log"
519524
retried=1

0 commit comments

Comments
 (0)