name: run-tests

on:
  push:
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.8']

    steps:
    - uses: actions/checkout@v3
    - name: Install poetry
      run: pipx install poetry
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
        cache: 'poetry'
    - name: Install dependencies
      run: poetry install --no-interaction
    - name: Test with pytest
      run: poetry run pytest
    - name: Upload coverage report to codecov
      uses: codecov/codecov-action@v3
      with:
        file: ./coverage.xml
