Skip to content

Commit 751a5f9

Browse files
committed
CHORE: Code coverage reports
- Create code coverage reports with pytest-cov. - Configured CI for Codecov reports.
1 parent 19cef80 commit 751a5f9

File tree

6 files changed

+132
-9
lines changed

6 files changed

+132
-9
lines changed

.github/workflows/codecov.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Codecov workflow"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Install Poetry
19+
run: pip3 install poetry
20+
21+
- name: Setup Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: "3.9"
25+
26+
- name: Install dependencies
27+
run: |
28+
poetry install
29+
30+
- name: Run tests
31+
run: |
32+
poetry run gird test
33+
34+
- name: Upload coverage reports to Codecov
35+
uses: codecov/codecov-action@v3

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.idea
22
dist
3-
.gird
43
test/benchmark/.cache
5-
test/benchmark/tmp
4+
test/benchmark/tmp
5+
.coverage
6+
coverage.xml

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ WHEEL_PATH = get_wheel_path()
6161

6262
RULE_PYTEST = rule(
6363
target=Phony("pytest"),
64-
recipe="pytest -n auto",
65-
help="Run pytest.",
64+
recipe="pytest -n auto --cov=gird --cov-report=xml",
65+
help="Run pytest & get code coverage report.",
6666
)
6767

6868
RULE_CHECK_FORMATTING = rule(
@@ -120,13 +120,13 @@ Respective output from `gird list`:
120120

121121
```
122122
pytest
123-
Run pytest.
123+
Run pytest & get code coverage report.
124124
check_formatting
125125
Check formatting with Black & isort.
126126
check_readme_updated
127127
Check that README.md is updated based on README_template.md.
128128
test
129-
- Run pytest.
129+
- Run pytest & get code coverage report.
130130
- Check formatting with Black & isort.
131131
- Check that README.md is updated based on README_template.md.
132132
README.md

girdfile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
RULE_PYTEST = rule(
1010
target=Phony("pytest"),
11-
recipe="pytest -n auto",
12-
help="Run pytest.",
11+
recipe="pytest -n auto --cov=gird --cov-report=xml",
12+
help="Run pytest & get code coverage report.",
1313
)
1414

1515
RULE_CHECK_FORMATTING = rule(

poetry.lock

+87-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jinja2 = "^3.1.2"
2525
twine = "^4.0.2"
2626
tomli = "^2.0.1"
2727
pytest-xdist = "^3.2.0"
28+
pytest-cov = "^4.0.0"
2829

2930
[tool.isort]
3031
profile = "black"

0 commit comments

Comments
 (0)