Skip to content

Commit

Permalink
test: cache playwright browsers in Github CI/CD (#162)
Browse files Browse the repository at this point in the history
* test: cache playwright browsers in Github CI/CD

* tweak

* set up install location of Playwright

* tweak

* tweak

* install OS dependencies of Playwright

* tweak
  • Loading branch information
TrickyPi authored Nov 19, 2022
1 parent 59d9939 commit b8cf047
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,33 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: "14"
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Install dependencies
run: npm ci
- name: Install Playwright
- 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: build
run: npm run build
- name: Run your tests
run: npm test
env:
PLAYWRIGHT_BROWSERS_PATH: ${{steps.npm-cache-dir.outputs.dir}}

0 comments on commit b8cf047

Please sign in to comment.