From 8f1850785e145e784b2911d5363e6199e1a7d832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mitja=20Bezen=C5=A1ek?= Date: Thu, 12 Oct 2023 11:28:55 +0200 Subject: [PATCH] Cache playwright browsers. (#2067) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds caching for playwright browsers, should make the e2e tests run much faster. ![CleanShot 2023-10-11 at 13 06 48](https://github.com/tldraw/tldraw/assets/2523721/6eb7fb00-d70e-4019-9e81-736b2a19e1bb) Here's how it looks like when there's a cache hit (added an empty commit to this PR to test it out) ![CleanShot 2023-10-11 at 13 19 30](https://github.com/tldraw/tldraw/assets/2523721/b6a2cfcf-8322-413f-822b-8ed211f5c9a3) ### Change Type - [ ] `patch` — Bug fix - [ ] `minor` — New feature - [ ] `major` — Breaking change - [ ] `dependencies` — Changes to package dependencies[^1] - [ ] `documentation` — Changes to the documentation only[^2] - [x] `tests` — Changes to any test code only[^2] - [ ] `internal` — Any other changes that don't affect the published package[^2] - [ ] I don't know [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version --- .github/workflows/playwright.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 2c1a4e31f..0b8681850 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -37,8 +37,24 @@ jobs: - name: Install dependencies run: yarn - - name: Install Playwright browsers + - name: Get installed Playwright version + id: playwright-version + run: | + cd apps/examples + yarn info @playwright/test --json > playwright.json + echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./playwright.json').children.Version)")" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Check for Playwright browsers cache + id: playwright-cache + with: + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} + + - name: Install Playwright Browsers run: npx playwright install --with-deps chromium chrome + if: steps.playwright-cache.outputs.cache-hit != 'true' - name: Run Playwright tests run: 'yarn e2e'