name: Backend Tests on: push: branches: - main - master paths: - 'py/**' - 'standalone.py' - 'tests/**' - 'requirements.txt' - 'requirements-dev.txt' - 'pyproject.toml' - 'pytest.ini' - '.github/workflows/backend-tests.yml' pull_request: paths: - 'py/**' - 'standalone.py' - 'tests/**' - 'requirements.txt' - 'requirements-dev.txt' - 'pyproject.toml' - 'pytest.ini' - '.github/workflows/backend-tests.yml' jobs: pytest: name: Run pytest with coverage runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' cache-dependency-path: | requirements.txt requirements-dev.txt - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt - name: Run pytest with coverage env: COVERAGE_FILE: coverage/backend/.coverage run: | mkdir -p coverage/backend python -m pytest \ --cov=py \ --cov=standalone \ --cov-report=term-missing \ --cov-report=xml:coverage/backend/coverage.xml \ --cov-report=html:coverage/backend/html \ --cov-report=json:coverage/backend/coverage.json - name: Upload coverage artifact if: always() uses: actions/upload-artifact@v4 with: name: backend-coverage path: coverage/backend if-no-files-found: warn