forked from SciTools/iris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
183 lines (157 loc) · 6.83 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
# 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: minimal
dist: xenial
env:
global:
# The decryption key for the encrypted .github/deploy_key.scitools-docs.enc.
- secure: "N9/qBUT5CqfC7KQBDy5mIWZcGNuUJk3e/qmKJpotWYV+zwOI4GghJsRce6nFnlRiwl65l5oBEcvf3+sBvUfbZqh7U0MdHpw2tHhr2FSCmMB3bkvARZblh9M37f4da9G9VmRkqnyBM5G5TImXtoq4dusvNWKvLW0qETciaipq7ws="
matrix:
- PYTHON_VERSION=3.6 TEST_TARGET=default TEST_MINIMAL=true
- PYTHON_VERSION=3.6 TEST_TARGET=default TEST_BLACK=true
- PYTHON_VERSION=3.6 TEST_TARGET=example
- PYTHON_VERSION=3.7 TEST_TARGET=default TEST_MINIMAL=true
- PYTHON_VERSION=3.7 TEST_TARGET=default TEST_BLACK=true
- PYTHON_VERSION=3.7 TEST_TARGET=example
- PYTHON_VERSION=3.7 TEST_TARGET=doctest PUSH_BUILT_DOCS=true
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="fffb9b14b9cb472c5eb2ebb7fd19acb7f6414a30";
export IRIS_TEST_DATA_SUFFIX=$(echo "${IRIS_TEST_DATA_REF}" | sed "s/^v//");
# Install miniconda
# -----------------
- >
echo 'Installing miniconda';
export CONDA_BASE="https://repo.continuum.io/miniconda/Miniconda";
wget --quiet ${CONDA_BASE}3-latest-Linux-x86_64.sh -O miniconda.sh;
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;
export ENV_NAME='test-environment';
conda create --quiet -n ${ENV_NAME} python=${PYTHON_VERSION} pip;
source activate ${ENV_NAME};
# Customise the testing environment
# ---------------------------------
- >
echo 'Install Iris dependencies';
CONDA_REQS_GROUPS="test";
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 --groups ${CONDA_REQS_GROUPS} > ${CONDA_REQS_FILE};
cat ${CONDA_REQS_FILE};
conda install --quiet -n ${ENV_NAME} --file ${CONDA_REQS_FILE};
- export 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
# TODO : remove when iris doesn't do an integration test requiring iris-grib.
# test against the latest version of python-eccodes.
# Conda-forge versioning is out of order (0.9.* is later than 2.12.*).
- >
if [[ "${TEST_MINIMAL}" != true ]]; then
conda install --quiet -n ${ENV_NAME} python-eccodes">=0.9.1, <2";
conda install --quiet -n ${ENV_NAME} --no-deps iris-grib;
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.
- export INSTALL_DIR=$(pwd)
- >
if [[ "${TEST_BLACK}" == 'true' ]]; then
echo $(black --version);
rm ${INSTALL_DIR}/.gitignore;
black --check ${INSTALL_DIR};
fi
- >
if [[ "${TEST_TARGET}" == 'default' ]]; then
export IRIS_REPO_DIR=${INSTALL_DIR};
python -m iris.tests.runner --default-tests --system-tests;
fi
- if [[ "${TEST_TARGET}" == 'example' ]]; then
python -m iris.tests.runner --example-tests;
fi
# A 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
# When pushing built docs, attempt to make a preliminary whatsnew by calling
# 'aggregate_directory.py', before the build.
- >
if [[ "${PUSH_BUILT_DOCS}" == 'true' ]]; then
cd ${INSTALL_DIR}/docs/iris/src/whatsnew;
WHATSNEW=$(ls -d contributions_* 2>/dev/null);
if [[ -n "${WHATSNEW}" ]]; then
python aggregate_directory.py --unreleased;
fi;
fi
# Build the docs.
- >
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.
# NOTE: a *separate* "export" command appears to be necessary here : A command of the
# form "export ORG=.." failed to define ORG for the following command (?!)
- >
ORG=$(echo ${TRAVIS_REPO_SLUG} | cut -d/ -f1);
export ORG
- echo "Travis job context ORG=${ORG}; TRAVIS_EVENT_TYPE=${TRAVIS_EVENT_TYPE}; PUSH_BUILT_DOCS=${PUSH_BUILT_DOCS}"
# When we merge a change to SciTools/iris, we can push docs to github pages.
# At present, only the Python 3.7 "doctest" job does this.
# Results appear at https://scitools-docs.github.io/iris/<<branchname>>/index.html
- if [[ "${ORG}" == 'SciTools' && "${TRAVIS_EVENT_TYPE}" == 'push' && "${PUSH_BUILT_DOCS}" == 'true' ]]; 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