|
1 | 1 | name: Playwright Tests
|
2 | 2 | on:
|
3 | 3 | push:
|
4 |
| - branches: [ main, master ] |
| 4 | + branches: [main] |
5 | 5 | pull_request:
|
6 |
| - branches: [ main, master ] |
| 6 | + branches: [main] |
7 | 7 | jobs:
|
8 | 8 | test:
|
9 | 9 | timeout-minutes: 60
|
10 | 10 | runs-on: ubuntu-latest
|
11 | 11 | steps:
|
12 |
| - - uses: actions/checkout@v4 |
13 |
| - - uses: actions/setup-node@v4 |
14 |
| - with: |
15 |
| - node-version: lts/* |
16 |
| - - name: Install dependencies |
17 |
| - run: npm ci |
18 |
| - - name: Install Playwright Browsers |
19 |
| - run: npx playwright install --with-deps |
20 |
| - - name: Run Playwright tests |
21 |
| - run: npx playwright test |
22 |
| - - uses: actions/upload-artifact@v4 |
23 |
| - if: always() |
24 |
| - with: |
25 |
| - name: playwright-report |
26 |
| - path: playwright-report/ |
27 |
| - retention-days: 30 |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + - uses: actions/setup-node@v4 |
| 14 | + with: |
| 15 | + node-version: lts/* |
| 16 | + - name: Install dependencies |
| 17 | + run: npm ci |
| 18 | + |
| 19 | + - name: Cache node modules |
| 20 | + id: cache-npm |
| 21 | + uses: actions/cache@v3 |
| 22 | + env: |
| 23 | + cache-name: cache-node-modules |
| 24 | + with: |
| 25 | + # npm cache files are stored in `~/.npm` on Linux/macOS |
| 26 | + path: ~/.npm |
| 27 | + key: ${{ hashFiles('**/package-lock.json') }} |
| 28 | + |
| 29 | + - if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }} |
| 30 | + name: List the state of node modules |
| 31 | + continue-on-error: true |
| 32 | + run: npm list |
| 33 | + |
| 34 | + - name: Install |
| 35 | + run: npm install |
| 36 | + |
| 37 | + - name: CI |
| 38 | + run: npm run ci |
| 39 | + env: |
| 40 | + CI: true |
| 41 | + |
| 42 | + - name: Install Playwright Browsers |
| 43 | + run: npx playwright install --with-deps |
| 44 | + - name: Run Playwright tests |
| 45 | + run: npx playwright test |
| 46 | + - uses: actions/upload-artifact@v4 |
| 47 | + if: always() |
| 48 | + with: |
| 49 | + name: playwright-report |
| 50 | + path: playwright-report/ |
| 51 | + retention-days: 30 |
0 commit comments