-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
194 lines (177 loc) · 6.05 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
# After changing this file, check it on:
# http://lint.travis-ci.org/
#
language: python
python:
# We don't actually use the Travis Python, but this keeps it organized.
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "nightly"
os:
- linux
matrix:
fast_finish: true
include:
# https://github.com/travis-ci/travis-ci/issues/9815
- python: "3.7"
dist: xenial
sudo: true
- os: osx
language: generic
python: "2.7"
env: OPTIONAL_DEPS=true TRAVIS_PYTHON_VERSION="2.7"
- os: osx
language: generic
python: "3.7"
env: OPTIONAL_DEPS=true TRAVIS_PYTHON_VERSION="3.7"
- os: osx
language: generic
python: "pypy"
env: OPTIONAL_DEPS=false TRAVIS_PYTHON_VERSION="pypy"
- os: osx
language: generic
python: "pypy3"
env: OPTIONAL_DEPS=false TRAVIS_PYTHON_VERSION="pypy3"
allow_failures:
# pypy Wheels are not yet available.
- python: "pypy"
- python: "pypy3"
- python: "nightly"
env:
matrix:
- OPTIONAL_DEPS=true
- OPTIONAL_DEPS=false
before_install:
### Prepare the system to install prerequisites or dependencies
- uname -a
- printenv
- echo $TRAVIS_OS_NAME
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get update -qq;
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
if [[ "$TRAVIS_PYTHON_VERSION" =~ pypy.* ]]; then
brew install $TRAVIS_PYTHON_VERSION;
fi;
fi
# We do this conditionally because it saves us some downloading if the
# version is the same.
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo "On linux";
if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
echo "Python 2";
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
elif [[ "$TRAVIS_PYTHON_VERSION" =~ 3\..* ]]; then
echo "python 3";
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
echo "On OSX";
if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
echo "Python 2";
wget https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -O miniconda.sh;
elif [[ "$TRAVIS_PYTHON_VERSION" =~ 3\..* ]]; then
echo "Python 3";
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
fi
fi
- if [[ "$TRAVIS_PYTHON_VERSION" =~ (2|3)\..* ]]; then
bash miniconda.sh -b -p $HOME/miniconda;
export PATH="$HOME/miniconda/bin:$PATH";
hash -r;
conda config --set always_yes yes --set changeps1 no;
true; %conda update -q conda;
conda info -a;
fi
install:
### Install any prerequisites or dependencies necessary to run the build.
- if [[ "$TRAVIS_PYTHON_VERSION" =~ (2|3)\..* ]]; then
conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pip numpy;
if [ "${OPTIONAL_DEPS}" == "true" ]; then
conda install -n test-environment Cython;
fi;
source activate test-environment;
else
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get build-dep python-numpy python-scipy python-cvxopt;
fi;
if [[ "$TRAVIS_PYTHON_VERSION" =~ pypy.* ]]; then
sudo $TRAVIS_PYTHON_VERSION -m pip install git+https://bitbucket.org/pypy/numpy.git;
else
pip install --ignore-installed --upgrade pip numpy;
fi;
if [ "${OPTIONAL_DEPS}" == "true" ]; then
pip install --upgrade Cython;
fi;
fi;
before_script:
### Use this to prepare your build for testing
- if [[ "$TRAVIS_PYTHON_VERSION" =~ (2|3)\..* ]]; then
conda install scipy cvxopt;
pip install --upgrade --ignore-installed -r requirements_testing.txt;
elif [[ "$TRAVIS_PYTHON_VERSION" == "nightly" ]]; then
pip install scipy cvxopt;
pip install --upgrade --ignore-installed -r requirements_testing.txt;
elif [[ "$TRAVIS_PYTHON_VERSION" =~ pypy.* ]]; then
sudo $TRAVIS_PYTHON_VERSION -m pip install --ignore-installed -r requirements_testing.txt;
fi;
script:
- printenv PWD
- if ! [[ "$TRAVIS_PYTHON_VERSION" =~ pypy.* ]]; then
pip install .;
else
sudo $TRAVIS_PYTHON_VERSION -m pip install .;
fi
- if ! [[ "$TRAVIS_PYTHON_VERSION" =~ pypy.* ]]; then
if [ "${OPTIONAL_DEPS}" == "true" ]; then
pip install -r requirements_optional.txt;
fi;
fi;
- if ! [[ "$TRAVIS_PYTHON_VERSION" =~ pypy.* ]]; then
export DIT_INSTALL=`pip show dit | grep Location | awk '{print $2"/dit"}'`;
else
export DIT_INSTALL=`pypy -m pip show dit | grep Location | awk '{print $2"/dit"}'`;
fi
- echo "DIT_INSTALL=$DIT_INSTALL"
# nose 1.3.0 does not tell coverage to only cover the requested
# package (except during the report). So to restrict coverage, we must
# inform coverage through the .coveragerc file.
- if ! [[ "$TRAVIS_PYTHON_VERSION" =~ pypy.* ]]; then
cp .coveragerc pytest.ini $DIT_INSTALL;
cp setup.cfg $DIT_INSTALL;
else
sudo cp .coveragerc pytest.ini $DIT_INSTALL;
sudo cp setup.cfg $DIT_INSTALL;
fi
# Move to new directory so that dit is not imported from repository.
# Why? Because we want the tests to make sure that dit was installed
# correctly. Example: setup.py might not have included some submodules.
# Testing from the git repository cannot catch a mistake like that.
#
# Export current directory for logs.
- cd $DIT_INSTALL
- cd ..
- printenv PWD
# Run pytest.
- if [[ "$TRAVIS_PYTHON_VERSION" =~ pypy.* ]]; then
if [ "${OPTIONAL_DEPS}" == "true" ]; then
sudo $TRAVIS_PYTHON_VERSION -m pytest dit;
else
sudo $TRAVIS_PYTHON_VERSION -m pytest -m "not cython" dit;
fi
else
if [ "${OPTIONAL_DEPS}" == "true" ]; then
pytest --numprocesses=auto dit;
else
pytest -m "not cython" --numprocesses=auto dit;
fi
fi
after_success:
- cp .coverage $TRAVIS_BUILD_DIR
- cd $TRAVIS_BUILD_DIR
- python fixcoverage.py ".*/dit/" "$TRAVIS_BUILD_DIR/dit/"
- codecov
notifications:
email: false