From: Alexander Moisseev Date: Fri, 31 Jul 2026 14:10:02 +0000 (+0300) Subject: [Test] Cache Playwright browsers correctly X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fbc5deaf0b4525ff2f95a31734a724f33f9df67;p=thirdparty%2Frspamd.git [Test] Cache Playwright browsers correctly The browser cache key had no version pin, so the 'latest' matrix leg restored stale browsers forever (the key is never rewritten on a hit) and browsers were re-downloaded every run. Pin the 'legacy' key to the Playwright version; roll the 'latest' key weekly (ISO year-week) with a prefix restore-key so newest revisions are still pulled regularly while the cache stays effective within a week. Both legs keep running on every PR/push; npx playwright install stays as-is (idempotent, skips already-cached browsers). --- diff --git a/.github/workflows/ci_webui_e2e_playwright.yml b/.github/workflows/ci_webui_e2e_playwright.yml index 4fb7c3fb93..dcd10e0f21 100644 --- a/.github/workflows/ci_webui_e2e_playwright.yml +++ b/.github/workflows/ci_webui_e2e_playwright.yml @@ -102,11 +102,28 @@ jobs: with: node-version: ${{ matrix.node-version || 'lts/*' }} + - name: Determine browser cache key + id: browsers-key + run: | + # 'latest' is a moving target: roll the key weekly (ISO year-week) so the + # newest Playwright/browser revisions are re-fetched regularly, while still + # benefiting from the cache within a week. 'legacy' is pinned => stable key. + if [ "${{ matrix.label }}" = "latest" ]; then + echo "key=browsers-latest-${{ runner.os }}-$(date -u +%G-W%V)" >> "$GITHUB_OUTPUT" + else + echo "key=browsers-legacy-${{ matrix.version }}-${{ runner.os }}" >> "$GITHUB_OUTPUT" + fi + - name: Cache Playwright browsers + id: playwright-cache uses: actions/cache@v4 with: path: .cache/ms-playwright-${{ matrix.label }} - key: browsers-${{ matrix.label }}-${{ runner.os }} + key: ${{ steps.browsers-key.outputs.key }} + # Warm-restore the most recent matching cache when the key rolls (esp. 'latest' + # across weeks), so only changed browser revisions are re-downloaded. + restore-keys: | + browsers-${{ matrix.label }}-${{ runner.os }}- - id: run-playwright name: Run Playwright tests (${{ matrix.label }})