name: Test
on:
    pull_request:
    push:
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-22.04, ubuntu-24.04]
        node: [16, 18, 20, 22, 24]
        mongodb-version: ['6.0', '7.0', '8.0']
    name: Node ${{ matrix.node }} MongoDB ${{ matrix.mongodb-version }}
    steps:
    - name: Git checkout
      uses: actions/checkout@v6

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v6
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'

    - name: Start MongoDB
      uses: supercharge/mongodb-github-action@1.12.1
      with:
        mongodb-version: ${{ matrix.mongodb-version }}

    - run: npm install

    - run: npm test
