diff --git a/.github/actions/playwright/action.yml b/.github/actions/playwright/action.yml new file mode 100644 index 000000000..cca84da47 --- /dev/null +++ b/.github/actions/playwright/action.yml @@ -0,0 +1,49 @@ +name: Install Playwright +description: Install Playwright and dependencies with cache + +# https://github.com/microsoft/playwright/issues/7249 + +inputs: + working-directory: + description: Where to install Playwright + default: ./ + +outputs: + version: + description: Installed version of Playwright + value: ${{ steps.version.outputs.version }} + cache-hit: + description: Whether cache for Playwright was found + value: ${{ steps.cache.outputs.cache-hit }} + +runs: + using: composite + steps: + - name: Get Playwright version + id: version + shell: bash + working-directory: ${{ inputs.working-directory }} + run: | + VERSION=$(pnpm list @playwright/test | grep @playwright/test | sed 's/[^0-9.]*//g') + echo "Version: $VERSION" + echo "PLAYWRIGHT_VERSION=$VERSION" >> $GITHUB_ENV + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Cache Playwright + id: cache + uses: actions/cache@v4 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ env.PLAYWRIGHT_VERSION }}-${{ runner.os }} + + - name: Install Playwright and its dependencies + shell: bash + if: steps.cache.outputs.cache-hit != 'true' + working-directory: ${{ inputs.working-directory }} + run: pnpx playwright install chromium --with-deps + + - name: Install just Playwright's dependencies + shell: bash + if: steps.cache.outputs.cache-hit == 'true' + working-directory: ${{ inputs.working-directory }} + run: pnpx playwright install-deps diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5874e2b14..fbfcf9f63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,15 +79,9 @@ jobs: with: name: waku path: packages/waku - - name: Cache Playwright - uses: actions/cache@v3 - id: playwright-cache - with: - path: ~/.cache/ms-playwright - key: ${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Install Playwright - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: pnpm playwright install --with-deps + id: install-playwright + uses: ./.github/actions/playwright - run: pnpm exec playwright test --forbid-only --shard=${{ matrix.shared }}/4 env: TEMP_DIR: ${{ runner.temp }}