Cache dependencies in CI #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| # Output colored text | |
| FORCE_COLOR: 1 | |
| jobs: | |
| test: | |
| name: Test on ${{ matrix.os }} using Node.js v${{ matrix.node }} | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| os: [windows-latest, macos-latest, ubuntu-latest] | |
| # This should also include Node.js v20, but snapshot testing is only | |
| # available in Node.js v22.3 or later. | |
| node: [22, 24] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Install Chrome | |
| run: pnpm install-chrome-for-puppeteer | |
| # Prevent `No usable sandbox!` error on Ubuntu. See: | |
| # https://github.com/puppeteer/puppeteer/issues/13595 | |
| - name: Disable AppArmor | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: | |
| echo 0 | sudo tee | |
| /proc/sys/kernel/apparmor_restrict_unprivileged_userns | |
| - name: Run tests | |
| run: pnpm test |