Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions .github/actions/setup-and-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,4 @@ runs:
uses: actions/setup-node@v5
with:
node-version: ${{ inputs.node-version }}

- name: Resolve package versions
id: resolve-package-versions
shell: bash
run: >
echo "$(
node -e "
const fs = require('fs');
const lockfile = fs.readFileSync('./pnpm-lock.yaml', 'utf8');
const pattern = (name) => new RegExp(name + ':\\\s+specifier: [\\\s\\\w\\\.^]+version: (\\\d+\\\.\\\d+\\\.\\\d+)');
const playwrightVersion = lockfile.match(pattern('playwright'))[1];
console.log('PLAYWRIGHT_VERSION=' + playwrightVersion);
"
)" >> $GITHUB_OUTPUT

- name: Print versions
shell: bash
run: echo "${{ toJson(steps.resolve-package-versions.outputs) }}"

- name: Check resolved package versions
shell: bash
if: |
contains(fromJSON('[null, "", "undefined"]'), steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION)
run: echo "Failed to resolve package versions. See log above." && exit 1

- name: Cache Playwright v${{ steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION }}
uses: actions/cache@v4
id: playwright-cache
with:
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
key: ${{ runner.os }}-playwright-${{ steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ runner.os }}-playwright-
cache: pnpm
43 changes: 43 additions & 0 deletions .github/actions/setup-playwright/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Setup Playwright
description: Setup and cache Playwright browser binaries

runs:
using: composite
steps:
- name: Resolve package versions
id: resolve-package-versions
shell: bash
run: >
echo "$(
node -e "
const fs = require('fs');
const lockfile = fs.readFileSync('./pnpm-lock.yaml', 'utf8');
const pattern = (name) => new RegExp(name + ':\\\s+specifier: [\\\s\\\w\\\.^]+version: (\\\d+\\\.\\\d+\\\.\\\d+)');
const playwrightVersion = lockfile.match(pattern('playwright'))[1];
console.log('PLAYWRIGHT_VERSION=' + playwrightVersion);
"
)" >> $GITHUB_OUTPUT

- name: Print versions
shell: bash
run: echo "${{ toJson(steps.resolve-package-versions.outputs) }}"

- name: Check resolved package versions
shell: bash
if: |
contains(fromJSON('[null, "", "undefined"]'), steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION)
run: echo "Failed to resolve package versions. See log above." && exit 1

- name: Cache Playwright v${{ steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION }}
uses: actions/cache@v4
id: playwright-cache
with:
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
key: ${{ runner.os }}-playwright-${{ steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ runner.os }}-playwright-

- name: Install Playwright Dependencies
shell: bash
if: steps.playwright-cache.outputs.cache-hit != 'true'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is the most notable change.

run: pnpm exec playwright install --with-deps --only-shell
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ jobs:
- name: Install
run: pnpm i

- name: Install Playwright Dependencies
run: pnpm exec playwright install chromium --with-deps --only-shell
- uses: ./.github/actions/setup-playwright

- name: Build
run: pnpm run build
Expand Down Expand Up @@ -153,8 +152,7 @@ jobs:
- name: Install
run: pnpm i

- name: Install Playwright Dependencies
run: pnpm exec playwright install --with-deps --only-shell
- uses: ./.github/actions/setup-playwright

- name: Build
run: pnpm run build
Expand Down Expand Up @@ -186,8 +184,7 @@ jobs:
- name: Install
run: pnpm add vite@npm:rolldown-vite && git add . && git commit -m "ci" && pnpm i --prefer-offline --no-frozen-lockfile

- name: Install Playwright Dependencies
run: pnpm exec playwright install --with-deps --only-shell
- uses: ./.github/actions/setup-playwright

- name: Build
run: pnpm run build
Expand Down
Loading