Skip to content

Bump pytest-cov from 5.0.0 to 6.0.0 in /tests #257

Bump pytest-cov from 5.0.0 to 6.0.0 in /tests

Bump pytest-cov from 5.0.0 to 6.0.0 in /tests #257

name: TestWorks CI
on:
push:
branches:
- main
paths-ignore:
- '.github/**'
- '.idea/**'
- '.run/**'
- '.vscode/**'
- 'README.md'
- '.gitattributes'
- '.gitignore'
pull_request:
branches:
- main
paths-ignore:
- '.github/**'
- '.idea/**'
- '.run/**'
- '.vscode/**'
- 'README.md'
- '.gitattributes'
- '.gitignore'
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: '3.10'
DATABASE_URL: 'postgresql://testuser:testpassword@localhost:5432/test'
REDIS_URL: 'redis://localhost:6379/0'
ALGORITHM: "HS256"
SECRET_KEY: '1<3TwoTestThings!123456789'
strategy:
fail-fast: false
matrix:
include:
- test-type: unit
directory: backend
- test-type: integration
directory: backend
compose-file: 'test-integration.yml'
- test-type: e2e
directory: tests
compose-file: 'test.yml'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Verify Poetry Installation
run: poetry --version
- name: Install dependencies
run: |
poetry install
pip install coverage
if [ "${{ matrix.test-type }}" == "e2e" ]; then
poetry run playwright install chromium
fi
working-directory: "${{ github.workspace }}/${{ matrix.directory }}"
- name: Start Docker Compose services
if: matrix.compose-file != ''
run: docker compose -f "${{ github.workspace }}/${{ matrix.compose-file }}" up -d
- name: Run Tests
continue-on-error: true
run: |
poetry run pytest -m "${{ matrix.test-type }}" --cov=. --cov-report xml:coverage-${{ matrix.test-type }}.xml --junitxml=test-results-${{ matrix.test-type }}.xml || true
working-directory: "${{ github.workspace }}/${{ matrix.directory }}"
- name: Generate Test Report
uses: dorny/test-reporter@v1
if: always()
continue-on-error: true
with:
name: "PyTest Report - ${{ matrix.test-type }}"
path: "${{ github.workspace }}/${{ matrix.directory }}/test-results-${{ matrix.test-type }}.xml"
reporter: java-junit
- name: Publish coverage reports to Code Climate
uses: paambaati/codeclimate-action@v5
if: always() && github.actor != 'dependabot[bot]'
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
debug: true
coverageLocations: "${{ github.workspace }}/${{ matrix.directory }}/coverage-${{ matrix.test-type }}.xml:cobertura"
- name: Publish code coverage reports to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
if: always() && github.actor != 'dependabot[bot]'
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: "${{ github.workspace }}/${{ matrix.directory }}/coverage-${{ matrix.test-type }}.xml"
- name: Publish code coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
if: always() && github.actor != 'dependabot[bot]'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: "${{ github.workspace }}/${{ matrix.directory }}/coverage-${{ matrix.test-type }}.xml"
- name: Shutdown Docker Compose services
if: matrix.compose-file != ''
continue-on-error: true
run: docker compose -f "${{ github.workspace }}/${{ matrix.compose-file }}" down
permissions:
contents: read
actions: read
checks: write