name: Run Unit tests

on:
  push:
    branches:
      - 3.x
  pull_request:
    branches:
      - '**'

jobs:
  build:

    runs-on: ubuntu-22.04

    strategy:
      matrix:
        node-version: [20.x]

    steps:
    - uses: actions/checkout@v4
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm i --force
      env:
        PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
        PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
    - uses: nick-fields/retry@v3
      with:
        timeout_minutes: 6
        max_attempts: 3
        retry_on: error
        command: npm test
