forked from vispy/vispy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
197 lines (173 loc) · 7.8 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
language: python
# Here we use anaconda for 2.6 and 3.4, since it provides the simplest
# interface for running different versions of Python. We could also use
# it for 2.7, but the Ubuntu system has installable 2.7 Qt4-GL, which
# allows for more complete testing.
# Size testing can be skipped by adding "[size skip]" within a commit message.
virtualenv:
system_site_packages: true
env:
# Enable python 2 and python 3 builds
# Note that the 2.6 build doesn't get flake8, and runs old versions of
# Pyglet and GLFW to make sure we deal with those correctly
- PYTHON=2.6 DEPS=full TEST=standard # functionality
- PYTHON=2.7 DEPS=full TEST=standard
- PYTHON=2.7 DEPS=minimal TEST=standard
- PYTHON=3.4 DEPS=full TEST=standard
- PYTHON=2.7 DEPS=full TEST=examples # test examples
- PYTHON=3.4 DEPS=full TEST=examples
- PYTHON=3.4 DEPS=minimal TEST=extra # test file sizes, style, line endings
before_install:
- REDIRECT_TO=/dev/stdout # change to /dev/null to silence Travis
# install a newer cmake since at this time Travis only has version 2.8.7
- if [ "${PYTHON}" != "2.6" ] && [ "${DEPS}" == "full" ]; then
travis_retry sudo add-apt-repository -y ppa:kalakris/cmake;
travis_retry sudo apt-get -y update -qq;
travis_retry sudo apt-get -qq -y install cmake;
fi;
- if [ "${PYTHON}" != "2.7" ]; then
wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
chmod +x miniconda.sh;
./miniconda.sh -b -p ~/anaconda &> ${REDIRECT_TO};
export PATH=~/anaconda/bin:$PATH;
conda update --yes --quiet conda &> ${REDIRECT_TO};
travis_retry sudo apt-get -qq -y install libgl1-mesa-dri;
fi;
- SRC_DIR=$(pwd)
# file size checks
- if [ "${TEST}" == "extra" ]; then
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
GIT_TARGET_EXTRA="+refs/heads/${TRAVIS_BRANCH}";
GIT_SOURCE_EXTRA="+refs/pull/${TRAVIS_PULL_REQUEST}/merge";
else
GIT_TARGET_EXTRA="";
GIT_SOURCE_EXTRA="";
fi;
cd ~;
mkdir target-size-clone && cd target-size-clone;
git init &> ${REDIRECT_TO} && git remote add -t ${TRAVIS_BRANCH} origin git://github.com/${TRAVIS_REPO_SLUG}.git &>${REDIRECT_TO};
git fetch origin ${GIT_TARGET_EXTRA} &> ${REDIRECT_TO} && git checkout -qf FETCH_HEAD &> ${REDIRECT_TO};
git tag travis-merge-target &> ${REDIRECT_TO};
git gc --aggressive &> ${REDIRECT_TO};
TARGET_SIZE=`du -s . | sed -e "s/\t.*//"`;
git pull origin ${GIT_SOURCE_EXTRA} &> ${REDIRECT_TO};
git gc --aggressive &> ${REDIRECT_TO};
MERGE_SIZE=`du -s . | sed -e "s/\t.*//"`;
if [ "${MERGE_SIZE}" != "${TARGET_SIZE}" ]; then
SIZE_DIFF=`expr \( ${MERGE_SIZE} - ${TARGET_SIZE} \)`;
else
SIZE_DIFF=0;
fi;
fi;
install:
# Install numpy, flake
- if [ "${PYTHON}" != "2.7" ]; then
conda create -n testenv --yes --quiet pip python=$PYTHON > ${REDIRECT_TO};
source activate testenv > ${REDIRECT_TO};
conda install --yes --quiet numpy nose pytest > ${REDIRECT_TO};
else
travis_retry sudo apt-get -qq -y install python-numpy python-setuptools > ${REDIRECT_TO};
pip install -q pytest > ${REDIRECT_TO};
fi;
- pip install -q coveralls pytest-cov
# Dont install flake8 on 2.6 to make sure tests still run without it
- if [ "${PYTHON}" != "2.6" ]; then
pip install -q flake8;
else
pip install -q unittest2;
fi
# Install PyOpenGL
- if [ "${DEPS}" == "full" ]; then
travis_retry sudo apt-get -qq -y install freeglut3 > ${REDIRECT_TO};
if [ "${PYTHON}" == "2.7" ]; then
echo "Using OpenGL stable version (repos)";
travis_retry sudo apt-get -qq -y install python-opengl > ${REDIRECT_TO};
else
echo "Using OpenGL stable version (pip)";
pip install -q PyOpenGL;
fi;
fi;
# Use Pyglet alpha to get Py3.4 support
# Also install PyQt4, imaging (PIL or pillow), scipy, mpl, egl
# Test old (insufficient) version of Pyglet on 2.6
# On conda, can't install pyside-pyzo b/c it conflicts with pyqt4,
# which is required by matplotlib :(
# No wx on py3k, wxpython doesn't work there (!)
- if [ "${DEPS}" == "full" ]; then
if [ "${PYTHON}" == "2.6" ]; then
pip install -q pyglet;
conda install --yes --quiet wxpython > ${REDIRECT_TO};
else
pip install -q http://pyglet.googlecode.com/archive/tip.zip;
fi;
if [ "${PYTHON}" == "3.4" ]; then
conda install --yes --quiet pillow scipy matplotlib > ${REDIRECT_TO};
fi;
if [ "${PYTHON}" == "2.7" ]; then
travis_retry sudo apt-get -qq -y install python-qt4-gl python-imaging python-scipy python-matplotlib python-wxgtk2.8 > ${REDIRECT_TO};
fi;
travis_retry sudo apt-get -qq -y install libegl1-mesa;
fi;
# Install vispy
- cd ${SRC_DIR}
- python setup.py install > ${REDIRECT_TO}
- cd ~
# GLFW: version 2 shouldn't work (so let's try on Py2.6), version 3 will
- if [ "${PYTHON}" == "2.6" ] && [ "${DEPS}" == "full" ]; then
travis_retry sudo apt-get -qq install libglfw2 > ${REDIRECT_TO};
fi
- if [ "${PYTHON}" != "2.6" ] && [ "${DEPS}" == "full" ]; then
travis_retry sudo apt-get -qq install xorg-dev libglu1-mesa-dev > ${REDIRECT_TO};
git clone git://github.com/glfw/glfw.git &> ${REDIRECT_TO};
cd glfw;
cmake -DBUILD_SHARED_LIBS=true -DGLFW_BUILD_EXAMPLES=false -DGLFW_BUILD_TESTS=false -DGLFW_BUILD_DOCS=false . > ${REDIRECT_TO};
sudo make install > ${REDIRECT_TO};
fi
# Install SDL2 (on 2.6, let's only install sdl2-python to test handling)
- if [ "${DEPS}" == "full" ]; then
if [ "${PYTHON}" != "2.6" ]; then
cd ~;
travis_retry sudo apt-get -qq -y install mercurial libdbus-1-dev libgl1-mesa-dev libglu1-mesa-dev libpulse-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev libasound2-dev libts-dev libudev-dev > ${REDIRECT_TO};
wget -q http://www.libsdl.org/release/SDL2-2.0.3.tar.gz;
tar xzf SDL2-2.0.3.tar.gz &> ${REDIRECT_TO};
cd SDL2-2.0.3;
mkdir build;
cd build;
../configure --disable-audio --disable-render --disable-joystick --disable-haptic --disable-power --disable-cpuinfo &> ${REDIRECT_TO};
make -j 2 &> ${REDIRECT_TO};
sudo make install &> ${REDIRECT_TO};
fi;
pip install -q PySDL2;
fi;
# after manual builds we need to update .so search
- sudo ldconfig
before_script:
# We need to create a (fake) display on Travis, let's use a funny resolution
- export DISPLAY=:99.0
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render
script:
- cd ${SRC_DIR}
- if [ "${TEST}" == "standard" ]; then
make unit;
fi;
- if [ "${TEST}" == "examples" ] || [ "${DEPS}" == "minimal" ]; then
make examples;
fi;
- if [ "${TEST}" == "extra" ]; then
make extra;
fi;
# Each line must be run in a separate line to ensure exit code accuracy
- if [ "${TEST}" == "extra" ]; then
echo "Size difference ${SIZE_DIFF} kB";
if git log --format=%B -n 2 | grep -q "\[size skip\]"; then
echo "Skipping size test";
else
test ${SIZE_DIFF} -lt 100;
fi;
fi;
after_success:
# Need to run from source dir to execute appropriate "git" commands
- if [ "${TEST}" == "standard" ]; then
coverage combine;
coveralls;
fi;