forked from SyneRBI/SIRF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
256 lines (243 loc) · 10.1 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# Language selection
# Note: with `language: cpp`, `cache: ccache` works
# but `cache: pip` and `python:` is ignored
language: cpp
# Currently commented out as set with environment flags
# Both clang and gcc can be tested. More is the better.
#compiler:
# - clang
# - gcc
# Environment variables
# Note: On trusty we need to build Armadillo and boost ourselves (the system versions are too old)
# Note: On OSX we can't test SYSTEM_Boost=OFF due to excessive log size (https://github.com/CCPPETMR/SIRF-SuperBuild/issues/167)
# Note: currently ACE is not building correctly, so ACE is not built on any configuration https://github.com/CCPPETMR/SIRF-SuperBuild/issues/#174
# Note: on Trusty, g++-7 causes errors with the system ACE, so cannot use g++-7 or later https://github.com/CCPPETMR/SIRF-SuperBuild/issues/169
# Note: altering the matrix here will cause re-building of caches,
# so try to keep this concise to avoid need to update
# Note: the line above each `env` contains a resume of the parameters passed to cmake.
# + or - refer to the value of the parameter affecting the specific package is passed to cmake:
# i.e. -boost == -DUSE_SYSTEM_Boost=OFF, which means that Boost will be built.
matrix:
include:
# linux g{cc,++}-6 py{27,3}
- os: linux
python: 3
# -boost +fftw3 +hdf5 +ace
env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=OFF -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DUSE_SYSTEM_ACE=ON" MATRIX_EVAL="CC=gcc-6 CXX=g++-6" PYMVER=3
- os: linux
python: 2.7
# -boost +fftw3 +hdf5 +siemens_to_ismrmrd +swig +ace
env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=OFF -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DBUILD_siemens_to_ismrmrd=ON -DUSE_SYSTEM_SWIG=ON -DUSE_SYSTEM_ACE=ON" MATRIX_EVAL="CC=gcc-6 CXX=g++-6" PYMVER=2
- os: linux
python: 3
# +DEVEL -boost -hdf5 -fftw3 +ace +siemens_to_ismrmrd
env: EXTRA_BUILD_FLAGS="-DDEVEL_BUILD=ON -DUSE_SYSTEM_Boost=OFF -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_FFTW3=OFF -DUSE_SYSTEM_ACE=ON -DBUILD_siemens_to_ismrmrd=ON" MATRIX_EVAL="CC=gcc-6 CXX=g++-6" PYMVER=3
- os: linux
python: 2.7
# +DEVEL -boost -fftw3 -hdf5 -swig +ace
env: EXTRA_BUILD_FLAGS="-DDEVEL_BUILD=ON -DUSE_SYSTEM_Boost=OFF -DUSE_SYSTEM_FFTW3=OFF -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_ACE=ON -DUSE_SYSTEM_SWIG=OFF" MATRIX_EVAL="CC=gcc-6 CXX=g++-6" PYMVER=2
# osx g{cc,++} py{27,36}
# - os: osx
# python: 2.7
# # +boost -hdf5 -swig
# env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=OFF" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=2
# - os: osx
# # +boost +fftw3 -hdf5 -swig
# python: 3
# env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=OFF" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=3
# - os: osx
# python: 2.7
# # +DEVEL +boost -hdf5 +swig
# env: EXTRA_BUILD_FLAGS="-DDEVEL_BUILD=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=ON" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=2
# - os: osx
# python: 2.7
# # +DEVEL +boost -fftw3 -hdf5 +swig
# env: EXTRA_BUILD_FLAGS="-DDEVEL_BUILD=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=OFF -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=ON" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=2
# itk
- os: linux
python: 3
# -boost +itk +fftw3 +hdf5
env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=OFF -DUSE_ITK=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON" MATRIX_EVAL="CC=gcc-6 CXX=g++-6" PYMVER=3
# - os: osx
# python: 2.7
# # +boost +itk -hdf5 +swig
# env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=ON -DUSE_ITK=ON -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=ON" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=2
env:
global:
# Need STIR_TAG=master at present, see https://github.com/CCPPETMR/SIRF/issues/366
- BUILD_FLAGS="-DCMAKE_BUILD_TYPE=Release -DSTIR_TAG=master"
# don't use too many threads - may crash
- MAKEFLAGS="-j 2"
# Ubuntu 14.04 LTS
dist: trusty
# No need for sudo
sudo: false
# Compilation dependencies
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- git-core
- build-essential
- g++-6
- g++-7
- libboost-all-dev
- libhdf5-serial-dev
- libfftw3-dev
- python-dev
- python3-dev
- python-tk
- python3-tk
- libopenblas-dev
- libatlas-base-dev
- liblapack-dev
- libxml2-dev
- libarmadillo-dev
- libgtest-dev
- libplplot-dev
- swig
- ccache
# for building ACE (note: Trusty only)
- realpath
# not in whitelist
- libxslt-dev
- libace-dev
# - root-system-bin
# cache C/C++/pip
cache:
- ccache
- pip
before_install:
# Set C and C++ compiler etc using trick from
# https://docs.travis-ci.com/user/languages/cpp/#c11c11-and-beyond-and-toolchain-versioning
- eval "${MATRIX_EVAL}"
- $CC --version
- $CXX --version
- mkdir -p ~/.local/bin
- pushd ~/.local/bin
# Note: use ( set -ev; ... ) to echo commands and exit immediately on failure
# in compounds statements (note that export/cd etc won't persist).
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
BUILD_FLAGS="$BUILD_FLAGS -DSHARED_LIBS_ABS_PATH=ON"
brew install openblas
# Get openblas version
blas_ver=$(brew list --versions openblas)
blas_ver=${blas_ver#"openblas "}
EXTRA_BUILD_FLAGS="$EXTRA_BUILD_FLAGS -DCBLAS_INCLUDE_DIR=/usr/local/Cellar/openblas/${blas_ver}/include -DCBLAS_LIBRARY=/usr/local/Cellar/openblas/${blas_ver}/lib/libblas.dylib"
if [ $PYMVER == 2 ]; then
PYINST=/System/Library/Frameworks/Python.framework/Versions/$PYMVER.7
PY_EXE=$PYINST/bin/python2.7
# Next lines are not necessary if we give the actual path for the executable to cmake
#BUILD_FLAGS="$BUILD_FLAGS -DPYTHON_LIBRARY=$PYINST/lib/libpython2.7.dylib"
#BUILD_FLAGS="$BUILD_FLAGS -DPYTHON_INCLUDE_DIR=$PYINST/include/python2.7"
else
brew upgrade python || true # don't fail if upgrading doesn't do anything
# find exact location of Python executable to pass to CMake
# we attempt to find the last one if there are multiple Python 3 versions installed
PY_INST=$(ls -d1 /usr/local/Cellar/python/$PYMVER.*/Frameworks/Python.framework/Versions/$PYMVER.*|tail -n 1)
PYMVER=$(basename ${PY_INST})
PY_EXE=$PY_INST/bin/python$PYMVER
if [ ! -x "$PY_EXE" ]; then
echo "Something wrong with finding Python executable for OSX"
echo "PY_EXE = $PY_EXE"
travis_terminate 1
fi
# Next lines are not necessary if we give the actual path for the executable to cmake
#PY_LIB=$PY_INST/Python
#PY_INC=$PY_INST/Headers
# BUILD_FLAGS="$BUILD_FLAGS -DPYTHON_LIBRARY=$PY_LIB -DPYTHON_INCLUDE_DIR=$PY_INC"
fi
BUILD_FLAGS="$BUILD_FLAGS -DPYTHON_EXECUTABLE=$PY_EXE"
( set -ev
# boost is already installed but 1.65 doesn't work so update
brew reinstall boost
# we currently need boost-python
# brew install boost-python
brew install ace
brew install swig
brew install ccache
if [[ $EXTRA_BUILD_FLAGS == *"SYSTEM_FFTW3=ON"* ]]; then
brew install fftw
else
echo "Not installing FFTW as we are building it"
fi
# need curl to get pip and more recent cmake
brew install curl
#brew install cmake # already present
# alternative: get our own
#curl -L -O https://cmake.org/files/v3.8/cmake-3.8.0-Darwin-x86_64.tar.gz
#tar xzf cmake-*.tar.gz
#mv cmake-*/CMake.app/Contents/* cmake
#export PATH="$PWD/cmake/bin:$PATH"
)
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
PY_EXE=python$PYMVER
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.13.1/cmake-3.13.1-Linux-x86_64.tar.gz
ls -l cmake-*
tar xzf cmake-*.tar.gz
mv cmake-*x86_64 cmake
export PATH="$PWD/cmake/bin:$PATH"
fi
- echo "Using Python executable $PY_EXE"
# get pip
- curl -0 https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- $PY_EXE get-pip.py --user
# setuptools may be out of date on osx
- $PY_EXE -m pip install --user -U pip setuptools wheel
# ensure python bin dir exists (and coverage dependencies installed)
- $PY_EXE -m pip install --user -U nose codecov coveralls requests
# for counting clones, excluding ours
- |
if [[ -n "$GITHUB_API_TOKEN" ]]; then
git clone https://[email protected]/ccp-petmr-codebot/github-stats --branch CCPPETMR/SIRF-SuperBuild
# update with last fortnight's clones from GitHub API
TRAVIS_REPO_SLUG=CCPPETMR/SIRF-SuperBuild source github-stats/setup.sh
# count unique clones, excluding travis, and print total
TRAVIS_REPO_SLUG=CCPPETMR/SIRF-SuperBuild gh_stats_count -k uniques
fi
- $PY_EXE --version
- $PY_EXE -m pip --version
- $PY_EXE -m pip freeze
# ccache compiler override
- ln -s "$(which ccache)" g++
- ln -s "$(which ccache)" g++-6
- ln -s "$(which ccache)" g++-7
- ln -s "$(which ccache)" gcc
- ln -s "$(which ccache)" gcc-6
- ln -s "$(which ccache)" gcc-7
- export PATH="$PWD:$PATH"
- popd
# Use Travis' currently checked-out SIRF commit ID to build.
# Also no point re-downloading SIRF - just use local URL.
# N.B.: don't put into build matrix to allow caching.
- BUILD_FLAGS="$BUILD_FLAGS -DPYVER=$PYMVER -DSIRF_URL=$PWD -DSIRF_TAG=$TRAVIS_COMMIT"
# get SuperBuild
- cd ..
- git clone https://github.com/CCPPETMR/SIRF-SuperBuild --recursive -b master
- cd SIRF-SuperBuild
- cmake --version
install:
- $PY_EXE -m pip install --user --only-binary=numpy,scipy,matplotlib numpy scipy matplotlib
- cmake $BUILD_FLAGS $EXTRA_BUILD_FLAGS .
# Job may timeout (>50min) if no ccache, otherwise should be <1min:
- make
- mv INSTALL/share/gadgetron/config/gadgetron.xml.example INSTALL/share/gadgetron/config/gadgetron.xml
- source $PWD/INSTALL/bin/env_ccppetmr.sh
script:
- ./INSTALL/bin/gadgetron >& gadgetron.log&
# print for debugging
- cat builds/SIRF/build/CMakeCache.txt
- ctest -VV
# print for debugging
- cat builds/SIRF/build/Testing/Temporary/LastTest.log
- echo "----------- Last 200 lines of gadgetron.log"
- tail -n 200 gadgetron.log
after_success:
- pushd ../SIRF
- sed -r 's/SIRF-SuperBuild\/INSTALL\/python\/sirf\/(\w*)\.py/SIRF\/src\/x\1\/p\1\/\1.py/g' ../SIRF-SuperBuild/sources/SIRF/.coverage > .coverage
- codecov
- coveralls
- popd