From fd3767efeb546d115ee2c347529fc1d0d36e3a8c Mon Sep 17 00:00:00 2001 From: Marat Akhmetov Date: Tue, 9 Sep 2025 12:57:19 +0300 Subject: [PATCH] replaced codecov with pytest-cov --- .github/workflows/test.yml | 36 +++++++++++++++++++++++++++++------- README.rst | 6 +++--- codecov.yml | 6 ------ 3 files changed, 32 insertions(+), 16 deletions(-) delete mode 100644 codecov.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 47c54b94..c0a220ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,9 +14,12 @@ concurrency: env: DEFAULT_PYTHON: '3.13' + MIN_COVERAGE: 93 permissions: - contents: read + contents: write + checks: write + pull-requests: write jobs: tests: @@ -169,13 +172,32 @@ jobs: coverage combine coverage-data/* coverage xml -o combined_coverage.xml - - name: Check Coverage - uses: codecov/codecov-action@v5 + - name: Coverage comment + id: coverage + uses: MishaKav/pytest-coverage-comment@v1 with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./combined_coverage.xml - fail_ci_if_error: true - plugins: noop + pytest-xml-coverage-path: ./combined_coverage.xml + default-branch: develop + xml-skip-covered: true + report-only-changed-files: true + hide-comment: ${{ github.event_name != 'pull_request' }} + + - name: Dynamic Badges + uses: schneegans/dynamic-badges-action@v1.7.0 + if: github.repository == 'MobileTeleSystems/horizon' && github.event_name == 'push' + with: + auth: ${{ secrets.AUTOMERGE_TOKEN }} + gistID: 03e73a82ecc4709934540ce8201cc3b4 + filename: horizon_badge.json + label: Coverage + message: ${{ steps.coverage.outputs.coverage }} + color: ${{ steps.coverage.outputs.color }} + + - name: Fail if coverage too low + if: ${{ steps.coverage.outputs.coverage < env.MIN_COVERAGE }} + run: | + echo "Coverage is below ${{ env.MIN_COVERAGE }}%!" + exit 1 - name: All done run: echo 1 diff --git a/README.rst b/README.rst index f9e12bea..e05be97d 100644 --- a/README.rst +++ b/README.rst @@ -30,9 +30,9 @@ Data.Horizon .. |CI Status| image:: https://github.com/MobileTeleSystems/horizon/workflows/Tests/badge.svg :alt: Github Actions - latest CI build status :target: https://github.com/MobileTeleSystems/horizon/actions -.. |Test Coverage| image:: https://codecov.io/gh/MobileTeleSystems/horizon/branch/develop/graph/badge.svg?token=BIRWPTWEE0 - :alt: Test coverage - percent - :target: https://codecov.io/gh/MobileTeleSystems/horizon +.. |Test Coverage| image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/ + MTSOnGithub/03e73a82ecc4709934540ce8201cc3b4/raw/horizon_badge.json + :target: https://github.com/MobileTeleSystems/horizon/actions .. |pre-commit.ci Status| image:: https://results.pre-commit.ci/badge/github/MobileTeleSystems/horizon/develop.svg :alt: pre-commit.ci - status :target: https://results.pre-commit.ci/latest/github/MobileTeleSystems/horizon/develop diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index c12fe6e6..00000000 --- a/codecov.yml +++ /dev/null @@ -1,6 +0,0 @@ -coverage: - status: - project: - default: - target: 90% - threshold: 1%