-
Notifications
You must be signed in to change notification settings - Fork 9
/
.travis.yml
226 lines (199 loc) · 7.54 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
env:
matrix:
# - MYCONDAPY=2.7
# - MYCONDAPY=3.5
- MYCONDAPY=3.6
global:
#GITHUB_TOKEN
- secure: <REPLACE ME>
#ANACONDA_TOKEN
- secure: <REPLACE ME>
#PYPI_PASSWD
- secure: <REPLACE ME>
- PROJECT_NAME=flik
- GITHUB_REPO_NAME=QuantumElephant/Flik
- CONDA_PKG_NAME_PY=flik
# TEMPLATED FROM https://raw.githubusercontent.com/theochem/derivcheck/master/.travis.yml
# ####
# # EVERYTHING BELOW THIS LINE IS AUTOGENERATED.
# ####
# Do not use Travis Python to save some time.
language: generic
os:
- linux
# - osx
#osx_image: xcode8.3
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 # Sufficient to add miniconda.sh to TRAVIS cache.
- $HOME/miniconda # Add the installation to TRAVIS cache.
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 > ${PROJECT_NAME}/version.py;
# 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_DEPENDENCIES=$(python -c "from yaml import load;
req1 = load(open('tools/conda.recipe/rendered.yaml'))['requirements'];
deps = req1['build'] + req1['run'];
print(' '.join(set(dep.split()[0] for dep in deps)))")
# 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} anaconda-client ${CONDA_DEPENDENCIES}
# Install more recent stuff with pip
- pip install --upgrade pylint codecov coverage pycodestyle pydocstyle
# 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;
fi
# Unit tests and dynamic linting
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if [[ $TRAVIS_TAG ]]; then
conda build -q tools/conda.recipe &&
conda install --use-local ${CONDA_PKG_NAME_PY} &&
(cd; nosetests ${PROJECT_NAME} -v --detailed-errors) &&
conda uninstall ${CONDA_PKG_NAME_PY};
else
python setup.py build_ext -i &&
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
cardboardlinter --refspec $TRAVIS_BRANCH -f 'dynamic';
fi
fi
# Make CPP and PY source package for github deployment
- if [[ $TRAVIS_TAG ]]; then
python setup.py sdist;
fi
# Some other stuff
# ----------------
# Compile documentation
- if [[ -e doc ]]; then
(cd doc; make html);
fi
after_success:
# Upload the coverage analysis
- codecov -f coverage.xml
before_deploy:
# Try to set some env vars to configure deployment.
# Please keep the following lines. They will be used again as soon as it is supported on
# travis. See https://github.com/travis-ci/dpl/issues/613
#- export IS_PRERELEASE=$(python -c 'import os; tt=os.environ["TRAVIS_TAG"]; print("true" if ("a" in tt or "b" in tt) else "false")')
#- echo ${IS_PRERELEASE}
- export ANACONDA_LABEL=$(python -c 'import os; tt=os.environ["TRAVIS_TAG"]; print("alpha" if ("a" in tt) else ("beta" if "b" in tt else "main"))')
- echo ${ANACONDA_LABEL}
# In deployment, the env var TRAVIS_TAG contains the name of the current version, if any.
deploy:
- provider: releases
skip_cleanup: true
api_key: ${GITHUB_TOKEN}
file: dist/${PROJECT_NAME}-${TRAVIS_TAG}.tar.gz
on:
repo: ${GITHUB_REPO_NAME}
tags: true
condition: "$MYCONDAPY == 2.7 && $TRAVIS_OS_NAME == linux && $TRAVIS_TAG == *[ab]*"
prerelease: true
- provider: releases
skip_cleanup: true
api_key: ${GITHUB_TOKEN}
file: dist/${PROJECT_NAME}-${TRAVIS_TAG}.tar.gz
on:
repo: ${GITHUB_REPO_NAME}
tags: true
condition: "$MYCONDAPY == 2.7 && $TRAVIS_OS_NAME == linux && $TRAVIS_TAG != *[ab]*"
prerelease: false
- provider: script
skip_cleanup: true
script: anaconda -t $ANACONDA_TOKEN upload --force -l ${ANACONDA_LABEL} ${HOME}/miniconda/conda-bld/*/${PROJECT_NAME}-*.tar.bz2
on:
repo: ${GITHUB_REPO_NAME}
tags: true
- provider: pypi
skip_cleanup: true
user: quantumelephant
password: ${PYPI_PASSWD}
on:
repo: ${GITHUB_REPO_NAME}
tags: true
condition: "$TRAVIS_TAG != *[ab]* && $MYCONDAPY == 2.7 && $TRAVIS_OS_NAME == linux"
- provider: pages
skip_cleanup: true
github_token: ${GITHUB_TOKEN}
project_name: ${PROJECT_NAME}
local_dir: doc/_build/html
on:
repo: ${GITHUB_REPO_NAME}
condition: "-e doc && $TRAVIS_TAG != *[ab]* && $MYCONDAPY == 2.7 && $TRAVIS_OS_NAME == linux"
tags: true