Skip to content

[CI] Add test coverage reporting #142

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

Merged
merged 2 commits into from
Aug 7, 2025
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
33 changes: 29 additions & 4 deletions .github/workflows/pytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,38 @@ on:
- main
pull_request:


jobs:
test:
name: Run tests and collect coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Gardenlinux
uses: ./.github/actions/setup

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: poetry install --with dev

- name: Prepare environment
run: make install-test

- name: Run tests
run: |
run: |
export GLOCI_REGISTRY_TOKEN="invalid"
make test
make test-coverage-ci

- name: Check for report
run: test -f coverage.xml

- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ install-test: install-dev
test: install-test
$(POETRY) run pytest -k "not kms"

test-coverage: install-test
$(POETRY) run pytest -k "not kms" --cov=gardenlinux --cov-report=xml tests/

test-coverage-ci: install-test
$(POETRY) run pytest -k "not kms" --cov=gardenlinux --cov-report=xml --cov-fail-under=50 tests/

test-debug: install-test
$(POETRY) run pytest -k "not kms" -vvv -s

Expand Down
Loading