Skip to content

Commit a6cad14

Browse files
committed
Adds coverage on PR and also on commits to dev branch
1 parent 886f40d commit a6cad14

4 files changed

Lines changed: 33 additions & 3 deletions

File tree

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
name: Tests (PR to dev)
1+
name: CI pipeline
22

33
on:
44
pull_request:
55
branches:
66
- dev
7+
push:
8+
branches:
9+
- dev
710

811
jobs:
912
unit-tests:
@@ -26,7 +29,21 @@ jobs:
2629
python -m pip install --upgrade pip
2730
pip install -r requirements.txt -r requirements-test.txt
2831
29-
- name: Run unit tests
32+
- name: Run unit tests with coverage
3033
env:
3134
USE_REDIS: "false"
32-
run: python -m pytest tests/ -v
35+
run: |
36+
python -m pytest tests/ -v \
37+
--cov=ubiblio \
38+
--cov-report=term-missing \
39+
--cov-report=xml \
40+
--cov-report=html
41+
42+
- name: Upload coverage reports
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: coverage-reports
46+
path: |
47+
htmlcov/
48+
coverage.xml
49+
if-no-files-found: error

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ coverage.xml
5555
.pytest_cache/
5656
cover/
5757

58+
5859
# Translations
5960
*.mo
6061
*.pot

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[tool.coverage.run]
2+
source = ["ubiblio"]
3+
branch = true
4+
omit = [
5+
"*/tests/*",
6+
]
7+
8+
[tool.coverage.report]
9+
precision = 1
10+
show_missing = true
11+
skip_empty = true

requirements-test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
-r requirements.txt
22
pytest
33
httpx
4+
pytest-cov

0 commit comments

Comments
 (0)