mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-09 13:40:28 +08:00
Cache Playwright binaries if possible
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
@@ -15,12 +15,34 @@ jobs:
|
||||
node-version: '18.12.1'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Install Playwright Browsers
|
||||
- name: Get npm cache directory
|
||||
id: npm-cache-dir
|
||||
run: |
|
||||
echo "::set-output name=dir::$(npm config get cache)"
|
||||
- name: Get Playwright version
|
||||
id: playwright-version
|
||||
run: |
|
||||
echo "::set-output name=version::$(node -p "require('@playwright/test/package.json').version")"
|
||||
- uses: actions/cache@v3
|
||||
name: Check if Playwright browser is cached
|
||||
id: playwright-cache
|
||||
with:
|
||||
path: ${{ steps.npm-cache-dir.outputs.dir }}
|
||||
key: ${{ runner.os }}-Playwright-${{steps.playwright-version.outputs.version}}
|
||||
- name: Install Playwright browser if not cached
|
||||
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
||||
run: npx playwright install --with-deps
|
||||
env:
|
||||
PLAYWRIGHT_BROWSERS_PATH: ${{steps.npm-cache-dir.outputs.dir}}
|
||||
- name: Install OS dependencies of Playwright if cache hit
|
||||
if: steps.playwright-cache.outputs.cache-hit == 'true'
|
||||
run: npx playwright install-deps
|
||||
- name: Start http-api test server
|
||||
run: ./scripts/run-http-api-with-fixtures --non-interactive --detach
|
||||
- name: Run Playwright tests
|
||||
run: npm run test:e2e -- --project ${{ matrix.browser }}
|
||||
env:
|
||||
PLAYWRIGHT_BROWSERS_PATH: ${{steps.npm-cache-dir.outputs.dir}}
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user