diff options
author | Hubert Kario <hkario@redhat.com> | 2022-06-10 13:06:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-10 13:06:48 +0200 |
commit | 522f48041ed518774aee34c8696fce58e2fc3b1c (patch) | |
tree | 7617e751d1dc88edda8e1ef8885c9346b7d5627f | |
parent | 31c062e94890a5e332abb8693efba86bd6a91580 (diff) | |
parent | c3f973e5fc27c8f17c6181378b91d05495dd89ac (diff) | |
download | ecdsa-522f48041ed518774aee34c8696fce58e2fc3b1c.tar.gz |
Merge pull request #299 from tlsfuzzer/condition-coverage
add automatic condition coverage badge
-rw-r--r-- | .github/workflows/ci.yml | 16 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | diff-instrumental.py | 10 |
3 files changed, 25 insertions, 3 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4592039..ccafe09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,6 +154,9 @@ jobs: run: | apt-get update apt-get install -y git make python-is-python3 python3 curl wget python3-distutils python3-pip + - name: workaround git failures with py3.10 + run: | + git config --global --add safe.directory /__w/python-ecdsa/python-ecdsa - name: Verify git status run: | git status @@ -292,6 +295,19 @@ jobs: instrumental -f .instrumental.cov -s # just log the values when merging instrumental -f .instrumental.cov -s | python diff-instrumental.py + echo "COND_COV=$(instrumental -f .instrumental.cov -s | python diff-instrumental.py --raw)" >> $GITHUB_ENV + - name: Create condition coverage badge + uses: schneegans/dynamic-badges-action@v1.4.0 + if: ${{ contains(matrix.opt-deps, 'instrumental') && !github.event.pull_request }} + with: + auth: ${{ secrets.GIST_SECRET }} + gistID: 9b6ca1f3410207fbeca785a178781651 + filename: python-ecdsa-condition-coverage.json + label: condition coverage + message: ${{ env.COND_COV }}% + valColorRange: ${{ env.COND_COV }} + maxColorRange: 100 + minColorRange: 0 - name: Publish coverage to Coveralls if: ${{ !matrix.opt-deps && matrix.tox-env != 'codechecks' }} env: @@ -3,7 +3,7 @@ [![Build Status](https://github.com/tlsfuzzer/python-ecdsa/workflows/GitHub%20CI/badge.svg?branch=master)](https://github.com/tlsfuzzer/python-ecdsa/actions?query=workflow%3A%22GitHub+CI%22+branch%3Amaster) [![Documentation Status](https://readthedocs.org/projects/ecdsa/badge/?version=latest)](https://ecdsa.readthedocs.io/en/latest/?badge=latest) [![Coverage Status](https://coveralls.io/repos/github/tlsfuzzer/python-ecdsa/badge.svg?branch=master)](https://coveralls.io/github/tlsfuzzer/python-ecdsa?branch=master) -[![condition coverage](https://img.shields.io/badge/condition%20coverage-87%25-yellow)](https://travis-ci.com/github/tlsfuzzer/python-ecdsa/jobs/458951056#L544) +![condition coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tomato42/9b6ca1f3410207fbeca785a178781651/raw/python-ecdsa-condition-coverage.json) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/tlsfuzzer/python-ecdsa.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tlsfuzzer/python-ecdsa/context:python) [![Total alerts](https://img.shields.io/lgtm/alerts/g/tlsfuzzer/python-ecdsa.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tlsfuzzer/python-ecdsa/alerts/) [![Latest Version](https://img.shields.io/pypi/v/ecdsa.svg?style=flat)](https://pypi.python.org/pypi/ecdsa/) diff --git a/diff-instrumental.py b/diff-instrumental.py index d8fe376..0cac042 100644 --- a/diff-instrumental.py +++ b/diff-instrumental.py @@ -6,11 +6,12 @@ fail_under = None max_difference = 0 read_location = None save_location = None +raw = False argv = sys.argv[1:] opts, args = getopt.getopt( - argv, "s:r:", ["fail-under=", "max-difference=", "save=", "read="] + argv, "s:r:", ["fail-under=", "max-difference=", "save=", "read=", "raw"] ) if args: raise ValueError("Unexpected parameters: {0}".format(args)) @@ -23,6 +24,8 @@ for opt, arg in opts: fail_under = float(arg) / 100.0 elif opt == "--max-difference": max_difference = float(arg) / 100.0 + elif opt == "--raw": + raw = True else: raise ValueError("Unknown option: {0}".format(opt)) @@ -49,7 +52,10 @@ if save_location: with open(save_location, "w") as f: f.write("{0:1.40f}".format(coverage)) -print("Coverage: {0:6.2f}%".format(coverage * 100)) +if raw: + print("{0:6.2f}".format(coverage * 100)) +else: + print("Coverage: {0:6.2f}%".format(coverage * 100)) if read_location: print("Difference: {0:6.2f}%".format((old_coverage - coverage) * 100)) |