Skip to content

Commit

Permalink
ci: pnpm cache
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Sep 15, 2024
1 parent 9ca5161 commit 75f0b80
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
49 changes: 49 additions & 0 deletions .github/actions/playwright.yml
Original file line number Diff line number Diff line change
@@ -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 }}

- 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
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.yml
- run: pnpm exec playwright test --forbid-only --shard=${{ matrix.shared }}/4
env:
TEMP_DIR: ${{ runner.temp }}
Expand Down

0 comments on commit 75f0b80

Please sign in to comment.