name: Test

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js
      uses: actions/setup-node@v1
    - uses: actions/cache@v2
      id: cache
      with:
        path: node_modules
        key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
    - run: yarn install --frozen-lockfile
      if: steps.cache.outputs.cache-hit != 'true'

    - run: yarn run lint --no-fix --max-warnings 0
    - run: yarn run test:unit