Skip to content

Cache Playwright browsers in CI #553

Description

@gkorland

Parent issue

Part of #550 (CI Pipeline Optimization Analysis)

Problem

The Playwright workflow installs browsers from scratch every run (npx playwright install --with-deps), taking ~50s per shard (~1.5 min total across 2 shards).

Solution

Add actions/cache for the Playwright browser binaries:

- name: Cache Playwright browsers
  id: playwright-cache
  uses: actions/cache@v4
  with:
    path: ~/.cache/ms-playwright
    key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install Playwright Browsers
  if: steps.playwright-cache.outputs.cache-hit != 'true'
  run: npx playwright install --with-deps chromium

- name: Install Playwright system deps
  if: steps.playwright-cache.outputs.cache-hit == 'true'
  run: npx playwright install-deps chromium

Estimated savings

~1.5 min per CI run

Effort

Low

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions