Skip to content

Commit ab91445

Browse files
marashkaMarat Akhmetov
andauthored
[DOP-23126] added basic pytest-coverage-comment (#257)
* [DOP-23126] added pytest-coverage-comment --------- Co-authored-by: Marat Akhmetov <[email protected]>
1 parent dabf1cb commit ab91445

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

.github/workflows/tests.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ concurrency:
1414

1515
env:
1616
DEFAULT_PYTHON: '3.13'
17+
MIN_COVERAGE: 92
1718

1819
permissions:
19-
contents: read
20+
contents: write
21+
checks: write
22+
pull-requests: write
2023

2124
jobs:
2225
oracle_tests:
@@ -128,13 +131,32 @@ jobs:
128131
coverage combine
129132
coverage xml -o reports/coverage.xml -i
130133
131-
- name: Check coverage
132-
uses: codecov/codecov-action@v5
134+
- name: Coverage comment
135+
id: coverage
136+
uses: MishaKav/pytest-coverage-comment@v1
133137
with:
134-
token: ${{ secrets.CODECOV_TOKEN }}
135-
files: ./reports/coverage.xml
136-
fail_ci_if_error: true
137-
plugins: noop
138+
pytest-xml-coverage-path: ./reports/coverage.xml
139+
default-branch: develop
140+
xml-skip-covered: true
141+
report-only-changed-files: true
142+
143+
144+
- name: Dynamic Badges
145+
uses: schneegans/[email protected]
146+
if: github.repository == 'MobileTeleSystems/syncmaster' && github.event_name == 'push'
147+
with:
148+
auth: ${{ secrets.AUTOMERGE_TOKEN }}
149+
gistID: 03e73a82ecc4709934540ce8201cc3b4
150+
filename: syncmaster_badge.json
151+
label: Coverage
152+
message: ${{ steps.coverage.outputs.coverage }}
153+
color: ${{ steps.coverage.outputs.color }}
154+
155+
- name: Fail if coverage too low
156+
if: ${{ steps.coverage.outputs.coverage < env.MIN_COVERAGE }}
157+
run: |
158+
echo "Coverage is below ${{ env.MIN_COVERAGE }}%!"
159+
exit 1
138160
139161
- name: All done
140162
run: echo 1

README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ Data.SyncMaster
2020
:target: https://syncmaster.readthedocs.io
2121
.. |Build Status| image:: https://github.com/MobileTeleSystems/syncmaster/workflows/Run%20All%20Tests/badge.svg
2222
:target: https://github.com/MobileTeleSystems/syncmaster/actions
23-
.. |Coverage| image:: https://codecov.io/gh/MobileTeleSystems/syncmaster/graph/badge.svg?token=ky7UyUxolB
24-
:target: https://codecov.io/gh/MobileTeleSystems/syncmaster
23+
.. |Coverage| image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/
24+
MTSOnGithub/03e73a82ecc4709934540ce8201cc3b4/raw/syncmaster_badge.json
25+
:target: https://github.com/MobileTeleSystems/syncmaster/actions
2526
.. |pre-commit.ci| image:: https://results.pre-commit.ci/badge/github/MobileTeleSystems/syncmaster/develop.svg
2627
:target: https://results.pre-commit.ci/latest/github/MobileTeleSystems/syncmaster/develop
2728

codecov.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)