Show test coverage in github pull request comment (#344)

This commit is contained in:
Stan Triepels
2026-08-14 17:26:55 +02:00
committed by GitHub
parent 9e576b85e6
commit fa935f89ab

View File

@@ -7,6 +7,11 @@ on:
branches:
- master
# for code coverage comment
permissions:
contents: read
pull-requests: write
env:
MONGO_HOST: "127.0.0.1"
REDIS_HOST: "127.0.0.1"
@@ -83,11 +88,6 @@ jobs:
env:
SERVICES: sqs
MINISTACK_HOST: aws
# options: >-
# --health-cmd "wget -qO- http://localhost:4566/_ministack/ready || exit 1"
# --health-interval 2s
# --health-retries 15
# --health-timeout 5s
ports:
- 4566:4566
steps:
@@ -105,25 +105,12 @@ jobs:
run: aws sqs create-queue --queue-name testing
- name: Run Tests
run: |
uv run pytest --cov=./django_q --cov-report=xml
- name: Upload to coveralls
run: |
python -m pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}-django-${{ matrix.django }}
COVERALLS_PARALLEL: true
uv run pytest --cov=./django_q --cov-report=xml --junitxml=pytest.xml --cov-report=term-missing:skip-covered | tee pytest-coverage.txt
finish:
needs: test
runs-on: ubuntu-latest
container: python:3.11-bookworm
steps:
- name: Upload to coveralls
run: |
python -m pip install --upgrade pip
python -m pip install coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coverage comment
if: matrix.python-version == '3.13' && matrix.django == '5.2' && github.event_name == 'pull_request'
uses: MishaKav/pytest-coverage-comment@v1
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
report-only-changed-files: true