name: CI
on:
  push:
    branches: [master]
  pull_request:
    branches: [master]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: '16'
      - name: Install dependencies
        run: npm ci
      #      ^ bash
      - name: Run tests
        run: npm test
      #      ^ bash
      - name: Parse Petalisp
        run: |
          git submodule init
          git submodule update
          if (( $(node_modules/tree-sitter-cli/tree-sitter parse test/Petalisp/**/*.lisp -q | wc -l) > 2 )); then # There are 2 known failures (strings that are not format strings but use ~X syntax)
            exit 1 
          else
            echo "Successfully parsed Petalisp"
          fi
      #    ^ bash
      - name: Run tests
        run: npm test
