diff options
-rw-r--r-- | .github/workflows/coverage.yml | 18 | ||||
-rw-r--r-- | README.rst | 4 |
2 files changed, 20 insertions, 2 deletions
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 0a3fba69..4db18278 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -140,7 +140,7 @@ jobs: name: json_report path: coverage.json - - name: "Create info for pushing to report repo" + - name: "Create info for later steps" id: info run: | export SHA10=$(echo ${{ github.sha }} | cut -c 1-10) @@ -150,6 +150,11 @@ jobs: echo "::set-output name=slug::$SLUG" echo "::set-output name=url::https://nedbat.github.io/coverage-reports/reports/$SLUG/htmlcov" echo "::set-output name=branch::${REF#refs/heads/}" + export PCTINT=$(echo ${{ steps.combine.outputs.total }} | cut -f1 -d.) + if (($PCTINT >= 85)); then echo "::set-output name=badgecolor::green"; fi + if (($PCTINT < 85)); then echo "::set-output name=badgecolor::yellow"; fi + if (($PCTINT < 70)); then echo "::set-output name=badgecolor::orange"; fi + if (($PCTINT < 60)); then echo "::set-output name=badgecolor::red"; fi - name: "Push to report repository" uses: sebastian-palma/github-action-push-to-another-repository@allow-creating-destination-directory @@ -187,3 +192,14 @@ jobs: - name: "Show link to report" run: | echo "Coverage report: ${{ steps.info.outputs.url }}" + + - name: "Create badge" + # https://gist.githubusercontent.com/nedbat/8c6980f77988a327348f9b02bbaf67f5 + uses: schneegans/dynamic-badges-action@v1.1.0 + with: + auth: ${{ secrets.METACOV_GIST_SECRET }} + gistID: 8c6980f77988a327348f9b02bbaf67f5 + filename: metacov.json + label: Coverage + message: ${{ steps.combine.outputs.total }}% + color: ${{ steps.info.outputs.badgecolor }} @@ -8,7 +8,7 @@ Coverage.py Code coverage testing for Python. | |license| |versions| |status| -| |test-status| |quality-status| |docs| +| |test-status| |quality-status| |docs| |metacov| | |kit| |downloads| |format| |repos| | |stars| |forks| |contributors| | |tidelift| |twitter-coveragepy| |twitter-nedbat| @@ -122,6 +122,8 @@ Licensed under the `Apache 2.0 License`_. For details, see `NOTICE.txt`_. :target: https://pypi.org/project/coverage/ :alt: License .. |metacov| image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/nedbat/8c6980f77988a327348f9b02bbaf67f5/raw/metacov.json + :target: https://github.com/nedbat/coverage-reports/commits/main + :alt: Coverage reports .. |repos| image:: https://repology.org/badge/tiny-repos/python:coverage.svg :target: https://repology.org/project/python:coverage/versions :alt: Packaging status |