-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
223 lines (197 loc) · 9.19 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
env:
matrix:
- MYCONDAPY=2.7
#- MYCONDAPY=3.5
#- MYCONDAPY=3.6
global:
- secure: "k4XK37vv/8HySKJXZmGIXRX+DRt1ZBRSc8M7pYCH3nrYuuO65o6Hziphe1JB/mxp8499aNe008dDPsRSvSHGA/IaNjHfNetok13navlSdfKABzQfENJbRtuFlKq/zC6/pAIAUqqm3LCcMs7kM+2cqIUVv4QIhPhq/HK6TneUWqi0wA9Rg3DavUbAinh1BnxA/f+8he2vZNgsRUfuB4nHpZ3mAPzuwGepQwGpi7eM5CApYfTG7ovlwFXAtaZiyQUxyIuq8E5l2X7RSWlzZ2w+xVJYPFF5B5g/p73U8C2xBxaid3VfXULKxLhXeDRHgpeOVxDZjscekH1Cac+53PDNcIamXPXzgNg4cIWr7OvL/KiWvnIIXO5nsrEUjCWrLiqXyzgbLZZBcBRySQ9CUe5jLNhxI6se1J3Qo7BWnFkPcNELxkUcZyTvZ96DBo7QiDYodE3SDVAtLRxTfpCqea/L3kTvNGlF9bNc5dA8427gAB5sb8FuhEliXArrtet3EK9fYfiaXoiIMJKwxVb7ydu43W/9f986TglGN0pk3tLX0Qg2jsHsyArshSZQJCiNH99KHJnkTwDmYiL2KnBHePHEkILNWpXE4pbwkW9JymQnwVhhmAseXDT+MKC3yyohfkP4wfbzmiNpQ5AKjEpDqx6cI51dh+PL4jfOW3Yct1MSrC4="
- secure: "XlRLGJwV1vIaoLRxkd+ISQIKT4+PAPA4Pt8qVlvZ6pNM5v4PpS1t/xoPS0SH+LfPuB+EwjH/yLksM48DA/ZZwsFIUKd6bEjCroaIYwq0xf1d4TirT6n+wjq8HAD8zmO/GA8R6CAjbqBD35ORKxgviVe9j70DtE+aNdnPPYgBz8uJ5EY4MxOW7swTamIV7YAtu+pXKmVT375eB5Kg33Wd16kF9nRSnOS3UuDnK3dovMTPXtQ1dVSiUM37CcJXqXEFYsKXtvxVXJe96XBkj9lkCEVrGV7MWnUtnJKFdXRwuQf2BsdvGrtZWBiJq3XwK6B0nQv8hFYaXeg0PQcnJs/51MrXrVacXWkqs8fFkil0gf9XSAovkEVXn/s/WHKj/JDRnNU6kM7MeIRSY38Rt9VM9K/UzYj8BlkkdCMqWxdDu60a9H6AKmbrz+loWQqB6OAmP/wdsAlG2GH57e3BRY4wno1l4zED3/MmswNOaregy0SEWvtspUzi6foiqw4jh5TM7+wCfe32i2YpLwjIIzJMhNDph2VWch2I9Gcz/i8aQG3Ee7O9miU8Uvcrf8IgBoTtsBf4LiN8JM/ng8jLnGQHWcouwDClziivJs3IOwIVqotqoScbVTaU1NjZuY5cawAS9t/pZ6/h/KLtjMVOnFtYbZA+dz3KnFZtj9BZXLLw7vs="
- PROJECT_NAME=qcgrids
- PYDIR=python-qcgrids
- CONDA_PKG_NAME_CPP=qcgrids
- CONDA_PKG_NAME_PY=python-qcgrids
- GITHUB_REPO_NAME=theochem/qcgrids
####
# EVERYTHING BELOW THIS LINE WILL BE COPIED INTO OTHER YMLs
####
# Do not use Travis Python to save some time.
language: generic
os:
- linux
- osx
osx_image: xcode6.4
dist: trusty
sudo: false
matrix:
# We only test on Linux with one specific Python version, unless we make a release. All
# other cases are allowed to fail and will exit early. With the fast_finish option,
# travis will send a status update to github as soon as the non-allowed-to-fail has
# finished. This speeds up testing in PRs.
#
# This is not ideal. It would be better to run just one item from the build matrix when
# not preparing a release. This is not possible on Travis. There are several tickets on
# travis-ci related to this limitation.
#
# https://github.com/travis-ci/travis-ci/issues/7451
# https://github.com/travis-ci/travis-ci/issues/7149
# https://github.com/travis-ci/travis-ci/issues/2778
# ...
fast_finish: true
allow_failures:
- os: osx
cache:
directories:
- $HOME/download
- $HOME/miniconda
before_cache:
- if ! [[ $TRAVIS_TAG ]]; then rm -rf $HOME/miniconda/conda-bld; fi
- rm -rf $HOME/miniconda/locks $HOME/miniconda/pkgs $HOME/miniconda/var $HOME/miniconda/conda-meta/history
- pip uninstall -y cardboardlint # Cardboardlint always installs even if no changes are made.
branches:
only:
- master
- /^[0-9]+\.[0-9]+(\.[0-9]+)?([ab][0-9]+)?$/
before_install:
- if ! [[ $TRAVIS_TAG || $TRAVIS_OS_NAME == "linux" && $MYCONDAPY == "2.7" ]]; then exit 0; fi
# Get miniconda. Take the right version, so re-installing python is hopefully not needed.
- if test -e $HOME/miniconda/bin; then
echo "miniconda already installed.";
else
echo "Installing miniconda.";
rm -rf $HOME/miniconda;
mkdir -p $HOME/download;
if [[ -d $HOME/download/miniconda.sh ]]; then rm -rf $HOME/download/miniconda.sh; fi;
if [ "${MYCONDAPY}" = "2.7" ]; then
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O $HOME/download/miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -O $HOME/download/miniconda.sh;
fi;
else
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $HOME/download/miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O $HOME/download/miniconda.sh;
fi;
fi;
bash $HOME/download/miniconda.sh -b -p $HOME/miniconda;
fi
install:
- source $HOME/miniconda/bin/activate
- hash -r
# Configure conda and get a few essentials
- conda config --set always_yes yes
- conda config --add channels theochem
- conda install -q conda conda-build
# Set the version info from the git tag
- git fetch origin --tags &&
export PROJECT_VERSION=$(python tools/gitversion.py) &&
python tools/gitversion.py python > ${PYDIR}/${PROJECT_NAME}/version.py &&
python tools/gitversion.py cmake > CMakeListsVersion.txt.in
# Get a list of all build and runtime dependencies.
# This should become easier, without the copy to conda.recipe.ugly.
- conda render tools/conda.recipe > tools/conda.recipe/rendered.yaml
- conda render ${PYDIR}/tools/conda.recipe > ${PYDIR}/tools/conda.recipe/rendered.yaml
- CONDA_DEPENDENCIES=$(python -c "from yaml import load;
req1 = load(open('tools/conda.recipe/rendered.yaml'))['requirements'];
req2 = load(open('${PYDIR}/tools/conda.recipe/rendered.yaml'))['requirements'];
deps = req1['build'] + req1['run'] + req2['build'] + req2['run'];
print(' '.join(set(dep.split()[0] for dep in deps if not dep.startswith('${CONDA_PKG_NAME_CPP}'))))")
# Get the right python version for building. This only does something for 3.5.
# Install extra package needed to make things work. Most things can be listed as
# dependencies on metal.yaml and setup.py, unless setup.py already imports them.
# Install conda tools for packaging and uploading
- conda install -q python=${MYCONDAPY} cppcheck doxygen anaconda-client ${CONDA_DEPENDENCIES}
# Install more recent stuff with pip
- pip install --upgrade pylint codecov coverage pycodestyle pydocstyle
# Get the latest cpplint
- wget https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py &&
chmod +x cpplint.py
# Show conda info for debugging
- conda info -a
# Install the latest cardboardlinter
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
pip install --upgrade git+https://github.com/theochem/cardboardlint.git@master#egg=cardboardlint;
fi
script:
# Static linting
# ~~~~~~~~~~~~~~
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
cardboardlinter --refspec $TRAVIS_BRANCH -f static &&
(cd ${PYDIR}; cardboardlinter --refspec $TRAVIS_BRANCH -f static);
fi
# Unit tests and dynamic linting
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if [[ $TRAVIS_TAG ]]; then
conda build -q tools/conda.recipe &&
(cd ${PYDIR}; conda build -q tools/conda.recipe) &&
conda install --use-local ${CONDA_PKG_NAME_CPP} ${CONDA_PKG_NAME_PY} &&
${CONDA_PREFIX}/libexec/${PROJECT_NAME}/test_${PROJECT_NAME} &&
(cd; nosetests ${PROJECT_NAME} -v --detailed-errors) &&
conda uninstall ${CONDA_PKG_NAME_PY} &&
conda uninstall ${CONDA_PKG_NAME_CPP};
else
(mkdir debug; cd debug; cmake -DCMAKE_BUILD_TYPE=debug ..; make) &&
(cd debug; ./${PROJECT_NAME}/tests/test_${PROJECT_NAME}) &&
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
cardboardlinter --refspec $TRAVIS_BRANCH -f 'dynamic';
fi &&
(cd ${PYDIR}; python setup.py build_ext -i --define CYTHON_TRACE_NOGIL) &&
(cd ${PYDIR};
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../debug/${PROJECT_NAME} nosetests ${PROJECT_NAME}
-v --detailed-errors --with-coverage --cover-package=${PROJECT_NAME}
--cover-tests --cover-inclusive --cover-branches;
coverage xml -i) &&
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
(cd ${PYDIR}; LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../debug/${PROJECT_NAME}
cardboardlinter --refspec $TRAVIS_BRANCH -f 'dynamic');
fi
fi
# Make CPP and PY source package for github deployment
- if [[ $TRAVIS_TAG ]]; then
(cd debug; make sdist) &&
(cd ${PYDIR}; python setup.py sdist);
fi
after_success:
# Upload the coverage analysis
- if ! [[ $TRAVIS_TAG ]]; then
codecov --file ${PYDIR}/coverage.xml &&
codecov;
fi
before_deploy:
# Try to set some env vars to configure deployment.
- export ANACONDA_LABEL_ARG=$(sed -e 's/.*a.*/-l alpha/' -e 's/.*b.*/-l beta/' <<< ${TRAVIS_TAG})
# In deployment, the env var TRAVIS_TAG contains the name of the current tag, if any.
deploy:
- provider: releases
skip_cleanup: true
api_key: ${GITHUB_TOKEN}
file:
- debug/${CONDA_PKG_NAME_CPP}-${TRAVIS_TAG}.tar.gz
- ${PYDIR}/dist/${CONDA_PKG_NAME_PY}-${TRAVIS_TAG}.tar.gz
on:
repo: ${GITHUB_REPO_NAME}
tags: true
condition: "$TRAVIS_TAG != *[ab]* && $MYCONDAPY == 2.7 && $TRAVIS_OS_NAME == linux"
prerelease: false
- provider: releases
skip_cleanup: true
api_key: ${GITHUB_TOKEN}
file:
- debug/${CONDA_PKG_NAME_CPP}-${TRAVIS_TAG}.tar.gz
- ${PYDIR}/dist/${CONDA_PKG_NAME_PY}-${TRAVIS_TAG}.tar.gz
on:
repo: ${GITHUB_REPO_NAME}
tags: true
condition: "$TRAVIS_TAG == *[ab]* && $MYCONDAPY == 2.7 && $TRAVIS_OS_NAME == linux"
prerelease: true
- provider: script
skip_cleanup: true
script:
anaconda -t $ANACONDA_TOKEN upload --force ${ANACONDA_LABEL_ARG}
${HOME}/miniconda/conda-bld/*/${CONDA_PKG_NAME_CPP}-*.tar.bz2
${HOME}/miniconda/conda-bld/*/${CONDA_PKG_NAME_PY}-*.tar.bz2
on:
repo: ${GITHUB_REPO_NAME}
tags: true
condition: "$TRAVIS_TAG == *a*"