forked from tlsfuzzer/python-ecdsa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
185 lines (180 loc) · 6.4 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# workaround for 3.7 not available in default configuration
# travis-ci/travis-ci#9815
dist: trusty
sudo: false
language: python
cache: pip
addons:
apt_packages:
# needed for gmpy and gmpy2
- libgmp-dev
- libmpfr-dev
- libmpc-dev
before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
# place the slowest (instrumental, mutation and py2.6) first
matrix:
include:
- python: 3.9
dist: bionic
sudo: true
env: MUTATION=yes
- python: 2.7
env: INSTRUMENTAL=yes
dist: bionic
sudo: true
- python: 2.6
env: TOX_ENV=py26
- python: 2.7
env: TOX_ENV=py27
- python: 2.7
env: TOX_ENV=py27_old_gmpy
- python: 2.7
env: TOX_ENV=py27_old_gmpy2
- python: 2.7
env: TOX_ENV=py27_old_six
- python: 2.7
env: TOX_ENV=gmpypy27
- python: 2.7
env: TOX_ENV=gmpy2py27
- python: 3.3
env: TOX_ENV=py33
- python: 3.4
env: TOX_ENV=py34
- python: 3.5
env: TOX_ENV=py35
- python: 3.6
env: TOX_ENV=py36
- python: 3.7
env: TOX_ENV=py37
dist: bionic
sudo: true
- python: 3.8
env: TOX_ENV=py38
dist: bionic
sudo: true
- python: 3.9
env: TOX_ENV=codechecks
dist: bionic
sudo: true
- python: 3.9
env: TOX_ENV=py39
dist: bionic
sudo: true
- python: 3.9
env: TOX_ENV=gmpypy39
dist: bionic
sudo: true
- python: 3.9
env: TOX_ENV=gmpy2py39
dist: bionic
sudo: true
- python: nightly
env: TOX_ENV=py
dist: bionic
sudo: true
- python: pypy
env: TOX_ENV=pypy
- python: pypy3
env: TOX_ENV=pypy3
# We use explicit version as the PATH needs major-minor part
- name: "Python3.8.0 on Windows"
os: windows
language: shell
before_install:
- choco install python --version 3.8.0
- python -m pip install --upgrade pip
env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
install:
- pip list
- pip install six
- pip install -r build-requirements.txt
- pip list
script:
- coverage run --branch -m pytest src/ecdsa
after_success:
- coveralls
allow_failures:
- python: nightly
# for instrumental we're checking if the coverage changed from base branch
# so collect that info
before_install:
- |
echo -e "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST\n" \
"TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG\n" \
"TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST\n" \
"TRAVIS_COMMIT=$TRAVIS_COMMIT\n" \
"TRAVIS_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION"
- |
# workaround https://github.com/travis-ci/travis-ci/issues/2666
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
URL="https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST}.patch"
# `--location` makes curl follow redirects
PR_FIRST=$(curl --silent --show-error --location $URL | head -1 | grep -o -E '\b[0-9a-f]{40}\b' | tr -d '\n')
TRAVIS_COMMIT_RANGE=$PR_FIRST^..$TRAVIS_COMMIT
fi
# sanity check current commit
- BRANCH=$(git rev-parse HEAD)
- echo "TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE"
- git fetch origin master:refs/remotes/origin/master
install:
- pip list
- |
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
- if [[ $TOX_ENV =~ gmpy2 ]] || [[ $INSTRUMENTAL ]] || [[ $MUTATION ]]; then travis_retry pip install gmpy2; fi
- if [[ $TOX_ENV =~ gmpyp ]]; then travis_retry pip install gmpy; fi
- if [[ $INSTRUMENTAL ]]; then travis_retry pip install instrumental; fi
- if [[ $MUTATION ]]; then travis_retry pip install cosmic-ray; fi
- pip list
script:
- if [[ $TOX_ENV ]]; then tox -e $TOX_ENV; fi
- if [[ $TOX_ENV =~ gmpy2 ]] && [[ -z $MUTATION ]]; then tox -e speedgmpy2; fi
- if [[ $TOX_ENV =~ gmpyp ]] && [[ -z $MUTATION ]]; then tox -e speedgmpy; fi
- if ! [[ $TOX_ENV =~ gmpy ]] && [[ -z $MUTATION ]]; then tox -e speed; fi
- |
if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
git checkout $PR_FIRST^
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 $BRANCH
instrumental -t ecdsa -i 'test.*|.*_version|.*_compat' `which pytest` src/ecdsa/test*.py
instrumental -f .instrumental.cov -sr
fi
- |
if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST == "false" ]]; then
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
fi
- |
if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
instrumental -f .instrumental.cov -s | python diff-instrumental.py --read .diff-instrumental --fail-under 70 --max-difference -0.1
fi
# cosmic-ray (mutation testing) runs
- if [[ $MUTATION ]]; then cosmic-ray init cosmic-ray.toml session.sqlite; fi
- if [[ $MUTATION ]]; then cosmic-ray baseline --report session.sqlite; fi
- if [[ $MUTATION ]]; then cr-report --show-output session.baseline.sqlite; fi
- |
if [[ $MUTATION ]]; then
cosmic-ray exec session.sqlite &
COSMIC_PID=$!
# make sure that we output something every 5 minutes (otherwise travis will kill us)
while kill -s 0 $COSMIC_PID; do
sleep 300
cr-report session.sqlite | tail -n 3;
done &
REPORT_PID=$!
# kill exec after 40 minutes
(sleep $((60*40)); kill $COSMIC_PID) &
fi
- if [[ $MUTATION ]]; then wait $COSMIC_PID ; kill $REPORT_PID ; true; fi
- if [[ $MUTATION ]]; then cr-report --show-output session.sqlite | tail -n 40; fi
- if [[ $MUTATION ]]; then cr-rate --estimate --fail-over 29 --confidence 99.9 session.sqlite; fi
after_success:
- if [[ -z $INSTRUMENTAL && -z $MUTATION ]]; then coveralls; fi