name: type check and build test

on: pull_request

jobs:
  type-check-and-build-test:
    name: type check and build test
    runs-on: ubuntu-20.04
    steps:
      - name: checkout repository
        uses: actions/checkout@v2
      - name: setup Node.js
        uses: actions/setup-node@v2
        with:
          node-version: "16"
      - name: Install npm dependencies (npm ci)
        run: npm ci
      - name: PureScript FFI Code TypeScript → JavaScript
        run: npx tsc --project ./tsconfig-purs-ffi.json
      - name: PureScript Build
        run: npx spago build
      - name: Run build script
        run: npx spago run --main Definy.StartProductionMain
      - name: Type check
        run: npm run typeCheck
      - name: Test
        run: npm run test
