Skip to content

Commit c2c782d

Browse files
committed
CI: Add coverage workflow
CI: Push pytest-cov run to Makefile CI: Temporarily lower failure threshhold to 50
1 parent e812bf7 commit c2c782d

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Run tests and upload coverage
2+
3+
on:
4+
push
5+
6+
jobs:
7+
test:
8+
name: Run tests and collect coverage
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 2
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.13'
20+
21+
- name: Install Poetry
22+
uses: snok/install-poetry@v1
23+
24+
- name: Install dependencies
25+
run: poetry install --with dev
26+
27+
- name: Setup Gardenlinux
28+
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main
29+
30+
- name: Prepare environment
31+
run: make install-test
32+
33+
- name: Run tests
34+
run: make test-coverage-ci
35+
36+
- name: Check for report
37+
run: test -f coverage.xml
38+
39+
- name: Upload results to Codecov
40+
uses: codecov/codecov-action@v5
41+
with:
42+
token: ${{ secrets.CODECOV_TOKEN }}

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ install-test: install-dev
4646
test: install-test
4747
$(POETRY) run pytest -k "not kms"
4848

49+
test-coverage: install-test
50+
$(POETRY) run pytest -k "not kms" --cov=gardenlinux --cov-report=xml tests/
51+
52+
test-coverage-ci: install-test
53+
$(POETRY) run pytest -k "not kms" --cov=gardenlinux --cov-report=xml --cov-fail-under=50 tests/
54+
4955
test-debug: install-test
5056
$(POETRY) run pytest -k "not kms" -vvv -s
5157

0 commit comments

Comments
 (0)