From b5f4df16bbf2d392325da4c09477da45f0f662d3 Mon Sep 17 00:00:00 2001 From: wyuc Date: Tue, 27 Oct 2026 20:11:36 +0800 Subject: [PATCH] ci(e2e): stop building from an older commit's Next.js cache, and fail a stall by name (#2051) The E2E job restored .next/cache keyed only on the lockfile and next.config.ts, so builds reused a cache saved before newer CSS landed and the new mobile specs failed; the 80-test reporter cadence made it look like a hang until the job timeout. Drop the cache restore; in CI report every test, set an explicit 30 s per-test timeout and a 9-minute global timeout. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 16 ++++++---------- playwright.config.ts | 13 ++++++++++++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca35f4232..43aa78500 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -376,16 +376,12 @@ jobs: fi done - # Incremental compilation artifacts only. Keyed on the lockfile plus - # next.config.ts so a dependency or webpack-rule change misses; source - # edits still reuse the restore-key prefix. - - name: Cache Next.js build - uses: actions/cache@v6 - with: - path: .next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('next.config.ts') }} - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}- + # No `.next/cache` restore: the build starts cold. The cache was keyed on + # the lockfile and next.config.ts only, so every run restored the + # Turbopack cache of an older commit, and builds from it shipped a stale + # app/globals.css (without the `--safe-area-*` variables the phone + # layout reads) while the rest of the CSS was current. The phone e2e + # specs then failed on every attempt and ran the job out of time. # Dedicated so a cold `next build` is not charged against Playwright's # webServer readiness budget (120s). NEXT_PUBLIC_MAIC_EDITOR_ENABLED is a diff --git a/playwright.config.ts b/playwright.config.ts index 68a0b7c7d..1893fa220 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -8,7 +8,18 @@ export default defineConfig({ // CI builds the production bundle in a dedicated workflow step, so this // process only drives Chromium. Two workers fit a 4-core runner. workers: process.env.CI ? 2 : undefined, - reporter: process.env.CI ? 'html' : 'list', + // CI names every test as it finishes (`list`): with `html` alone the run + // printed one unflushed line of dots, so a stall said nothing about which + // test it was. + reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list', + // Every test, its hooks and fixtures included, gets 30 s (Playwright's + // default, stated so a spec that raises it does so explicitly). + timeout: 30_000, + // The whole run stops inside the job's 15-minute budget (a passing run takes + // about 6 minutes after a 4-minute setup): Playwright then reports the tests + // still running by name, and the report is uploaded, instead of the job + // being cancelled with neither. + globalTimeout: process.env.CI ? 9 * 60_000 : undefined, use: { baseURL: 'http://localhost:3002', trace: 'on-first-retry',