-
Notifications
You must be signed in to change notification settings - Fork 6
/
.travis.yml
260 lines (230 loc) · 8.04 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
language: generic
dist: bionic
env:
global:
- 'deployable="^(master|dev|travis)$"'
# - LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
- QT_API=pyside
# - MESA_GL_VERSION_OVERRIDE=3.2
# - MESA_GLSL_VERSION_OVERRIDE=150
matrix:
- PYTHON=2.6 DEPS="minimal"
- PYTHON=2.7 DEPS="" FLAKE=1 PREPARE_DOCS=1
- PYTHON=3.3 DEPS=""
# - PYTHON=3.4 DEPS="" # is this necessary if 3.3 and 3.7 are tested?
# - PYTHON=3.5 DEPS="" # is this necessary if 3.3 and 3.7 are tested?
# - PYTHON=3.6 DEPS="" # is this necessary if 3.3 and 3.7 are tested?
- PYTHON=3.7 DEPS="mayavi" FLAKE=1 ETS_TOOLKIT='qt' QT_API='pyqt5'
git:
submodules: false
sudo: false
services:
- xvfb
addons:
apt:
packages:
- gfortran
- mesa-utils
- libgl1-mesa-dri
- libglapi-mesa
- libosmesa6
##
- libglu1-mesa
- libxi-dev
- libxmu-dev
- libglu1-mesa-dev
# cache:
# directories:
# - $HOME/miniconda
# - $HOME/mycache
before_install:
## First off, let's lint the version numbers in __init__.py and Changes.md
# before we build, check to see if we're in a release branch, and if
# so, then do some 0th order validation on the viscid.__version__
- |
if [[ ($TRAVIS_BRANCH =~ ^(.*release.*|master)$) ]]; then
if [ "$(grep -E "__version__\s*=" viscid/__init__.py | grep -E "(dev|travis)")" != "" ]; then
echo "Oops, you are preparing a release, but you still have either"
echo "dev or travis in the version number"
false
fi
elif [[ $TRAVIS_BRANCH =~ ${deployable} ]]; then
if [ "$(grep -E "__version__\s*=" viscid/__init__.py | grep ${TRAVIS_BRANCH} )" == "" ]; then
echo "Oops, You are on a deployable branch (that is not master), "
echo "but the branch name is not in the version number"
false
fi
fi
# make sure the version string appears in CHANGES.md
- |
ver_re="__version__.*[\"'']+([^\"'']+)[\"'']+"
version=$([[ "$(grep -E "__version__\s*=" viscid/__init__.py)" =~ ${ver_re} ]]; echo "${BASH_REMATCH[1]}")
if [ "$(grep -E "${version}\s*$" CHANGES.md)" == "" ]; then
echo "Oops, the version ${version} does not appear in CHANGES.md"
false
fi
# setup deployment key
# make the encrypted archives with the following...
#
# > export GH_USER="viscid-hub"
# > export TRAVIS_ENDPOINT="--pro"
# > mkdir archive
# > ssh-keygen -P '' -f ./archive/id_rsa
# > mv ./archive/id_rsa.pub ./.key.${GH_USER}.pub
#
# > # !!! STOP AND ADD ANY OTHER FILES TO THE ./archive !!!
#
# > tar -czf .archive.${GH_USER}.tar.gz -C archive .
# > travis login ${TRAVIS_ENDPOINT} -u ${GH_USER} --auto
#
# > travis encrypt-file ${TRAVIS_ENDPOINT} -r ${GH_USER}/Viscid .archive.${GH_USER}.tar.gz
#
# > rm -rf archive .archive.${GH_USER}.tar.gz
# > git add .archive.${GH_USER}.tar.gz.enc .key.${GH_USER}.pub
#
# then...
# Add a block below this comment to decrypt based on the special
# variables that travis-ci created... Note that we use a slightly
# different command they travis suggests, i.e., we specify
# `-out ./.archive.tar.gz`
#
# then...
# Add the public key to the github project ${HG_USER}/Viscid-docs
# as a "Deploy key" with write access
- |
mkdir -p ${HOME}/.ssh
chmod 700 ${HOME}/.ssh
- |
if [ "${TRAVIS_REPO_SLUG}" == "viscid-hub/Viscid" ]; then
openssl aes-256-cbc -K $encrypted_0b3ef9041727_key -iv $encrypted_0b3ef9041727_iv -in resources/.archive.viscid-hub.tar.gz.enc -out ./.archive.tar.gz -d
export DEPLOY_SLUG="${TRAVIS_REPO_SLUG}-docs"
export DEPLOY_DOCS="true"
export DEPLOY_TESTS="true"
elif [ "${TRAVIS_REPO_SLUG}" == "KristoforMaynard/Viscid" ]; then
openssl aes-256-cbc -K $encrypted_0b3ef9041727_key -iv $encrypted_0b3ef9041727_iv -in resources/.archive.KristoforMaynard.tar.gz.enc -out ./.archive.tar.gz -d
export DEPLOY_SLUG="${TRAVIS_REPO_SLUG}-docs"
export DEPLOY_DOCS="false"
export DEPLOY_TESTS="true"
else
export DEPLOY_SLUG=""
export DEPLOY_DOCS="false"
export DEPLOY_TESTS="false"
fi
- |
if [ -f ./.archive.tar.gz ]; then
mkdir .archive
tar -xf .archive.tar.gz -C .archive
mkdir -p ${HOME}/.ssh
chmod 700 ${HOME}/.ssh
mv .archive/id_rsa ${HOME}/.ssh/id_rsa
chmod 600 ${HOME}/.ssh/id_rsa
fi
- |
echo "Deployment info: DEPLOY_SLUG: ${DEPLOY_SLUG}"
echo "Deployment info: DEPLOY_DOCS: ${DEPLOY_DOCS}"
echo "Deployment info: DEPLOY_TESTS: ${DEPLOY_TESTS}"
ls -la ${HOME}/.ssh
## Now setup the Anaconda tools
# it saves some download time to use the same python iff 2.7
- |
if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
export CONDA_URL="https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh"
else
export CONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
fi
# linux has wget, OS X has curl... such is life
- |
if [[ "$(which wget &>/dev/null && echo $?)" == "0" ]]; then
wget "${CONDA_URL}" -O miniconda.sh
else
curl "${CONDA_URL}" > 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 info -a
## Now setup some Viscid specific things, like rc files and make sure
## we have a virtual frame buffer
- mkdir -p ~/.config/matplotlib
- cp resources/matplotlibrc ~/.config/matplotlib/
- cp resources/viscidrc ~/.viscidrc
install:
- mkdir -p ${HOME}/mycache
- 'export env_name="viscid${PYTHON/./}${DEPS}"'
- 'export envpath="$HOME/miniconda/envs/${env_name}"'
- 'export env_spec="resources/${env_name}.yml"'
- 'export cached_env_spec="${HOME}/mycache/${env_name}.yml"'
- 'export prefix="${HOME}/inst/${env_name}"'
- ls ../Viscid/${env_spec}
- mkdir -p $HOME/miniconda/envs
- ls $HOME/miniconda/envs
# if conda package list doesn't match the cached one, just blast
# the cached conda environment
- |
if [ -f ${cached_env_spec} ]; then
echo "Cached env spec file exists: ${cached_env_spec}";
if [ "$(diff -qw ${env_spec} ${cached_env_spec})" != "" ]; then
echo "Package Lists Differed, killing current venv";
echo "$(diff -w ${env_spec} ${cached_env_spec})";
rm ${cached_env_spec};
rm -rf ${envpath};
fi
fi
# if the conda envronment we need isn't cached, create it, otherwise
# do an update
- |
if [ ! -d "${envpath}" ]; then
echo "Env path does not exist: ${envpath}"
conda env create -qf ${env_spec};
source activate ${env_name};
cp ${env_spec} ${cached_env_spec};
else
echo "Env path does exist: ${envpath}"
source activate ${env_name};
conda update --all --yes;
fi
conda list
# if deplying docs, run tests inplace, this makes preparing the docs
# faster since cython's fused types makes 8 times too much code, ug!
- |
if [ "${PREPARE_DOCS}" == "1" ]; then
make inplace;
export PATH="${PWD}/scripts:${PATH}";
export PYTHONPATH="${PWD}:${PYTHONPATH}";
else
rm -rf ${prefix};
export PATH="${prefix}/bin:${PATH}";
export PYTHONPATH="${prefix}:${PYTHONPATH}";
mkdir -p "${prefix}";
python setup.py install --prefix=${prefix} --install-lib=${prefix};
fi
before_script:
- 'if [ "${FLAKE}" == "1" ]; then make flake8; fi'
script:
- |
echo "ETS_TOOLKIT> ${ETS_TOOLKIT}"
echo "QT_API> ${QT_API}"
if [ "${PREPARE_DOCS}" == "1" ]; then
make check;
else
make instcheck;
fi
- |
du -hs tests/plots/mvi-*.png || true
# if [ -f tests/plots/mvi-000.png ]; then
# curl --upload-file tests/plots/mvi-000.png https://transfer.sh/mvi-000.png
# fi
- |
if [[ $TRAVIS_BRANCH =~ ${deployable}$ && "${DEPLOY_TESTS}" == "true" ]]; then
make deploy-summary;
fi
deploy:
provider: "script"
skip_cleanup: true
script:
- make deploy-html
on:
branch: "*"
condition: '($TRAVIS_BRANCH =~ ${deployable}) && ("${PREPARE_DOCS}" == "1") && ("${DEPLOY_DOCS}" == "true")'