name: CI
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
jobs:
  test:
    name: ${{ matrix.name }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - pptr: 17.x.x
          - pptr: 20.x.x
          - pptr: 21.x.x
          - pptr: 22.x.x
    steps:
      - name: Run git checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Run nvm install 20
        uses: actions/setup-node@v1
        with:
          node-version: 20.x
      - run: npm install
      - run: npm install "puppeteer@${{ matrix.pptr }}"
      - run: npm install "@types/puppeteer@${{ matrix.pptr }}" || echo "No types available"
      - run: npm run rebuild
      - run: npm run test:unit --coverage --runInBand --verbose
