# 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

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        # Operating System Matrix
        # ubuntu-latest: Latest Ubuntu version (currently 22.04)
        # windows-latest: Latest Windows Server version (currently 2022)
        # macos-12: macOS 12 Monterey (released 2021)
        # macos-13: macOS 13 Ventura (released 2022)
        # macos-14: macOS 14 Sonoma (released 2023)
        # macos-15: macOS 15 Sequoia (released 2024)
        os: [ubuntu-latest, windows-latest, macos-12, macos-13, macos-14, macos-15]
        # Node.js Version Matrix
        # 16: Node.js 16.x LTS (released 2020, EOL April 2024)
        # 18: Node.js 18.x LTS (released 2022, EOL April 2025)
        # 20: Node.js 20.x LTS (released 2023, EOL April 2026)
        node: [16, 18, 20]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node }}
    - run: npm install
    - run: npm run build --if-present
    - run: npm test
