name: Continuous Integration
on: [ push, pull_request ]

jobs:
  test:
    name: Test
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        os: [ ubuntu-latest, macos-latest, windows-latest ]
        node-version: [ "12", "14", "16", "18" ]

    steps:
      - name: Checkout project
        uses: actions/checkout@v2

      - name: Setup Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          check-latest: true
          cache: 'npm'

      - name: Install circom
        run: npm install -g circom@latest

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm run test
