forked from obspy/obspy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
224 lines (216 loc) · 9.12 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
language: c
branches:
only:
- master
- /^maintenance_[0-9]+\.[0-9]+\.x$/
sudo: false
matrix:
include:
# do one build run with our minimum dependencies
# (or, well, at least the lowest version number that is available through
# anaconda..)
- os: linux
env: PYTHON_VERSION=2.7 MINIMUM_DEPENDENCIES="True"
- os: linux
env: PYTHON_VERSION=2.7
- os: linux
env: PYTHON_VERSION=3.4
- os: linux
env: PYTHON_VERSION=3.5
- os: linux
env: PYTHON_VERSION=3.6
# - os: linux
# env: PYTHON_VERSION=3.5 ARCHITECTURE_32BIT="True"
# addons:
# apt:
# packages:
# # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
# - libstdc++6:i386
# - gcc-multilib
- os: osx
env: PYTHON_VERSION=2.7
- os: osx
env: PYTHON_VERSION=3.6
# mimick travis fast fail and rolling build setup from:
# https://github.com/JuliaLang/julia/blob/master/.travis.yml
before_install:
- if [ `uname` = "Darwin" ]; then brew update; brew install -v jq; fi
- curl "https://raw.githubusercontent.com/JuliaLang/julia/master/contrib/travis_fastfail.sh" -o "/tmp/fastfail.sh" || echo "Failed to fetch travis_fastfail.sh"
- if [ -f /tmp/fastfail.sh ]; then chmod u+x /tmp/fastfail.sh; /tmp/fastfail.sh || exit 1; fi
install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
export OS="MacOSX";
else
export OS="Linux";
fi
# - |
# - if [[ "$ARCHITECTURE_32BIT" == "True" ]]; then
# - export ARCH=""
# - # OPT is used by setuptools patches contained in newer numpy versions
# - # used by obspy when running pip install --no-deps .
# - export OPT="-m32"
# - # workaround for sudo dpkg --add-architecture i386
# - # be sure multiarch is the only file in this directory
# - ls /etc/dpkg/dpkg.cfg.d/
# - # multiarch must contain foreign-architecture i386. If not it will
# - # error later and you need to do the following and add sudo: true
# - #sudo sh -c "echo 'foreign-architecture i386' > /etc/dpkg/dpkg.cfg.d/multiarch"
# - cat /etc/dpkg/dpkg.cfg.d/multiarch
# - else
# - export ARCH="_64"
# - fi
- export ARCH="_64"
- if [[ "${PYTHON_VERSION:0:1}" == '2' ]]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-${OS}-x86${ARCH}.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-${OS}-x86${ARCH}.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
- |
if [[ "$MINIMUM_DEPENDENCIES" == 'True' ]]; then
NUMPY="numpy=1.6.2"
SCIPY="scipy=0.11.0"
MATPLOTLIB="matplotlib=1.1.1"
# no basemap version works with this old numpy, so leave out
BASEMAP=""
PYPROJ="pyproj"
# ancient matplotlib needs to be turned to AGG before anything else,
# otherwise it tries to import incompatible version of Qt as a backend
# and hick-ups..
mkdir -p $HOME/.matplotlib
echo 'backend:AGG' > $HOME/.matplotlib/matplotlibrc
elif [[ "${PYTHON_VERSION}" == '3.4' ]]; then
# 3.4 apparently no longer get's updated packages.
# Let conda resolve to the latest versions.
NUMPY="numpy"
SCIPY="scipy"
MATPLOTLIB="matplotlib"
BASEMAP="basemap"
PYPROJ="pyproj"
# elif [[ "$ARCHITECTURE_32BIT" == "True" ]]; then
# # Special packages for 32bit. Also let conda resolve to the latest
# # versions.
# NUMPY="numpy"
# SCIPY="scipy"
# MATPLOTLIB="matplotlib"
# BASEMAP="basemap"
# PYPROJ="pyproj"
# For anything else also let conda resolve, but force matplotlib 2.
else
NUMPY="numpy"
SCIPY="scipy"
MATPLOTLIB="matplotlib>=2.0.0"
BASEMAP="basemap"
PYPROJ="pyproj"
fi
- conda create -q -n test-environment
python=$PYTHON_VERSION
$NUMPY
$SCIPY
$MATPLOTLIB
$BASEMAP
$PYPROJ
coverage
decorator
docopt
future
jsonschema
lxml
mock
nose
requests
sqlalchemy
"freetype<2.8"
cryptography
- source activate test-environment
# additional, optional packages that run some more tests but are not
# available for all archs. "--no-update-dependencies" keeps other packages at
# already installed version (ideally we should handle package versions
# through pinning or an environment file..)
#- conda config --add channels conda-forge
# XXX for now don't try to install other optional dependencies so that at
# least our builds work..
# XXX - conda install --no-update-dependencies m2crypto || true
# XXX - conda install --no-update-dependencies cartopy || true
# pyshp is safe to install, it depends on no other packages and has a noarch
# py6 package
# not a clue why conda is trying to pull in other packages when doing
# "conda install -c conda-forge --no-update-dependencies pyshp", because the
# pyshp conda package lists 0 dependencies, anyway, so use "--no-deps" to
# really avoid installing/updating any other packages
- conda install -c conda-forge --no-update-dependencies --no-deps pyshp
# install packages not available via conda
- pip install codecov
- pip install geographiclib
# current pyimgur stable release has a py3 incompatibility
- pip install https://github.com/megies/PyImgur/archive/py3.zip
- pip freeze
- pip install https://github.com/obspy/obspy_github_api/archive/0.7.0.zip
- conda list
# done installing dependencies
- git version
- git fetch origin --tags --unshallow
- git remote add obspy git://github.com/obspy/obspy.git
- git fetch obspy --tags
- git status
- git branch -vv
- git remote -vv
# try to set correct remote tracking branch (to get branch info in version number of reports at tests.obspy.org)
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]
# we're building a pull request, so we need to find out the fork it's coming from through github API
then GITHUB_LABEL=`python -c "from urllib import urlopen; import json; print(json.loads(urlopen(\"https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST\").read()).get('head').get('label'))"`
export GITHUB_FORK=${GITHUB_LABEL%:*}
export GITHUB_REMOTE=${GITHUB_FORK}/obspy
export GITHUB_BRANCH=${GITHUB_LABEL#*:}
# we're building a branch on the main repo
else export GITHUB_REMOTE=$TRAVIS_REPO_SLUG
export GITHUB_BRANCH=$TRAVIS_BRANCH
export GITHUB_FORK=${TRAVIS_REPO_SLUG%/*}; fi \
&& echo "$GITHUB_REMOTE $GITHUB_FORK $GITHUB_BRANCH" \
&& if [ "$GITHUB_FORK" != "obspy" ]
then git remote add $GITHUB_FORK git://github.com/$GITHUB_REMOTE; fi \
&& git fetch $GITHUB_FORK +refs/heads/$GITHUB_BRANCH \
&& git checkout -b tested_branch \
&& git branch --set-upstream-to=$GITHUB_FORK/$GITHUB_BRANCH \
|| echo
- git branch -vv
- git remote -vv
- pip install --no-deps .
- git status
script:
# We change directories to make sure that python won't find the copy
# of obspy in the source directory, see
# https://github.com/numpy/numpy/blob/master/.travis.yml#L44
- mkdir empty
- cd empty
# check if any additional modules should be tested (via github issue comments)
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]
# we're building a pull request, so check what modules should be tested
then export MODULELIST=`python -c "from obspy_github_api import get_module_test_list; print('obspy.' + ',obspy.'.join(get_module_test_list($TRAVIS_PULL_REQUEST)))"`
export MODULELISTSPACES=`python -c "from obspy_github_api import get_module_test_list; print(' '.join(get_module_test_list($TRAVIS_PULL_REQUEST)))"`
# we're building a branch on the main repo, so test *all* modules
else export MODULELIST=`python -c "from obspy.core.util import ALL_MODULES as MODULES; print('obspy.' + ',obspy.'.join(MODULES))"`
fi
- echo $MODULELIST
- echo $MODULELISTSPACES
# need to set IFS so that space-separated MODULELISTSPACES list is interpreted correctly by run_tests()
- export IFS=" "
# if not on a PR, i.e. running on a push to master or maintenance_XXX: test *all* modules
- if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
coverage run --rcfile=.coveragerc --source=${MODULELIST} -m obspy.scripts.runtests --no-flake8 --all -n travis-ci -r --ci-url="https://travis-ci.org/${TRAVIS_REPO_SLUG}/jobs/${TRAVIS_JOB_ID}";
else
coverage run --rcfile=.coveragerc --source=${MODULELIST} -m obspy.scripts.runtests --no-flake8 -n travis-ci -r --ci-url="https://travis-ci.org/${TRAVIS_REPO_SLUG}/jobs/${TRAVIS_JOB_ID}" --pr-url="https://github.com/obspy/obspy/pull/${TRAVIS_PULL_REQUEST}" $MODULELISTSPACES;
fi;
after_script:
# if coverage file was created, upload data to codecov
- ls .coverage && codecov
notifications:
email: false