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.
This commit is contained in:
giancarlo
2024-04-11 18:29:16 +08:00
parent 67c8097a31
commit 4dfabd8b89

View File

@@ -63,7 +63,21 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: pnpm install 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 - 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 run: pnpm exec ./apps/e2e/node_modules/.bin/playwright install --with-deps
- name: Supabase CLI - name: Supabase CLI