Skip to content

Commit 231cd6d

Browse files
committed
CI: Add coverage workflow
CI: Push pytest-cov run to Makefile CI: Temporarily lower failure threshhold to 50 CI: Update workflow to run on PRs and pushes
1 parent 8901e36 commit 231cd6d

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/coverage.yml

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