Skip to content

Commit 013abc7

Browse files
committed
Add code coverage
* Use coverage to generate the XML and report it with codecov * Add badge showing users code coverage at the top of the README
1 parent 1247f18 commit 013abc7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.github/workflows/ci.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
pip install ruff black
30+
pip install ruff black coverage codecov
3131
3232
- name: Lint with Ruff
3333
run: |
@@ -37,7 +37,13 @@ jobs:
3737
run: |
3838
black --check git_py_stats
3939
40-
- name: Run tests
40+
- name: Run tests with coverage
4141
run: |
42-
python -m unittest discover -s git_py_stats/tests
42+
coverage run -m unittest discover -s git_py_stats/tests
43+
coverage xml
4344
45+
- name: Upload coverage to Codecov
46+
uses: codecov/codecov-action@v4
47+
with:
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
file: coverage.xml

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<div align="center">
44

55
[![CI](https://github.com/tomice/git-py-stats/workflows/CI/badge.svg)](https://github.com/tomice/git-py-stats/actions)
6+
[![codecov](https://codecov.io/gh/tomice/git-py-stats/branch/main/graph/badge.svg)](https://codecov.io/gh/tomice/git-py-stats)
67
[![Ruff](https://img.shields.io/badge/linting-Ruff-green?logo=ruff)](https://docs.astral.sh/ruff/)
78
[![Black](https://img.shields.io/badge/code%20style-Black-000000.svg?logo=black)](https://black.readthedocs.io/en/stable/)
89
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

0 commit comments

Comments
 (0)