From 5091d1b397595e5ff2010702929a197237d83dd6 Mon Sep 17 00:00:00 2001 From: funman300 Date: Mon, 22 Jun 2026 12:09:47 -0700 Subject: [PATCH] ci(web-e2e): prebuild server so Playwright webServer stops timing out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The web-e2e job has been failing on every run with: Error: Timed out waiting 120000ms from config.webServer. Playwright's `webServer` runs `cargo run -p solitaire_server --quiet` and waits 120s for /health. The workflow cached only npm — no Rust cache — so each run cold-compiled the entire server graph (axum/sqlx/reqwest/aws-lc-sys) inside that 120s window and never came up. The browser tests never executed; the failure was infra, not a web regression. Fix the harness so the tests actually run: - add `Swatinem/rust-cache@v2` to warm the cargo cache across runs - add a `Prebuild server` step (`SQLX_OFFLINE=true cargo build -p solitaire_server`) before Playwright, so `webServer`'s `cargo run` reuses the compiled binary and starts in seconds (.sqlx offline cache is committed) - raise `webServer.timeout` 120s -> 300s as a safety margin for a cold cargo cache (e.g. first run after a deps bump) Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/web-e2e.yml | 13 +++++++++++++ solitaire_server/e2e/playwright.config.js | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/web-e2e.yml b/.gitea/workflows/web-e2e.yml index 7ad4804..2b69909 100644 --- a/.gitea/workflows/web-e2e.yml +++ b/.gitea/workflows/web-e2e.yml @@ -25,6 +25,19 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable + - name: Cache cargo build + uses: Swatinem/rust-cache@v2 + + # Prebuild the server so Playwright's `webServer` (which runs + # `cargo run -p solitaire_server`) starts from a compiled binary instead + # of cold-compiling the whole dependency graph (axum/sqlx/reqwest) inside + # its 120s startup window — the timeout that was failing every run. + # SQLX_OFFLINE uses the checked-in `.sqlx/` query cache (no live DB). + - name: Prebuild server + env: + SQLX_OFFLINE: 'true' + run: cargo build -p solitaire_server --quiet + - name: Set up Node.js uses: actions/setup-node@v4 with: diff --git a/solitaire_server/e2e/playwright.config.js b/solitaire_server/e2e/playwright.config.js index 61801c5..4583a0e 100644 --- a/solitaire_server/e2e/playwright.config.js +++ b/solitaire_server/e2e/playwright.config.js @@ -35,7 +35,11 @@ module.exports = defineConfig({ `cargo run -p solitaire_server --quiet`, cwd: repoRoot, url: `http://127.0.0.1:${serverPort}/health`, - timeout: 120_000, + // CI prebuilds the server (see web-e2e.yml) so `cargo run` reuses the + // compiled binary and starts in seconds. The generous timeout is a + // safety margin for a cold cargo cache (e.g. first run after a deps + // bump) where `cargo run` may still recompile. + timeout: 300_000, reuseExistingServer: !process.env.CI, }, }); -- 2.47.3