forked from SciTools/iris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
170 lines (146 loc) · 6.14 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
# Please update the test data git references below if appropriate.
#
# Note: Contrary to the travis documentation,
# http://about.travis-ci.org/docs/user/languages/python/#Travis-CI-Uses-Isolated-virtualenvs
# we will use conda to give us a much faster setup time.
language: python
python:
- 2.7
- 3.6
sudo: false
env:
matrix:
- TEST_TARGET=default TEST_MINIMAL=true
- TEST_TARGET=default
- TEST_TARGET=example
- TEST_TARGET=doctest
global:
# The decryption key for the encrypted .github/deploy_key.scitools-docs.enc.
- secure: "N9/qBUT5CqfC7KQBDy5mIWZcGNuUJk3e/qmKJpotWYV+zwOI4GghJsRce6nFnlRiwl65l5oBEcvf3+sBvUfbZqh7U0MdHpw2tHhr2FSCmMB3bkvARZblh9M37f4da9G9VmRkqnyBM5G5TImXtoq4dusvNWKvLW0qETciaipq7ws="
git:
# We need a deep clone so that we can compute the age of the files using their git history.
depth: 10000
install:
- >
export IRIS_TEST_DATA_REF="2f3a6bcf25f81bd152b3d66223394074c9069a96";
export IRIS_TEST_DATA_SUFFIX=$(echo "${IRIS_TEST_DATA_REF}" | sed "s/^v//");
# Cut short doctest phase under Python 2 : now only supports Python 3
# SEE : https://github.com/SciTools/iris/pull/3134
# ------------
- >
if [[ $TEST_TARGET == 'doctest' && ${TRAVIS_PYTHON_VERSION} != 3* ]]; then
echo "DOCTEST phase only valid in Python 3 : ABORTING during 'install'."
exit 0
fi
# Install miniconda
# -----------------
- >
echo 'Installing miniconda';
export CONDA_BASE=https://repo.continuum.io/miniconda/Miniconda;
if [[ "$TRAVIS_PYTHON_VERSION" == 2* ]]; then
wget --quiet ${CONDA_BASE}2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget --quiet ${CONDA_BASE}3-latest-Linux-x86_64.sh -O miniconda.sh;
fi;
bash miniconda.sh -b -p $HOME/miniconda;
export PATH="$HOME/miniconda/bin:$PATH";
# Create the basic testing environment
# ------------------------------------
# Explicitly add defaults channel, see https://github.com/conda/conda/issues/2675
- >
echo 'Configure conda and create an environment';
conda config --set always_yes yes --set changeps1 no;
conda config --set show_channel_urls True;
conda config --add channels conda-forge;
conda update --quiet conda;
ENV_NAME='test-environment';
conda create --quiet -n $ENV_NAME python=$TRAVIS_PYTHON_VERSION pip;
source activate $ENV_NAME;
# Customise the testing environment
# ---------------------------------
- >
echo 'Install Iris dependencies';
CONDA_REQS_FLAGS="";
CONDA_REQS_GROUPS="test";
if [[ "$TRAVIS_PYTHON_VERSION" == 2* ]]; then
CONDA_REQS_FLAGS="${CONDA_REQS_FLAGS} --py2";
fi;
if [[ "$TEST_MINIMAL" != true ]]; then
CONDA_REQS_GROUPS="${CONDA_REQS_GROUPS} all";
fi;
if [[ "${TEST_TARGET}" == 'doctest' ]]; then
CONDA_REQS_GROUPS="${CONDA_REQS_GROUPS} docs";
fi;
CONDA_REQS_FILE=conda-requirements.txt;
python requirements/gen_conda_requirements.py ${CONDA_REQS_FLAGS} --groups ${CONDA_REQS_GROUPS} > ${CONDA_REQS_FILE};
cat ${CONDA_REQS_FILE};
conda install --quiet -n $ENV_NAME --file ${CONDA_REQS_FILE};
- PREFIX=$HOME/miniconda/envs/$ENV_NAME
# Output debug info
- >
conda list -n $ENV_NAME;
conda list -n $ENV_NAME --explicit;
conda info -a;
# Pre-load Natural Earth data to avoid multiple, overlapping downloads.
# i.e. There should be no DownloadWarning reports in the log.
- python -c 'import cartopy; cartopy.io.shapereader.natural_earth()'
# iris test data
- >
if [[ "$TEST_MINIMAL" != true ]]; then
wget --quiet -O iris-test-data.zip https://github.com/SciTools/iris-test-data/archive/${IRIS_TEST_DATA_REF}.zip;
unzip -q iris-test-data.zip;
mv "iris-test-data-${IRIS_TEST_DATA_SUFFIX}" iris-test-data;
fi
# set config paths
- >
SITE_CFG=lib/iris/etc/site.cfg;
echo "[Resources]" > $SITE_CFG;
echo "test_data_dir = $(pwd)/iris-test-data/test_data" >> $SITE_CFG;
echo "doc_dir = $(pwd)/docs/iris" >> $SITE_CFG;
echo "[System]" >> $SITE_CFG;
echo "udunits2_path = $PREFIX/lib/libudunits2.so" >> $SITE_CFG;
- python setup.py --quiet install
# JUST FOR NOW : Install latest version of iris-grib.
# TODO : remove when iris doesn't do an integration test requiring iris-grib.
- if [[ "$TEST_MINIMAL" != true && ${TRAVIS_PYTHON_VERSION} == 2* ]]; then
conda install --quiet -n $ENV_NAME python-ecmwf_grib;
pip install git+https://github.com/SciTools/[email protected];
fi
script:
# Capture install-dir: As a test command must be last for get Travis to check
# the RC, so it's best to start each operation with an absolute cd.
- INSTALL_DIR=$(pwd)
- >
if [[ $TEST_TARGET == 'default' ]]; then
export IRIS_REPO_DIR=$INSTALL_DIR;
python -m iris.tests.runner --default-tests --system-tests --print-failed-images --num-processors=3;
fi
- if [[ $TEST_TARGET == 'example' ]]; then
python -m iris.tests.runner --example-tests --print-failed-images --num-processors=3;
fi
- >
if [[ $TEST_TARGET == 'doctest' ]]; then
MPL_RC_DIR=$HOME/.config/matplotlib;
mkdir -p $MPL_RC_DIR;
echo 'backend : agg' > $MPL_RC_DIR/matplotlibrc;
echo 'image.cmap : viridis' >> $MPL_RC_DIR/matplotlibrc;
cd $INSTALL_DIR/docs/iris;
make clean html && make doctest;
fi
# Split the organisation out of the slug. See https://stackoverflow.com/a/5257398/741316 for description.
- ORG=(${TRAVIS_REPO_SLUG//\// })
# When we merge a change, and we are running in python 3, push some docs.
- if [[ $TEST_TARGET == 'doctest' && ${TRAVIS_EVENT_TYPE} == 'push' && ${TRAVIS_PYTHON_VERSION} == 3* && ${ORG} == "SciTools" ]]; then
cd $INSTALL_DIR;
pip install doctr;
doctr deploy --deploy-repo SciTools-docs/iris --built-docs docs/iris/build/html
--key-path .github/deploy_key.scitools-docs.enc
--no-require-master
${TRAVIS_BRANCH:-${TRAVIS_TAG}};
fi
# An extra call to check "whatsnew" contributions are valid, because the
# Iris test for it needs a *developer* install to be able to find the docs.
- if [[ $TEST_TARGET == 'doctest' ]]; then
cd $INSTALL_DIR/docs/iris/src/whatsnew;
python aggregate_directory.py --checkonly;
fi