# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: FedaPay Node Package

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

jobs:
  test:
    name: Test (${{ matrix.node }})
    strategy:
      matrix:
        os:
          - "ubuntu-latest"
        node:
          # should include even numbers >= 12
          # see: https://nodejs.org/en/about/previous-releases
          - "22"
          - "20"
          - "18"
          - "16"
          - "14"
          - "12"
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4

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

      - name: Print Node.js version
        run: node -v

      - name: Install packages
        run: npm install

      - name: Test
        run: npm run test
