Skip to content

Commit

Permalink
ci: cache playwright dependencies (#4863)
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHYang authored Oct 3, 2024
1 parent 314267a commit 224860f
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions .github/workflows/playwright.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,61 @@
name: Playwright Tests

env:
pip-version: 24.2

on:
push:
branches: [ main, playground ]
pull_request:
branches: [ main, playground ]
jobs:
test:
e2e-test:
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./app
steps:
- uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@v4
with:
version: 9.8.0
version: 9.12.0
- name: Use Node.js
uses: actions/setup-node@v4
with:
cache-dependency-path: ./app/pnpm-lock.yaml
node-version: lts/*
cache: "pnpm"
cache: pnpm
- name: Install dependencies
working-directory: ./app
run: pnpm install --frozen-lockfile
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(pnpm list --json | jq -r '.[0].devDependencies["@playwright/test"].version')" >> $GITHUB_ENV
- name: Cache Playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-${{ hashFiles('app/playwright.config.ts') }}
- name: Install Playwright Browsers
working-directory: ./app
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm exec playwright install --with-deps
- name: Install system dependencies for WebKit
# WebKit dependencies can't be cached and must always be installed
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: pnpm exec playwright install-deps webkit
- name: Build the app
working-directory: ./app
run: pnpm run build
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Phoenix
run: |
python -m pip install --upgrade pip==${{ env.pip-version }}
pip install .
- uses: astral-sh/setup-uv@v3
with:
version: 0.4.18
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: uv pip install --system -q ../. uvloop
- run: uv pip list
- name: Run Playwright tests
working-directory: ./app
run: pnpm exec playwright test
- uses: actions/upload-artifact@v4
if: always()
Expand Down

0 comments on commit 224860f

Please sign in to comment.