forked from Backblaze/B2_Command_Line_Tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
246 lines (227 loc) · 9.79 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
notifications:
slack:
secure: naix0bLa/50X1HIXwLtkUC/YH9Iurs18eVy/mhfrfD2YFd7QjUGRz24SQU2r0ev0Qh3CUaH9MJoAUbu4oaXGB1VXzZkV7OIGimZe4gcWJuzItnVhyrQJKpcpC7yafdl7uDA0wjWs2BYRHCJ3c35Gv4SmihuGVXUS3WFsL0i3VyXno8xPOfmyuUT7GZWW80uMnV6eOyhbPCBb17CchI8x7owdXVf3drxCrrjoP3oNbbpByTsDC+hnCmVQbhkZAqS63gZRj5LT6gNh4ZA/qenaGkhzfHFRSUW1+H16ZzYcSSl0PfAQBQYrc7agUjI987PBHdOv6BJS+pKmZ0MvaDwbnzhHZZdb8LXqM5K0zAhPiZMPL2MTq7+eNOBdRuTlbWs3OZfbY1cnewSpMmUGfwrIjVnLtvfhfJXVaFbpIfvNc6eafgmHas23A05f4Gk/IcRLvqICw+GQg76ADUpWubQal7gECTGbeivOdRLnQcQYWCg/a5VR5B+4ELENmWLRD7IQgo6rJKpPiRdGRc0C0E9Mqt3w7w+9NiDnjTbSu8Q6ARBLXjAu+jSbY1VK0iPq6k1Wj8U5EgQF/xVLCEtKDRW1bdllwWNgi2yPo1CrkgKmJj6XPU3Zc744NR85uC+PxAjkIIbm90joevPmUQGwkpAgVX2pxCjVAX6ynQ79TFfdd/Y=
#dist: trusty # on 2016-12-13 pypy builds were broken on trusty, so we'll stick to stable for now
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
- 3.7
- 3.8
# stock versions of pypy provided by Travis CI don't work with cryptography 1.0
#- pypy
#- pypy3
branches:
# https://github.com/travis-ci/travis-ci/issues/1147#issuecomment-160820262
# this reduces workload on Travis if there are many pushes in a short time.
# It does not have a drawback if:
# - pull requests are used for review
# - branches that we care about (not work-in-progress) are listed below
only:
- master
matrix:
allow_failures:
- python: pypy3 # https://github.com/pyca/cryptography/issues/2880
include:
# Source Code Analysis is slow. We just run it once on
# Python 2 and once on Python 3.
- python: 2.7
env: MODE=SCA
- python: 3.5
env: MODE=SCA
# Enable nightly without globally enabling sudo and xenial for other build jobs
# disabled because nosetests is not supported on 3.9. We'll move to pytest.
# disabled by commenting out because Travis does not listen to matrix.allow_failures.python = [pypy3, nightly] for some reason
#- python: nightly
# dist: xenial
# sudo: true
- python: 3
os: osx
language: generic
env:
- OS_X_PYTHON_VERSION=python3
before_cache:
- rm -f "$HOME/Library/Caches/pip/log/debug.log"
addons:
homebrew:
packages: python3
# pypy
- python: pypy
env: PYPY_VERSION=pypy-4.0.1
- python: pypy
env: PYPY_VERSION=pypy-5.1
- python: pypy3
env: PYPY_VERSION=pypy3-2.4.0
# test_raw_api takes too long to be run in every cell of the build matrix
- python: 2.7
env: MODE=TEST_RAW_API
- python: 3.6
env: MODE=TEST_RAW_API
# coverage
- python: 3.5
env: MODE=coverage
cache:
- pip
- directories:
- $HOME/.eggs
# custom pypy versions
- $HOME/.pyenv
# OS X
- $HOME/.virtualenvs/osx-python3
before_install:
- uname -a
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then lsb_release -a; fi
- |
# install python on OS X
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
travis_retry pip3 install virtualenv
if [ ! -e "$HOME/.virtualenvs/osx-$OS_X_PYTHON_VERSION/bin/activate" ]; then
virtualenv -p "$OS_X_PYTHON_VERSION" "$HOME/.virtualenvs/osx-$OS_X_PYTHON_VERSION"
else
echo 'skip virtualenv'
fi
source "$HOME/.virtualenvs/osx-$OS_X_PYTHON_VERSION/bin/activate"
else
echo skip
fi
- |
# upgrade pypy (to a version that works with Cryptography 1.0)
if [ -z "$PYPY_VERSION" ]; then
echo 'this is a build of native Travis pypy/pypy3, not the upgraded one'
elif [[ "$TRAVIS_PYTHON_VERSION" == "pypy" ]] || [[ "$TRAVIS_PYTHON_VERSION" == "pypy3" ]]; then
export PYENV_ROOT="$HOME/.pyenv"
if [ -f "$PYENV_ROOT/bin/pyenv" ]; then
pushd "$PYENV_ROOT" && git pull && popd
else
rm -rf "$PYENV_ROOT" && git clone --depth 1 https://github.com/yyuu/pyenv.git "$PYENV_ROOT"
fi
echo "PYPY_VERSION=$PYPY_VERSION"
travis_retry "$PYENV_ROOT/bin/pyenv" install --skip-existing "$PYPY_VERSION"
if [ ! -e "$HOME/.virtualenvs/$PYPY_VERSION/bin/activate" ]; then
virtualenv -p "$PYENV_ROOT/versions/$PYPY_VERSION/bin/python" "$HOME/.virtualenvs/$PYPY_VERSION"
fi
source "$HOME/.virtualenvs/$PYPY_VERSION/bin/activate"
else
echo skip upgrade pypy
fi
- virtualenv --version
- python --version
- |
# upgrade setuptools if it's too old to support PEP 508
# PEP 508 support is needed for python version dependent dependencies in requirements.txt/setup.py (e.g. futures)
pip install "setuptools>=20.2"
install:
- pip install -r requirements.txt
- pip install -r requirements-setup.txt
- pip install -r requirements-test.txt
- pip install 'https://github.com/reef-technologies/b2-sdk-python/archive/shipping_split_fixes.zip#egg=b2sdk'
- |
# coverage has additional requirements
if [ "$MODE" == 'coverage' ]; then
travis_retry pip install "coverage==4.5.4"
if [ -n "$CODACY_PROJECT_TOKEN" ]; then travis_retry pip install codacy-coverage; fi
if [ -n "$COVERALLS_REPO_TOKEN" ]; then travis_retry pip install coveralls; fi
if [ -n "$CODECOV_TOKEN" ]; then travis_retry wget https://codecov.io/bash -O codecov.sh && chmod +x codecov.sh; fi
fi
before_script:
- pip freeze
script:
- |
# nosetests
if [ -z "$MODE" ]; then
python setup.py nosetests
elif [ "$MODE" == 'coverage' ]; then
python setup.py nosetests --with-coverage --cover-xml --cover-package "$(python setup.py --name)" --cover-branches
else
echo skip
fi
- |
# yapf
if [ "$MODE" == 'SCA' ]; then
if [ -n "$TRAVIS_COMMIT_RANGE" ]; then
echo "using commit range: $TRAVIS_COMMIT_RANGE"
git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep '\.py$' | xargs yapf --diff setup.py || exit
else
yapf --diff --recursive . || exit
fi
else
echo skip
fi
- |
# pyflakes
if [ "$MODE" == 'SCA' ]; then
echo "pyflakes temporarily disabled because it does not respect # noqa and we need wildcard imports"
return 0
pyflakes . || exit
else
echo skip
fi
- |
# run command to check liccheck
if [ "$MODE" == 'SCA' ]; then
liccheck -s ci/license_strategy.ini -r requirements.txt
else
echo skip
fi
# isort doesn't get along with yapf. Hopefully we'll figure it out and re-enable in the future.
# - if [ "$MODE" == 'SCA' ]; then isort --order-by-type --recursive --line-width 100 --diff --verbose --check-only || exit; else echo skip; fi
# home-made bad code detectors
- if [ "$MODE" == 'SCA' ]; then egrep -r '^ *class [^\(]+(\(\))?:' . && exit 1 || true; else echo skip; fi # old-style class detector
- if [ "$MODE" == 'SCA' ]; then grep -r 'isinstance\(' . && exit 1 || true; else echo skip; fi # very non-pythonic
- if [ "$MODE" == 'SCA' ]; then egrep -r '\b(all|any)\(\[' . && exit 1 || true; else echo skip; fi # a list is unnecesarily allocated where a generator expression could have been used
- if [ "$MODE" == 'SCA' ]; then grep -r '\_\_metaclass\_\_' . && exit 1 || true; else echo skip; fi # bad metaclass declaration: use six
- if [ "$MODE" == 'SCA' ]; then grep -P -r '^ *logger = (?!logging\.getLogger\(__name__\)$)' . | grep -v '.eggs/nose-' && exit 1 || true; else echo skip; fi # bad logger definition: use `logger = logging.getLogger(__name__)`. See the magic logging metaclass.
# FIXME: temporary switch off checking of year in licence headers
# - |
# if [ "$MODE" == 'SCA' ]; then
# missing="$(
# (
# grep -l "Copyright $(date +%Y).*\\. All Rights Reserved." $(git ls-files | grep .py)
# git ls-files | grep .py
# ) | sort | uniq -c | sort -n | awk '$1 == 1 && $2 !~ ".*/__init__.py"'
# )"
# if [ -n "$missing" ]; then
# echo 'license is missing from:' >&2
# echo "$missing" >&2
# return 1
# fi
# failing=0
# for file in $(git ls-files | grep .py)
# do
# if [ ! -f "$file" ]; then
# echo "file with a newline in the name or space or something? \"$file\""
# return 1
# fi
# license_path="$(grep -B3 'All Rights Reserved' "$file" | awk '/# File: / {print $3}')"
# if [ "$file" != "$license_path" ]; then
# failing=1
# echo "$file contains an inappropriate path in license header: \"$license_path\""
# fi
# done
# if [ "$failing" == 1 ]; then
# echo "license checker FAILED"
# return 1
# else
# echo "license checker passed"
# fi
# else
# echo skip
# fi
# package installation
- |
if [ "$MODE" == 'SCA' ]; then
echo skip
else
if [ -n "$OS_X_PYTHON_VERSION" ]; then
# install action fails on osx for unknown reason
python setup.py develop
else
python setup.py install
fi
fi
after_success:
- if [ "$MODE" == 'coverage' -a -n "$CODACY_PROJECT_TOKEN" ]; then travis_retry python-codacy-coverage -r coverage.xml; else echo skip; fi
- if [ "$MODE" == 'coverage' -a -n "$COVERALLS_REPO_TOKEN" ]; then travis_retry coveralls; else echo skip; fi
- if [ "$MODE" == 'coverage' -a -n "$CODECOV_TOKEN" ]; then travis_retry ./codecov.sh -X gcov -X coveragepy; else echo skip; fi