Skip to content

Commit

Permalink
Merge pull request #899 from Aiven-Open/jjaakola-aiven-add-coverage-r…
Browse files Browse the repository at this point in the history
…eport

chore: add coverage report
  • Loading branch information
nosahama committed Jun 12, 2024
2 parents de5d51f + 41c87ff commit 38acabd
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
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

0 comments on commit 38acabd

Please sign in to comment.