Files
ComfyUI_frontend/.github/actions/setup-playwright/action.yml
snomiao 064d5a67b2 refactor: improve .cache directory caching strategy
Changes:
- Move cache restore to setup-frontend action BEFORE build operations
- Remove duplicate cache step from setup-playwright action
- Use cache/restore instead of cache to avoid auto-save behavior
- Rename cache key from 'playwright-setup-cache' to 'tool-cache' for clarity
- Include source file hashes in cache key for proper invalidation

Benefits:
- Cache is now restored before tools run, allowing them to use cached data
- Eliminates duplicate caching of ./.cache directory
- Cache properly invalidates when source files or configs change
- Follows GitHub Actions best practice of restore before, save after pattern
- The workspace cache in tests-ci.yaml handles saving the complete state

Note: The .cache directory contains outputs from ESLint, Prettier, Stylelint,
Knip, and TypeScript incremental builds. These should be restored before any
build/lint operations run.
2025-10-08 21:27:03 +00:00

29 lines
1.1 KiB
YAML

name: Setup Playwright
description: Cache and install Playwright browsers with dependencies
runs:
using: composite
steps:
- name: Detect Playwright version
id: detect-version
shell: bash
run: |
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version')
echo "playwright-version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
- name: Cache Playwright Browsers
uses: actions/cache@v4
id: cache-playwright-browsers
with:
path: '~/.cache/ms-playwright'
key: ${{ runner.os }}-playwright-browsers-${{ steps.detect-version.outputs.playwright-version }}
- name: Install Playwright Browsers
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
shell: bash
run: pnpm exec playwright install chromium --with-deps
- name: Install Playwright Browsers (operating system dependencies)
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
shell: bash
run: pnpm exec playwright install-deps