From d194b513121bf067f8c3bf61c8ca45a4e0f9b733 Mon Sep 17 00:00:00 2001 From: Nathan Vasse Date: Wed, 8 Apr 2026 10:26:42 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F(ci)=20cache=20Playwright=20b?= =?UTF-8?q?rowsers=20by=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Key the Playwright browser cache by the installed @playwright/test version instead of yarn.lock so cache hits actually match the binaries Playwright expects, avoiding redundant browser downloads on every CI run. On cache hit we still install system deps to keep headless runs working. --- .github/workflows/drive-frontend.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/drive-frontend.yml b/.github/workflows/drive-frontend.yml index 480a64ae..0ef26fc3 100644 --- a/.github/workflows/drive-frontend.yml +++ b/.github/workflows/drive-frontend.yml @@ -98,17 +98,30 @@ jobs: path: "src/backend/core/templates/mail" key: mail-templates-${{ hashFiles('src/mail/mjml') }} + - name: Get Playwright version + id: playwright-version + run: | + VERSION=$(node -p "require('./src/frontend/apps/e2e/package.json').devDependencies['@playwright/test'] || require('./src/frontend/apps/e2e/package.json').dependencies['@playwright/test']") + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + - name: Cache Playwright browsers id: playwright-cache uses: actions/cache@v4 with: path: ~/.cache/ms-playwright - key: playwright-${{ matrix.browser }}-${{ hashFiles('src/frontend/**/yarn.lock') }} + key: playwright-${{ runner.os }}-${{ matrix.browser }}-${{ steps.playwright-version.outputs.version }} - - name: Install Playwright Browsers + - name: Install Playwright Browsers (cache miss) + if: steps.playwright-cache.outputs.cache-hit != 'true' run: | cd src/frontend/apps/e2e - npx playwright install --with-deps ${{matrix.browser}} + npx playwright install --with-deps ${{ matrix.browser }} + + - name: Install Playwright system deps (cache hit) + if: steps.playwright-cache.outputs.cache-hit == 'true' + run: | + cd src/frontend/apps/e2e + npx playwright install-deps ${{ matrix.browser }} - name: Start Docker services run: |