name: Run Tests
on:
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      COVERAGE_THRESHOlD: 80
    steps:
      - uses: actions/checkout@v2
      - name: Install Python 3
        uses: actions/setup-python@v1
        with:
          python-version: 3.8
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install coverage
      - name: Run unittests
        run: coverage run -m --omit "./tests*,*__init__.py" unittest tests/test_suite.py -v
      - name: Run Coverage
        run: coverage report -i --skip-covered --fail-under $COVERAGE_THRESHOlD
