forked from SciTools/iris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
138 lines (119 loc) · 4.76 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
# Please update the cartopy, test data, and sample 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.4
sudo: false
env:
- TEST_TARGET=default
- TEST_TARGET=default TEST_MINIMAL=true
- TEST_TARGET=coding
- TEST_TARGET=example
- TEST_TARGET=doctest
git:
depth: 10000
install:
- export IRIS_TEST_DATA_REF="037fee7d26de00897d1694ec040b6ed895d24a38"
- export IRIS_TEST_DATA_SUFFIX=$(echo "${IRIS_TEST_DATA_REF}" | sed "s/^v//")
- export IRIS_SAMPLE_DATA_REF="1ed3e26606366717e2053bacc12bf5e8d8fa2704"
- export IRIS_SAMPLE_DATA_SUFFIX=$(echo "${IRIS_SAMPLE_DATA_REF}" | sed "s/^v//")
# Install miniconda
# -----------------
- export CONDA_BASE=http://repo.continuum.io/miniconda/Miniconda
- if [[ "$TRAVIS_PYTHON_VERSION" == 2* ]]; then
wget ${CONDA_BASE}-3.7.0-Linux-x86_64.sh -O miniconda.sh;
else
wget ${CONDA_BASE}3-3.7.0-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
# ------------------------------------
- conda config --set always_yes yes --set changeps1 no
- conda config --set show_channel_urls True
- conda update --quiet conda
- ENV_NAME='test-environment'
- conda create --quiet -n $ENV_NAME python=$TRAVIS_PYTHON_VERSION
- source activate $ENV_NAME
# Customise the testing environment
# ---------------------------------
- conda config --add channels scitools
- if [[ "$TEST_MINIMAL" == true ]]; then
conda install --quiet --file minimal-conda-requirements.txt;
else
if [[ "$TRAVIS_PYTHON_VERSION" == 3* ]]; then
sed -e '/ecmwf_grib/d' -e 's/#.\+$//' conda-requirements.txt | xargs conda install --quiet;
else
conda install --quiet --file conda-requirements.txt;
fi
fi
- PREFIX=$HOME/miniconda/envs/$ENV_NAME
# Output debug info
- conda list
- 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
- wget -O iris-test-data.zip https://github.com/SciTools/iris-test-data/archive/${IRIS_TEST_DATA_REF}.zip
- unzip -q iris-test-data.zip
- ln -s $(pwd)/iris-test-data-${IRIS_TEST_DATA_SUFFIX} iris-test-data
# iris sample data
- wget -O iris-sample-data.zip https://github.com/SciTools/iris-sample-data/archive/${IRIS_SAMPLE_DATA_REF}.zip
- unzip -q iris-sample-data.zip
- ln -s $(pwd)/iris-sample-data-${IRIS_SAMPLE_DATA_SUFFIX} iris-sample-data
# prepare iris build directory
- python setup.py --with-unpack build_ext --include-dirs=${PREFIX}/include --library-dirs=${PREFIX}/lib
- if [[ $TEST_TARGET -ne 'coding' ]]; then
IRIS=$(ls -d1 build/lib*/iris);
mkdir $IRIS/etc;
else
IRIS=lib/iris;
fi
# set config paths
- SITE_CFG=$IRIS/etc/site.cfg
- echo "[Resources]" > $SITE_CFG
- echo "sample_data_dir = $(pwd)/iris-sample-data/sample_data" >> $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
# The coding standards tests expect all the standard names and PyKE
# modules to be present.
- if [[ $TEST_TARGET == 'coding' ]]; then
python setup.py std_names;
PYTHONPATH=lib python setup.py pyke_rules;
fi
# iris
- python setup.py --quiet --with-unpack build
- python setup.py --quiet --with-unpack install
script:
- if [[ $TEST_TARGET == 'default' ]]; then
python -m iris.tests.runner --default-tests --system-tests --print-failed-images;
fi
- if [[ $TEST_TARGET == 'example' ]]; then
python -m iris.tests.runner --example-tests --print-failed-images;
fi
# "make html" produces an error when run on Travis that does not
# affect any downstream functionality but causes the build to fail
# spuriously. The echo-backtick workaround gets around this error,
# which should be investigated further in the future.
- if [[ $TEST_TARGET == 'doctest' ]]; then
cd $(pwd)/docs/iris;
echo `make clean html`;
make doctest;
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 ./src/whatsnew;
python aggregate_directory.py --checkonly;
fi
- if [[ $TEST_TARGET == 'coding' ]]; then
python setup.py test --coding-tests;
fi