@@ -6,8 +6,11 @@ language: python
6
6
cache : pip
7
7
before_cache :
8
8
- rm -f $HOME/.cache/pip/log/debug.log
9
+ # place the slowest (instrumental and py2.6) first
9
10
matrix :
10
11
include :
12
+ - python : 2.7
13
+ env : INSTRUMENTAL=yes
11
14
- python : 2.6
12
15
env : TOX_ENV=py26
13
16
- python : 2.7
@@ -29,13 +32,48 @@ matrix:
29
32
- python : pypy3
30
33
env : TOX_ENV=pypy3
31
34
35
+ # for instrumental we're checking if the coverage changed from base branch
36
+ # so collect that info
37
+ before_install :
38
+ - |
39
+ echo -e "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST\n" \
40
+ "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG\n" \
41
+ "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST\n" \
42
+ "TRAVIS_COMMIT=$TRAVIS_COMMIT\n" \
43
+ "TRAVIS_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION"
44
+ - |
45
+ # workaround https://github.com/travis-ci/travis-ci/issues/2666
46
+ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
47
+ URL="https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST}.patch"
48
+ # `--location` makes curl follow redirects
49
+ PR_FIRST=$(curl --silent --show-error --location $URL | head -1 | grep -o -E '\b[0-9a-f]{40}\b' | tr -d '\n')
50
+ TRAVIS_COMMIT_RANGE=$PR_FIRST^..$TRAVIS_COMMIT
51
+ fi
52
+ # sanity check current commit
53
+ - git rev-parse HEAD
54
+ - echo "TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE"
55
+ - git fetch origin master:refs/remotes/origin/master
56
+
57
+
32
58
install :
33
59
- pip list
34
60
- 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
61
+ - if [[ $INSTRUMENTAL ]]; then travis_retry pip install instrumental; fi
35
62
- pip list
36
63
script :
37
- - tox -e $TOX_ENV
64
+ - if [[ $TOX_ENV ]]; then tox -e $TOX_ENV; fi
38
65
- tox -e speed
66
+ - |
67
+ if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
68
+ git checkout $PR_FIRST^
69
+ instrumental -t ecdsa -i 'test.*|_version' python -m pytest src
70
+ instrumental -f .instrumental.cov -s
71
+ instrumental -f .instrumental.cov -s | python diff-instrumental.py --save .diff-instrumental
72
+ git checkout $TRAVIS_COMMIT
73
+ instrumental -t ecdsa -i 'test.*|_version' python -m pytest src
74
+ instrumental -f .instrumental.cov -sr
75
+ instrumental -f .instrumental.cov -s | python diff-instrumental.py --read .diff-instrumental --fail-under 70 --max-difference 0.1
76
+ fi
39
77
after_success :
40
78
- coveralls
41
79
0 commit comments