Skip to content

Commit

Permalink
chore: add coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaakola-aiven committed Jun 12, 2024
1 parent de5d51f commit 8b613ca
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
47 changes: 44 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
#python-version: [ '3.8', '3.9', '3.10', '3.11' ]
python-version: [ '3.10', '3.11']
env:
PYTEST_ADDOPTS: >-
--log-dir=/tmp/ci-logs
Expand All @@ -36,12 +37,52 @@ jobs:
python-version: ${{ matrix.python-version }}

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

- 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: coverate-*
merge-multiple: true

- 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 coment 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
8 changes: 8 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ integration-tests: karapace/version.py venv/.deps
$(PYTHON) -m pytest -s -vvv $(PYTEST_ARGS) tests/integration/
rm -fr runtime/*

.PHONY: unit-tests-coverage
unit-tests-coverage:
$(MAKE) PYTEST_ARGS="--cov=karapace --cov-append" unit-tests

.PHONY: integration-tests-coverage
integration-tests-coverage:
$(MAKE) PYTEST_ARGS="--cov=karapace --cov-append" integration-tests

.PHONY: clean
clean:
rm -fr ./kafka_* ./*.egg-info/ ./dist/ ./karapace/version.py
Expand Down

0 comments on commit 8b613ca

Please sign in to comment.