mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
Show test coverage in github pull request comment (#344)
This commit is contained in:
39
.github/workflows/test.yml
vendored
39
.github/workflows/test.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user