|
4 | 4 | # 7 GiB by default on GitHub, setting to 6 GiB
|
5 | 5 | # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
|
6 | 6 | NODE_OPTIONS: --max-old-space-size=6144
|
| 7 | + # install playwright binary manually (because pnpm only runs install script once) |
| 8 | + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" |
7 | 9 |
|
8 | 10 | on:
|
9 | 11 | push:
|
|
38 | 40 | node_version: 16
|
39 | 41 | fail-fast: false
|
40 | 42 |
|
41 |
| - env: |
42 |
| - # Install playwright's binray under node_modules so it will be cached together |
43 |
| - PLAYWRIGHT_BROWSERS_PATH: "0" |
44 |
| - |
45 | 43 | name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
|
46 | 44 | steps:
|
47 | 45 | - name: Checkout
|
|
59 | 57 | - name: Install deps
|
60 | 58 | run: pnpm install
|
61 | 59 |
|
62 |
| - # This could be removed when https://github.com/pnpm/pnpm/issues/4888 is resolved |
| 60 | + # Install playwright's binary under custom directory to cache |
| 61 | + - name: Set Playwright path (non-windows) |
| 62 | + if: runner.os != 'Windows' |
| 63 | + run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV |
| 64 | + - name: Set Playwright path (windows) |
| 65 | + if: runner.os == 'Windows' |
| 66 | + run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV |
| 67 | + |
| 68 | + - name: Cache Playwright's binary |
| 69 | + uses: actions/cache@v3 |
| 70 | + with: |
| 71 | + # Playwright removes unused browsers automatically |
| 72 | + # So does not need to add playwright version to key |
| 73 | + key: ${{ runner.os }}-playwright-bin-v1 |
| 74 | + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} |
| 75 | + |
63 | 76 | - name: Install Playwright
|
| 77 | + # does not need to explictly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved |
64 | 78 | run: pnpm playwright install chromium
|
65 | 79 |
|
66 | 80 | - name: Build
|
|
98 | 112 |
|
99 | 113 | - name: Install deps
|
100 | 114 | run: pnpm install
|
101 |
| - env: |
102 |
| - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" |
103 | 115 |
|
104 | 116 | - name: Build
|
105 | 117 | run: pnpm run build
|
|
0 commit comments