Skip to content

Commit ad79168

Browse files
committed
ci: configure Playwright browser caching
Add Playwright browser installation to GitHub Actions: - Cache browsers at ~/.cache/ms-playwright (~100MB) - Install browsers and deps on cache miss - Only install system deps on cache hit - Set PLAYWRIGHT_HEADLESS=true for CI runs
1 parent 3c92f25 commit ad79168

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/ruby.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ jobs:
4040
# .ruby-version provides the Ruby version implicitly.
4141
bundler-cache: true
4242

43+
- name: Cache Playwright browsers
44+
uses: actions/cache@v3
45+
id: playwright-cache
46+
with:
47+
path: ~/.cache/ms-playwright
48+
key: playwright-${{ runner.os }}-1.58.0
49+
50+
- name: Install Playwright browsers (cache miss)
51+
if: steps.playwright-cache.outputs.cache-hit != 'true'
52+
run: npx --yes playwright@1.58.0 install --with-deps chromium
53+
54+
- name: Install Playwright system deps (cache hit)
55+
if: steps.playwright-cache.outputs.cache-hit == 'true'
56+
run: npx --yes playwright@1.58.0 install-deps chromium
57+
4358
- name: Setup test databases
4459
env:
4560
DATABASE_URL: postgres://postgres:postgres@localhost:5432
@@ -50,6 +65,8 @@ jobs:
5065
env:
5166
DATABASE_URL: postgres://postgres:postgres@localhost:5432
5267
CI_NODE_INDEX: ${{ matrix.ci_node_index }}
68+
RAILS_ENV: test
69+
PLAYWRIGHT_HEADLESS: true
5370
run: |
5471
bundle exec parallel_rspec spec/ \
5572
-n ${{ matrix.ci_node_total }} \

0 commit comments

Comments
 (0)