From 4fbef836d841b544001b745e224c374b510d00bc Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 10 Jan 2023 17:31:00 +0100 Subject: [PATCH] test: Cache Playwright deps --- .github/workflows/build.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2830b56b9eb4..ca288b934fb5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -541,13 +541,34 @@ jobs: with: path: ${{ env.CACHED_BUILD_PATHS }} key: ${{ env.BUILD_CACHE_KEY }} + - name: Get npm cache directory + id: npm-cache-dir + run: | + echo "::set-output name=dir::$(npm config get cache)" + - name: Get Playwright version + id: playwright-version + run: | + echo "::set-output name=version::$(node -p "require('@playwright/test/package.json').version")" + - uses: actions/cache@v3 + name: Check if Playwright browser is cached + id: playwright-cache + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + 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 + env: + PLAYWRIGHT_BROWSERS_PATH: ${{steps.npm-cache-dir.outputs.dir}} + - name: Install OS dependencies of Playwright if cache hit + if: steps.playwright-cache.outputs.cache-hit == 'true' + run: npx playwright install-deps - name: Run Playwright tests env: PW_BUNDLE: ${{ matrix.bundle }} PW_TRACING_ONLY: ${{ matrix.tracing_only }} run: | cd packages/integration-tests - yarn run playwright install-deps webkit yarn test:ci job_browser_integration_tests: