Skip to content

Commit 7b01847

Browse files
authored
Merge pull request #28 from Shiphero/19-implement-coverage-in-ci
add coverage and action to have coverage on PR
2 parents 56f3837 + 015ad9c commit 7b01847

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

.github/workflows/pytest.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: tests
22
on:
33
pull_request:
44
branches:
5-
- main
5+
- '*'
66
push:
77
branches:
88
- main
@@ -26,6 +26,28 @@ jobs:
2626
run: |
2727
python -m pip install --upgrade pip
2828
pip install -e .[dev]
29-
- name: Test with pytest
29+
- name: Build coverage file
3030
run: |
31-
pytest
31+
pytest --junitxml=pytest.xml --cov-report "xml:coverage.xml" --cov=shbin tests/
32+
33+
- name: Pytest coverage comment
34+
uses: MishaKav/pytest-coverage-comment@main
35+
with:
36+
hide-report: false
37+
pytest-xml-coverage-path: coverage.xml
38+
junitxml-path: pytest.xml
39+
- name: Check the output coverage
40+
run: |
41+
echo "Coverage Percantage - ${{ steps.coverageComment.outputs.coverage }}"
42+
echo "Coverage Color - ${{ steps.coverageComment.outputs.color }}"
43+
echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}"
44+
echo "Summary Report - ${{ steps.coverageComment.outputs.summaryReport }}"
45+
46+
echo "Coverage Warnings - ${{ steps.coverageComment.outputs.warnings }}"
47+
48+
echo "Coverage Errors - ${{ steps.coverageComment.outputs.errors }}"
49+
echo "Coverage Failures - ${{ steps.coverageComment.outputs.failures }}"
50+
echo "Coverage Skipped - ${{ steps.coverageComment.outputs.skipped }}"
51+
echo "Coverage Tests - ${{ steps.coverageComment.outputs.tests }}"
52+
echo "Coverage Time - ${{ steps.coverageComment.outputs.time }}"
53+
echo "Not Success Test Info - ${{ steps.coverageComment.outputs.notSuccessTestInfo }}"

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ shbin = "shbin:main"
3838
[project.optional-dependencies]
3939
dev = [
4040
"pytest",
41-
"black"
41+
"black",
42+
"pytest-cov",
43+
"flake8",
4244
]
4345

4446
[tool.black]

0 commit comments

Comments
 (0)