# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the "main" branch
  push:
    branches: ['main']

  pull_request:
    branches: ['main']

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  test:
    runs-on: ubuntu-latest
    name: Run Unit Testing

    steps:
      - uses: actions/checkout@v3
      - name: Install deps
        run: yarn

      - name: Run Test
        run: yarn test

      - name: Run test coverage
        run: yarn test:cover

      - name: Upload coverage reports to Codecov
        uses: codecov/codecov-action@v3
        with:
          token: ${{secrets.CODECOV_TOKEN}}
