name: Node.js CI

on: [push, pull_request]

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        # Vitest 4 requires Node 20+. Node 18 hit EOL April 2025.
        os: [ubuntu-latest, windows-latest]
        node-version: [20.x, 22.x, 24.x]

    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive

      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'

      - run: npm ci

      - run: npm run test:cli
      - run: npm run test:module:node
