name: Run Tests

on:
  pull_request:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.10.13
    - name: Install Poetry
      run: |
        pip install poetry coverage
        poetry config virtualenvs.create false

    - name: Run unittest tests
      run: coverage run -m unittest discover -s tests

    - name: Upload Coverage to Codecov
      uses: codecov/codecov-action@v2
      with:
        token: ${{ secrets.CODECOV_TOKEN }}