Skip to content

Commit

Permalink
use caching on github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
depapp committed May 3, 2024
1 parent 573f3fa commit cfce86e
Showing 1 changed file with 39 additions and 11 deletions.
50 changes: 39 additions & 11 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,48 @@ jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v3

- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV

- name: Cache Playwright binaries
uses: actions/cache@v2
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}

- uses: actions/setup-node@v2
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
node-version: '16.x'

- run: npm ci

- name: Install Playwright dependencies
run: |
if [ ${{ steps.playwright-cache.outputs.cache-hit }} != 'true' ]; then
npx playwright install --with-deps
npx playwright install-deps
fi
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4

- uses: actions/upload-artifact@v2
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
name: playwright-test-results
path: test-results/

0 comments on commit cfce86e

Please sign in to comment.