@@ -166,16 +166,16 @@ jobs:
166166 pip list
167167 pip install setuptools==28.8.0 wheel==0.30.0a0
168168 - name : Install instrumental
169- if : ${{ contains(matrix.tox-env , 'instrumental') }}
169+ if : ${{ contains(matrix.opt-deps , 'instrumental') }}
170170 run : pip install instrumental
171171 - name : Install gmpy
172172 if : ${{ contains(matrix.tox-env, 'gmpyp') }}
173173 run : pip install gmpy
174174 - name : Install gmpy2 dependencies
175- if : ${{ contains(matrix.tox-env, 'gmpy2') }}
175+ if : ${{ contains(matrix.tox-env, 'gmpy2') || contains(matrix.tox-env, 'instrumental') }}
176176 run : sudo apt-get install -y libmpfr-dev libmpc-dev
177177 - name : Install gmpy2
178- if : ${{ contains(matrix.tox-env, 'gmpy2') }}
178+ if : ${{ contains(matrix.tox-env, 'gmpy2') || contains(matrix.tox-env, 'instrumental') }}
179179 run : pip install gmpy2
180180 - name : Install build dependencies
181181 run : |
@@ -200,6 +200,29 @@ jobs:
200200 - name : Run unit tests
201201 if : ${{ matrix.tox-env }}
202202 run : tox -e ${{ matrix.tox-env }}
203+ - name : instrumental test coverage on PR
204+ if : ${{ contains(matrix.opt-deps, 'instrumental') && github.event.pull_request }}
205+ env :
206+ BASE_REF : ${{ github.event.pull_request.base.ref }}
207+ run : |
208+ git fetch origin $BASE_REF
209+ MERGE_BASE=$(git merge-base origin/$BASE_REF HEAD)
210+ echo "MERGE_BASE:" $MERGE_BASE
211+ git checkout $MERGE_BASE
212+ instrumental -t ecdsa -i 'test.*|.*_version|.*_compat' `which pytest` src/ecdsa/test*.py
213+ instrumental -f .instrumental.cov -s
214+ instrumental -f .instrumental.cov -s | python diff-instrumental.py --save .diff-instrumental
215+ git checkout $GITHUB_SHA
216+ instrumental -t ecdsa -i 'test.*|.*_version|.*_compat' `which pytest` src/ecdsa/test*.py
217+ instrumental -f .instrumental.cov -sr
218+ instrumental -f .instrumental.cov -s | python diff-instrumental.py --read .diff-instrumental --fail-under 70 --max-difference -0.1
219+ - name : instrumental test coverage on push
220+ if : ${{ contains(matrix.opt-deps, 'instrumental') && !github.event.pull_request }}
221+ run : |
222+ instrumental -t ecdsa -i 'test.*|.*_version|.*_compat' `which pytest` src/ecdsa
223+ instrumental -f .instrumental.cov -s
224+ # just log the values when merging
225+ instrumental -f .instrumental.cov -s | python diff-instrumental.py
203226 - name : Publish coverage to Coveralls
204227 if : ${{ !matrix.opt-deps && matrix.tox-env != 'codechecks' }}
205228 env :
0 commit comments