name: tests

on:
  push:
    branches:
      - "master"
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  format:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '16.x'
    - run: npm install
    - run: npm run format

  type-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '16.x'
    - run: npm install
    - run: npm run flow

  lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '16.x'
    - run: npm install
    - run: npm run lint

  unit-test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '16.x'
    - run: npm install
    - run: npm run unit
