diff --git a/.github/scripts/get-playwright-version.sh b/.github/scripts/get-playwright-version.sh new file mode 100755 index 0000000..388c457 --- /dev/null +++ b/.github/scripts/get-playwright-version.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -euo pipefail + +playwright_version=$(pnpm list --depth 1 --json | jq -r '.[].devDependencies["@playwright/test"].version') + +echo "Found Playwright version: $playwright_version" +echo "version=$playwright_version" >>"$GITHUB_OUTPUT" diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 4857501..7f2c653 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -26,11 +26,24 @@ jobs: node-version-file: 'package.json' cache: 'pnpm' - run: pnpm install + - name: Get installed Playwright version + id: playwright-version + run: .github/scripts/get-playwright-version.sh + - name: Cache playwright binaries + uses: actions/cache@v4 + id: playwright-cache + with: + path: ~/.cache/ms-playwright + key: '${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}' + restore-keys: ${{ runner.os }}-playwright- - name: Install Playwright Browsers run: pnpm exec playwright install --with-deps - - run: pnpm lint - - run: pnpm run build - - run: pnpm test + - name: Run linting + run: pnpm lint + - name: Build the project + run: pnpm run build + - name: Run tests + run: pnpm test - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 with: