From f8ebc091c1ccbb9880dfdfb1b378930234c3bd28 Mon Sep 17 00:00:00 2001 From: Mantra Date: Thu, 7 Nov 2024 13:17:36 +0000 Subject: [PATCH] cache playwright binaries and shard tests --- .github/workflows/test.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4383b2cf..09ea7940 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,6 +51,9 @@ jobs: playwright-tests: runs-on: ubuntu-latest + strategy: + matrix: + shard: [1, 2, 3, 4, 5, 6] steps: - uses: actions/checkout@v4 - name: Setup Node @@ -58,10 +61,21 @@ jobs: with: build-and-run-server: true + - name: Get installed Playwright version + run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./app/static/package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV + - name: Cache playwright binaries + uses: actions/cache@v4 + id: playwright-cache + with: + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} - name: Install Playwright Browsers + if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps + - name: Test e2e - run: npm run test:e2e --prefix=app/static + run: npm run test:e2e --prefix=app/static -- --shard=${{ matrix.shard }}/6 lint: runs-on: ubuntu-latest