# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

permissions:
  contents: read
  statuses: write

on: [ push, pull_request ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [18.x, 20.x, 22.x, 24.x]

    steps:
    - uses: actions/checkout@v5
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v5
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm run build:all
    - run: npm run lint
    - run: npm test

    - run: npm run cover

    - name: Coveralls
      if: matrix.node-version == '24.x'
      uses: coverallsapp/github-action@v2
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
