playwright-test.yml
1 name: Playwright Test 2 3 on: 4 push: 5 branches: [main] 6 paths: 7 - '**' 8 - '!LICENSE' 9 - '!*.md' 10 - '!docs/**' 11 - '!.github/**' 12 - '.github/workflows/playwright-test.yml' 13 pull_request: 14 branches: [main] 15 workflow_dispatch: 16 17 jobs: 18 playwright-test: 19 runs-on: ${{ matrix.os }} 20 name: Test Node.js ${{ matrix.node_version }} on ${{ matrix.os }} 21 strategy: 22 fail-fast: false 23 matrix: 24 node_version: ['20', '22'] 25 os: [windows-latest, macos-latest, ubuntu-latest] 26 27 steps: 28 - uses: actions/checkout@v4 29 with: 30 fetch-depth: 0 31 32 - name: Install xvfb 33 if: runner.os == 'Linux' 34 run: | 35 sudo apt install -y -q --no-install-recommends xvfb 36 37 - name: Setup Node.js ${{ matrix.node_version }} 38 uses: actions/setup-node@v4 39 with: 40 node-version: ${{ matrix.node_version }} 41 cache: npm 42 cache-dependency-path: '**/package-lock.json' 43 44 - name: Cache dependencies 45 uses: actions/cache@v4 46 id: npm-cache 47 with: 48 path: | 49 **/node_modules 50 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 51 restore-keys: | 52 ${{ runner.os }}-npm- 53 54 - name: Install dependencies 55 if: steps.npm-cache.outputs.cache-hit != 'true' 56 run: npm i 57 58 - name: Test module script (Windows or macOS) 59 if: runner.os != 'Linux' 60 run: | 61 npm run test 62 63 - name: Test module script (Linux) 64 if: runner.os == 'Linux' 65 run: | 66 npm run test:linux