-
Notifications
You must be signed in to change notification settings - Fork 30
/
.travis.yml
202 lines (179 loc) · 5.67 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
#Travis CI configuration for KWStyle
# See http://travis-ci.org
#dist: xenial # This is the default as of April 2019
sudo: false
language: cpp
# global environment variables
# Note source code is checked out by travis to $TRAVIS_BUILD_DIR,
# located at ${HOME}/build/<USER>/<REPO>.
# $PROJ_BUILD_DIR must not be co-located with the source directory!
env:
global:
- PROJ_SOURCE_DIR=${TRAVIS_BUILD_DIR} # ${HOME}/build/<USER>/<REPO>
- PROJ_BUILD_DIR=${HOME}/proj/build
- PROJ_INSTALL_DIR=${HOME}/proj/install
# https://docs.travis-ci.com/user/customizing-the-build/
git:
depth: 3
# cache the build dir
# note in the before_script step the cache will be deleted for certain
# TRAVIS_EVENT_TYPE (e.g., "pull_request") to ensure a full rebuild
# proior to some repository actions.
cache:
timeout: 1000
directories:
- ${PROJ_BUILD_DIR}
# cache identifier
# travis hashes the "env" list of each build matrix element to
# discover an appropriate cache to restore
# https://docs.travis-ci.com/user/caching/#caches-and-build-matrices
#
# Increment CACHE_ID to force travis to ignore existing caches. This field is
# copied to the build matrix via yaml anchors.
cache_id: &cache_id
CACHE_ID=0
# build matrix
# https://docs.travis-ci.com/user/languages/c/#gcc-on-linux
matrix:
include:
- os: linux
compiler: gcc # default 5.4 as of Sept 2019
addons:
apt:
packages:
- ninja-build
- cmake-data
- cmake
env:
- MATRIX_NAME="gcc_default"
- *cache_id
- os: linux
compiler: clang
addons:
apt:
packages:
- ninja-build
- cmake-data
- cmake
env:
- MATRIX_NAME="clang_default"
- *cache_id
# ppa:ubuntu-toolchain-r/test xenial gcc versions as of Sept 2019
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
# 4.9.4, 5.5.0, 6.5.0, 7.4.0
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- ninja-build
- cmake-data
- cmake
- g++-4.9
env:
- MATRIX_NAME="gcc-4.9"
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
- *cache_id
# # gcc 5 is tested via default above
# - os: linux
# compiler: gcc
# addons:
# apt:
# sources:
# - ubuntu-toolchain-r-test
# packages:
# - ninja-build
# - cmake-data
# - cmake
# - g++-5
# env:
# - MATRIX_NAME="gcc-5"
# - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
# - *cache_id
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- ninja-build
- cmake-data
- cmake
- g++-6
env:
- MATRIX_NAME="gcc-6"
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
- *cache_id
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- ninja-build
- cmake-data
- cmake
- g++-7
env:
- MATRIX_NAME="gcc-7"
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- *cache_id
# set compiler options
# https://docs.travis-ci.com/user/languages/c/#gcc-on-linux
before_install:
- if [ ! -z "${MATRIX_EVAL}" ]; then eval "${MATRIX_EVAL}"; fi
# additional setup
install:
# additional dependencies in ${HOME}/deps/
- DEPS_DIR="${HOME}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
# install specific cmake version (minimum vxl requirement)
# update to newer version of cmake later CMAKE_URL="https://cmake.org/files/v2.8/cmake-2.8.4-Linux-i386.tar.gz"
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http://www.cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
fi
# script setup (e.g., cache deployment)
before_script:
# delete build cache on pull_request or cron job
- |
if [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ] || [ "${TRAVIS_EVENT_TYPE}" == "cron" ]; then
rm -rf ${PROJ_BUILD_DIR}
fi
# create build & install directories if they do not exist
- mkdir -p ${PROJ_BUILD_DIR} ${PROJ_INSTALL_DIR}
# before script runs, we need to resolve timestamps between the git clone
# and the older build cache. A good discussion is found here:
# https://blog.esciencecenter.nl/travis-caching-and-incremental-builds-6518b89ee889
- |
MD5_FILE=${PROJ_BUILD_DIR}/build_cache.md5
export OLDEST_DATE=$(find ${PROJ_BUILD_DIR} -type f -printf '%TD %TT\n' | sort | head -1)
if [ -f ${MD5_FILE} ]; then
(md5sum -c ${MD5_FILE} 2>/dev/null || :) | awk '{if ($NF == "OK") print substr($0, 1, length($0)-4)}' | xargs touch -d "${OLDEST_DATE}"
fi
find ${PROJ_SOURCE_DIR} \( -type d -name .git \) -prune -o -type f -print0 | xargs -0 md5sum > ${MD5_FILE}
# display build directory
- ls -la ${PROJ_BUILD_DIR}
# main script
script:
- cmake --version
- ${CC} --version
- cd ${PROJ_BUILD_DIR}
- cmake
-G Ninja
-DCMAKE_INSTALL_PREFIX:PATH=${PROJ_INSTALL_DIR}
-DCMAKE_CXX_STANDARD:STRING=11
-DCMAKE_BUILD_TYPE:STRING=Release
${PROJ_SOURCE_DIR}
- ctest -D ExperimentalStart
- ctest -D ExperimentalConfigure
- ctest -D ExperimentalBuild -j2
- ctest -D ExperimentalTest --schedule-random -j2 --output-on-failure
- ctest -D ExperimentalSubmit
- ninja install