From 4dfabd8b891c65e5b8a2fb041835455302db1773 Mon Sep 17 00:00:00 2001 From: giancarlo Date: Thu, 11 Apr 2024 18:29:16 +0800 Subject: [PATCH] Add caching for Playwright browsers in workflow This commit introduces caching for Playwright browsers in the GitHub Actions workflow. It first stores the Playwright version as an environment variable, then attempts to cache the browsers for this specific version. Browsers are only installed if they aren't found in the cache. --- .github/workflows/workflow.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 973f0bcd4..c38e4acc0 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -63,7 +63,21 @@ jobs: - name: Install dependencies run: pnpm install + - name: Store Playwright's Version + run: | + PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//') + echo "Playwright's Version: $PLAYWRIGHT_VERSION" + echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV + + - name: Cache Playwright Browsers for Playwright's Version + id: cache-playwright-browsers + uses: actions/cache@v4 + with: + path: ~/.cache/ms-playwright + key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} + - name: Install Playwright Browsers + if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' run: pnpm exec ./apps/e2e/node_modules/.bin/playwright install --with-deps - name: Supabase CLI