From 7ef42a49faf0fcaca8d2122d5f1f630e494df0c4 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Tue, 4 Jul 2023 15:53:48 +0200 Subject: [PATCH] Implemented Playwright caching into browser-tests workflow - this allows us to use the Playwright cache that is in place to speed up tests --- .github/workflows/browser-tests.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/browser-tests.yml b/.github/workflows/browser-tests.yml index 7a7c11ae14..3c0dccf986 100644 --- a/.github/workflows/browser-tests.yml +++ b/.github/workflows/browser-tests.yml @@ -55,10 +55,21 @@ jobs: - name: Run migrations working-directory: ghost/core run: yarn setup - - - name: Install Playwright - working-directory: ghost/core + - name: Get Playwright version + id: playwright-version + run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT + - uses: actions/cache@v3 + name: Check if Playwright browser is cached + id: playwright-cache + with: + path: ~/.cache/ms-playwright + key: ${{ runner.os }}-Playwright-${{steps.playwright-version.outputs.version}} + - name: Install Playwright browser if not cached + if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps + - name: Install OS dependencies of Playwright if cache hit + if: steps.playwright-cache.outputs.cache-hit == 'true' + run: npx playwright install-deps - name: Build Admin if: env.ENVIRONMENT == 'browser-tests-local'