name: test

on:
  - push
  - pull_request

jobs:
  build:

    runs-on: ubuntu-22.04

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

    steps:
    - uses: actions/checkout@v4.2.2
    - name: Setup Node.js
      uses: actions/setup-node@v4.1.0
      with:
        node-version: ${{ matrix.node-version }}
    - name: npm install, build, and test
      run: |
        npm install
        npm run build --if-present
        npm test
      env:
        CI: true
