name: Unit Tests

on: [push, pull_request]

env:
  CI: true

jobs:
  checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: CultureHQ/actions-yarn@master
        with:
          args: install
      - name: Flow
        uses: CultureHQ/actions-yarn@master
        with:
          args: test:flow
      - name: ESLint
        uses: CultureHQ/actions-yarn@master
        with:
          args: test:eslint
      - name: TypeScript
        uses: CultureHQ/actions-yarn@master
        with:
          args: build:es
      - name: TypeScript
        uses: CultureHQ/actions-yarn@master
        with:
          args: build:typescript
      - name: TypeScript
        uses: CultureHQ/actions-yarn@master
        with:
          args: test:typescript

  unit:
    runs-on: ubuntu-latest
    container:
      image: ianwalter/puppeteer:3.0.0
      options: --shm-size=1g
    steps:
      - uses: actions/checkout@v2
      - uses: CultureHQ/actions-yarn@master
        with:
          args: install
      - uses: ianwalter/puppeteer@3.0.0
        with:
          args: yarn
      - name: TypeScript
        uses: ianwalter/puppeteer@3.0.0
        with:
          args: yarn build:bundles
      - name: Run Jest Unit Tests
        uses: ianwalter/puppeteer@3.0.0
        with:
          args: yarn test:unit
