diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 95a20c8b..8a91fdc7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,9 +14,12 @@ concurrency: env: DEFAULT_PYTHON: '3.13' + MIN_COVERAGE: 92 permissions: - contents: read + contents: write + checks: write + pull-requests: write jobs: oracle_tests: @@ -128,13 +131,32 @@ jobs: coverage combine coverage xml -o reports/coverage.xml -i - - 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: ./reports/coverage.xml - fail_ci_if_error: true - plugins: noop + pytest-xml-coverage-path: ./reports/coverage.xml + default-branch: develop + xml-skip-covered: true + report-only-changed-files: true + + + - name: Dynamic Badges + uses: schneegans/dynamic-badges-action@v1.7.0 + if: github.repository == 'MobileTeleSystems/syncmaster' && github.event_name == 'push' + with: + auth: ${{ secrets.AUTOMERGE_TOKEN }} + gistID: 03e73a82ecc4709934540ce8201cc3b4 + filename: syncmaster_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 1e65dcf9..09c9ca00 100644 --- a/README.rst +++ b/README.rst @@ -20,8 +20,9 @@ Data.SyncMaster :target: https://syncmaster.readthedocs.io .. |Build Status| image:: https://github.com/MobileTeleSystems/syncmaster/workflows/Run%20All%20Tests/badge.svg :target: https://github.com/MobileTeleSystems/syncmaster/actions -.. |Coverage| image:: https://codecov.io/gh/MobileTeleSystems/syncmaster/graph/badge.svg?token=ky7UyUxolB - :target: https://codecov.io/gh/MobileTeleSystems/syncmaster +.. |Coverage| image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/ + MTSOnGithub/03e73a82ecc4709934540ce8201cc3b4/raw/syncmaster_badge.json + :target: https://github.com/MobileTeleSystems/syncmaster/actions .. |pre-commit.ci| image:: https://results.pre-commit.ci/badge/github/MobileTeleSystems/syncmaster/develop.svg :target: https://results.pre-commit.ci/latest/github/MobileTeleSystems/syncmaster/develop diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index f70a6738..00000000 --- a/codecov.yml +++ /dev/null @@ -1,6 +0,0 @@ -coverage: - status: - project: - default: - target: 92% - threshold: 1%