-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
175 lines (157 loc) · 6.04 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
# The MIT License (MIT)
#
# Copyright (c) 2016 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Adapted from various sources, including:
# - Eric Niebler's Ranges: https://github.com/ericniebler/range-v3
# - Louis Dionne's Hana: https://github.com/ldionne/hana
language: c++
env:
global:
- DEPS_DIR=${TRAVIS_BUILD_DIR}/deps
- CMAKE_VERSION="3.9.3"
cache:
directories:
- ${DEPS_DIR}/cmake-${CMAKE_VERSION}
- ${DEPS_DIR}/llvm
- ${DEPS_DIR}/.conan
git:
depth: 3
matrix:
include:
- os: linux
env: GCC_VERSION=7 BUILD_TYPE=Release CODECOV=OFF
addons: &gcc7
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
- os: linux
env: GCC_VERSION=7 BUILD_TYPE=Debug CODECOV=ON
addons: *gcc7
- os: linux
env: GCC_VERSION=7 BUILD_TYPE=Release CONAN_ONLY=ON
addons: *gcc7
- os: linux
env: CLANG_VERSION=5.0 BUILD_TYPE=Release CODECOV=OFF
addons: &clang5
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
- os: linux
env: CLANG_VERSION=5.0 BUILD_TYPE=Debug CODECOV=OFF
addons: *clang5
before_install:
- |
# Set compilers provided in matrix
if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi
- |
# Install requested CMake version
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
if [ ! -f ${DEPS_DIR}/cmake-${CMAKE_VERSION}/cached ]; then
CMAKE_URL="https://cmake.org/files/v3.9/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
mkdir -p ${DEPS_DIR}/cmake-${CMAKE_VERSION}
travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C ${DEPS_DIR}/cmake-${CMAKE_VERSION}
touch ${DEPS_DIR}/cmake-${CMAKE_VERSION}/cached
else
echo "Using cached cmake version ${CMAKE_VERSION}."
fi
export PATH="${DEPS_DIR}/cmake-${CMAKE_VERSION}/bin:${PATH}"
else
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
fi
- |
# Install libc++
if [ -n "$CLANG_VERSION" ]; then
LLVM_VERSION=${CLANG_VERSION}.0
LLVM_DIR=${DEPS_DIR}/llvm/llvm-${LLVM_VERSION}
if [ ! -f ${LLVM_DIR}/cached ]; then
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
mkdir -p ${LLVM_DIR} ${LLVM_DIR}/build ${LLVM_DIR}/projects/libcxx ${LLVM_DIR}/projects/libcxxabi
travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}
travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxx
travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxxabi
(cd ${LLVM_DIR}/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_DIR}/install -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_BUILD_TYPE=Release)
(cd ${LLVM_DIR}/build/projects/libcxx && make install -j2)
(cd ${LLVM_DIR}/build/projects/libcxxabi && make install -j2)
touch ${LLVM_DIR}/cached
fi
export CXXFLAGS="${CXXFLAGS} -stdlib=libc++ -nostdinc++ -I${LLVM_DIR}/install/include/c++/v1 -Wno-unused-command-line-argument"
export LDFLAGS="${LDFLAGS} -L${LLVM_DIR}/install/lib -Wl,-rpath,${LLVM_DIR}/install/lib"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib"
CONAN_CLANG_LIBC="-s compiler=clang -s compiler.version=${CLANG_VERSION} -s compiler.libcxx=libc++"
fi
- |
# Install conan
export PATH=$HOME/.local/bin:$PATH
export CONAN_USER_HOME=${DEPS_DIR}
pip install --user conan
conan user
- |
# Print environment
which $CXX
which $CC
$CXX --version
if [[ "$SANITIZER" != "" ]]; then echo SANITIZER=$SANITIZER; fi
which cmake
cmake --version
conan --version
install:
- |
# Configure project
if [ ! -n "$CONAN_ONLY" ]; then
cd ${TRAVIS_BUILD_DIR}
mkdir build && cd build
conan install .. -s build_type=${BUILD_TYPE} --build=missing ${CONAN_CLANG_LIBC}
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCODE_COVERAGE=$CODECOV
fi
- |
# Dump cmake logs
if [ ! -n "$CONAN_ONLY" ]; then
cat CMakeFiles/CMakeError.log
cat CMakeFiles/CMakeOutput.log
fi
- |
# Build project
if [ ! -n "$CONAN_ONLY" ]; then
cmake --build .
fi
script:
- |
if [ -n "$CONAN_ONLY" ]; then
# Verify everything with Conan
conan remove -f *@mpusz/testing
conan create --build=missing mpusz/testing
else
# Run unit tests
ctest -VV -j2
fi
after_success:
- |
# Run code coverage
if [[ "$CODECOV" == "ON" ]]; then
bash <(curl -s https://codecov.io/bash) -x gcov-7
fi