Skip to content

Commit 0fa6e9c

Browse files
authored
ci: generate a code coverage badge (using coveralls.io) (#59)
1 parent 07c59d5 commit 0fa6e9c

5 files changed

Lines changed: 212 additions & 2 deletions

File tree

.github/workflows/validate-code.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name: verify pull request
88

99
on:
10-
push:
10+
pull_request:
1111

1212
# our tox configuration leverages pyenv to test on multiple Python versions.
1313
# It is unclear if we can leverage actions/setup-python@v4 to do the same.
@@ -68,6 +68,16 @@ jobs:
6868
if [[ -n $CONTRIB_FILES ]] ; then
6969
pdm run mypy $CONTRIB_FILES
7070
fi
71+
- name: generate coverage report
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
run: |
75+
pdm run coverage run --source=feeph.i2c -m pytest tests/
76+
pdm run coveralls
77+
mkdir -p coverage
78+
pdm run coverage-lcov --output_file_path=coverage/lcov.info
79+
- name: coveralls action
80+
uses: coverallsapp/github-action@v2
7181
test:
7282
name: perform unit tests
7383
# wait on linting results; makes no sense to test if the code is broken

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)
44
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
5+
[![Coverage Status](https://coveralls.io/repos/github/feeph/libi2c-python/badge.svg)](https://coveralls.io/github/feeph/libi2c-python)
56
[![pdm-managed](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://pdm-project.org)
67
[![tox](https://img.shields.io/badge/tox-ab79d2)](https://tox.wiki/)
78

pdm.lock

Lines changed: 133 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ tools = [
100100
"autopep8 ~= 2.2",
101101
"copier ~= 9.3",
102102
"coverage-lcov ~= 0.3",
103+
"coveralls ~= 4.0",
103104
"flake8 ~= 7.0",
104105
"mypy ~= 1.10",
105106
"pylint ~= 3.2",

0 commit comments

Comments
 (0)