name: Node.js CI

on: [push]

jobs:
  build:
    strategy:
      matrix:
        node-version: [18, 20, 22]
        arch: [ubuntu-latest, macos-latest, windows-latest]

    name: ${{ matrix.arch }} - node${{ matrix.node-version }}

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

    steps:
    - uses: actions/checkout@v4

    - uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
        registry-url: 'https://registry.npmjs.org'

    - name: Install dependencies
      run: |
        npm install
      env:
        NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

    - name: Run test suite
      run: |
        npm test

    - name: Check CLI bootstrapping
      run: |
        node index.js
