diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f70312..350e830 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,9 +14,12 @@ concurrency: env: DEFAULT_PYTHON: '3.13' + MIN_COVERAGE: 100 permissions: - contents: read + contents: write + checks: write + pull-requests: write jobs: tests: @@ -119,13 +122,32 @@ jobs: - name: Generate coverate reports run: ./combine_coverage.sh - - name: Check coverage - uses: codecov/codecov-action@v5 + - name: Coverage comment + id: coverage + uses: MishaKav/pytest-coverage-comment@v1 with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./reports/coverage.xml - fail_ci_if_error: true - plugin: noop + pytest-xml-coverage-path: ./reports/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/evacuator' && github.event_name == 'push' + with: + auth: ${{ secrets.AUTOMERGE_TOKEN }} + gistID: 03e73a82ecc4709934540ce8201cc3b4 + filename: evacuator_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 9cd3791..f7689e8 100644 --- a/README.rst +++ b/README.rst @@ -27,9 +27,9 @@ Evacuator .. |CI Status| image:: https://github.com/MobileTeleSystems/evacuator/workflows/Tests/badge.svg :alt: Github Actions - latest CI build status :target: https://github.com/MobileTeleSystems/evacuator/actions -.. |Test Coverage| image:: https://codecov.io/gh/MobileTeleSystems/evacuator/branch/develop/graph/badge.svg?token=CM6AQWY65P - :alt: Test coverage - percent - :target: https://codecov.io/gh/MobileTeleSystems/evacuator +.. |Test Coverage| image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/ + MTSOnGithub/03e73a82ecc4709934540ce8201cc3b4/raw/evacuator_badge.json + :target: https://github.com/MobileTeleSystems/evacuator/actions .. |pre-commit.ci Status| image:: https://results.pre-commit.ci/badge/github/MobileTeleSystems/evacuator/develop.svg :alt: pre-commit.ci - status :target: https://results.pre-commit.ci/latest/github/MobileTeleSystems/evacuator/develop diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 045842d..0000000 --- a/codecov.yml +++ /dev/null @@ -1,6 +0,0 @@ -coverage: - status: - project: - default: - target: 100% - threshold: 1%