@@ -6,8 +6,11 @@ language: python
66cache : pip
77before_cache :
88 - rm -f $HOME/.cache/pip/log/debug.log
9+ # place the slowest (instrumental and py2.6) first
910matrix :
1011 include :
12+ - python : 2.7
13+ env : INSTRUMENTAL=yes
1114 - python : 2.6
1215 env : TOX_ENV=py26
1316 - python : 2.7
@@ -39,13 +42,68 @@ matrix:
3942 allow_failures :
4043 - python : nightly
4144
45+ # for instrumental we're checking if the coverage changed from base branch
46+ # so collect that info
47+ before_install :
48+ - |
49+ echo -e "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST\n" \
50+ "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG\n" \
51+ "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST\n" \
52+ "TRAVIS_COMMIT=$TRAVIS_COMMIT\n" \
53+ "TRAVIS_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION"
54+ - |
55+ # workaround https://github.com/travis-ci/travis-ci/issues/2666
56+ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
57+ URL="https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST}.patch"
58+ # `--location` makes curl follow redirects
59+ PR_FIRST=$(curl --silent --show-error --location $URL | head -1 | grep -o -E '\b[0-9a-f]{40}\b' | tr -d '\n')
60+ TRAVIS_COMMIT_RANGE=$PR_FIRST^..$TRAVIS_COMMIT
61+ fi
62+ # sanity check current commit
63+ - git rev-parse HEAD
64+ - echo "TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE"
65+ - git fetch origin master:refs/remotes/origin/master
66+
67+
4268install :
4369 - pip list
44- - if [[ -e build-requirements-${TRAVIS_PYTHON_VERSION}.txt ]]; then travis_retry pip install -r build-requirements-${TRAVIS_PYTHON_VERSION}.txt; else travis_retry pip install -r build-requirements.txt; fi
70+ - |
71+ if [[ -e build-requirements-${TRAVIS_PYTHON_VERSION}.txt ]]; then
72+ travis_retry pip install -r build-requirements-${TRAVIS_PYTHON_VERSION}.txt;
73+ else
74+ travis_retry pip install -r build-requirements.txt;
75+ fi
76+ - if [[ $INSTRUMENTAL ]]; then travis_retry pip install instrumental; fi
4577 - pip list
4678script :
47- - tox -e $TOX_ENV
79+ - if [[ $TOX_ENV ]]; then tox -e $TOX_ENV; fi
4880 - tox -e speed
81+ - cp diff-instrumental.py diff-instrumental-2.py
82+ - |
83+ if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
84+ git checkout $PR_FIRST^
85+ # exclude the super slow test_malformed_sigs.py, until #127 is merged
86+ files="$(ls src/ecdsa/test*.py | grep -v test_malformed_sigs.py)"
87+ instrumental -t ecdsa -i 'test.*|.*_version' `which pytest` $files
88+ instrumental -f .instrumental.cov -s
89+ instrumental -f .instrumental.cov -s | python diff-instrumental-2.py --save .diff-instrumental
90+ git checkout $TRAVIS_COMMIT
91+ instrumental -t ecdsa -i 'test.*|.*_version' `which pytest` $files
92+ instrumental -f .instrumental.cov -sr
93+ fi
94+ - |
95+ if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST == "false" ]]; then
96+ # exclude the super slow test_malformed_sigs.py, until #127 is merged
97+ files="$(ls src/ecdsa/test*.py | grep -v test_malformed_sigs.py)"
98+ instrumental -t ecdsa -i 'test.*|.*_version' `which pytest` $files
99+ instrumental -f .instrumental.cov -s
100+ # just log the values when merging
101+ instrumental -f .instrumental.cov -s | python diff-instrumental-2.py
102+ fi
103+ - |
104+ if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
105+ instrumental -f .instrumental.cov -s | python diff-instrumental-2.py --read .diff-instrumental --fail-under 70 --max-difference -0.1
106+ fi
49107after_success :
50- - coveralls
108+ - if [[ -z $INSTRUMENTAL ]]; then coveralls; fi
51109
0 commit comments