From 212da4281ed8ba415731f5ac9d6267cfd4ae0d37 Mon Sep 17 00:00:00 2001 From: Hubert Kario Date: Fri, 22 Jan 2021 22:05:15 +0100 Subject: add testing condition coverage --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b707c3d..65a209b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,16 +166,16 @@ jobs: pip list pip install setuptools==28.8.0 wheel==0.30.0a0 - name: Install instrumental - if: ${{ contains(matrix.tox-env, 'instrumental') }} + if: ${{ contains(matrix.opt-deps, 'instrumental') }} run: pip install instrumental - name: Install gmpy if: ${{ contains(matrix.tox-env, 'gmpyp') }} run: pip install gmpy - name: Install gmpy2 dependencies - if: ${{ contains(matrix.tox-env, 'gmpy2') }} + if: ${{ contains(matrix.tox-env, 'gmpy2') || contains(matrix.tox-env, 'instrumental') }} run: sudo apt-get install -y libmpfr-dev libmpc-dev - name: Install gmpy2 - if: ${{ contains(matrix.tox-env, 'gmpy2') }} + if: ${{ contains(matrix.tox-env, 'gmpy2') || contains(matrix.tox-env, 'instrumental') }} run: pip install gmpy2 - name: Install build dependencies run: | @@ -200,6 +200,29 @@ jobs: - name: Run unit tests if: ${{ matrix.tox-env }} run: tox -e ${{ matrix.tox-env }} + - name: instrumental test coverage on PR + if: ${{ contains(matrix.opt-deps, 'instrumental') && github.event.pull_request }} + env: + BASE_REF: ${{ github.event.pull_request.base.ref }} + run: | + git fetch origin $BASE_REF + MERGE_BASE=$(git merge-base origin/$BASE_REF HEAD) + echo "MERGE_BASE:" $MERGE_BASE + git checkout $MERGE_BASE + instrumental -t ecdsa -i 'test.*|.*_version|.*_compat' `which pytest` src/ecdsa/test*.py + instrumental -f .instrumental.cov -s + instrumental -f .instrumental.cov -s | python diff-instrumental.py --save .diff-instrumental + git checkout $GITHUB_SHA + instrumental -t ecdsa -i 'test.*|.*_version|.*_compat' `which pytest` src/ecdsa/test*.py + instrumental -f .instrumental.cov -sr + instrumental -f .instrumental.cov -s | python diff-instrumental.py --read .diff-instrumental --fail-under 70 --max-difference -0.1 + - name: instrumental test coverage on push + if: ${{ contains(matrix.opt-deps, 'instrumental') && !github.event.pull_request }} + run: | + instrumental -t ecdsa -i 'test.*|.*_version|.*_compat' `which pytest` src/ecdsa + instrumental -f .instrumental.cov -s + # just log the values when merging + instrumental -f .instrumental.cov -s | python diff-instrumental.py - name: Publish coverage to Coveralls if: ${{ !matrix.opt-deps && matrix.tox-env != 'codechecks' }} env: -- cgit v1.2.1