name: unit-tests
on:
  pull_request:
    branches:
      - dev
      - releases/v1
      - releases/v2
  push:
    branches:
      - dev
    tags-ignore:
      - '*.*'
jobs:
  unit-tests:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2.4.0

      - uses: actions/setup-node@v2.5.1
        with:
          node-version: 'v14.18.1'
          registry-url: 'https://registry.npmjs.org'

      - name: Install Yarn
        run: npm install -g yarn

      - name: Install and Test
        run: |
          yarn install
          yarn lint
          yarn test

      - name: Uploade CodeCov Report
        uses: codecov/codecov-action@v2.1.0
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
