Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add coverage report #899

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
branch = True
relative_files = True
source = karapace
46 changes: 45 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,55 @@ jobs:

- run: make install version
- run: make unit-tests
- run: make integration-tests PYTEST_ARGS="--random-order"
env:
COVERAGE_FILE: ".coverage.${{ matrix.python-version }}"
PYTEST_ARGS: "--cov=karapace --cov-append"
- run: make integration-tests
env:
COVERAGE_FILE: ".coverage.${{ matrix.python-version }}"
PYTEST_ARGS: "--cov=karapace --cov-append --random-order"

- name: Archive logs
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: karapace-integration-test-logs-${{ matrix.python-version }}
path: /tmp/ci-logs
- name: Archive coverage file
uses: actions/upload-artifact@v4
with:
name: "coverage-${{ matrix.python-version }}"
path: ".coverage.${{ matrix.python-version }}"

coverage:
name: Coverage report
runs-on: ubuntu-latest
needs: tests
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4

- name: Download coverage
id: download_coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true

- run: make karapace/version.py

- name: Post coverage comment
id: post_coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_COVERAGE_FILES: true

- name: Store PR comment to be posted
uses: actions/upload-artifact@v4
if: steps.post_coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt
1 change: 1 addition & 0 deletions requirements/requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pdbpp
# testing
filelock
pytest
pytest-cov
pytest-xdist[psutil]
pytest-timeout
pytest-random-order
Expand Down
6 changes: 6 additions & 0 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ configargparse==1.7
# via locust
confluent-kafka==2.3.0
# via -r requirements.txt
coverage[toml]==7.5.3
# via pytest-cov
cramjam==2.8.3
# via
# -r requirements.txt
Expand Down Expand Up @@ -176,9 +178,12 @@ pyrepl==0.9.0
pytest==8.2.2
# via
# -r requirements-dev.in
# pytest-cov
# pytest-random-order
# pytest-timeout
# pytest-xdist
pytest-cov==5.0.0
# via -r requirements-dev.in
pytest-random-order==1.1.1
# via -r requirements-dev.in
pytest-timeout==2.3.1
Expand Down Expand Up @@ -227,6 +232,7 @@ tenacity==8.3.0
# via -r requirements.txt
tomli==2.0.1
# via
# coverage
# locust
# pytest
typing-extensions==4.12.1
Expand Down
Loading