forked from tcbrindle/NanoRange
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
217 lines (194 loc) · 6.44 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
#
# Travis CI config file
#
# Copyright Tristan Brindle 2018
#
# Use, modification and distribution is subject to the
# Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Heavily based on travis.yml from Boost.Hana
#
# Copyright Louis Dionne 2013-18
#
language: cpp
os: linux
dist: xenial
# Do not build branches of the form "pr/*". By prefixing pull requests coming
# from branches inside the repository with pr/, this avoids building both the
# branch push _and_ the pull request.
# Based on https://github.com/boostorg/hana/blob/master/.travis.yml
branches:
except: /pr\/.*/
matrix:
include:
#
# Mac OS builds
#
- os: osx
osx_image: xcode11.3
env: COMPILER=clang++
- os: osx
osx_image: xcode11
env: COMPILER=clang++
- os: osx
osx_image: xcode10.2
env: COMPILER=clang++
- os: osx
osx_image: xcode10.1
env: COMPILER=clang++
#
# Linux builds
#
# GCC 9
- language: python
python: "3.7"
install:
- pip install conan-package-tools
env:
- COMPILER=g++-9
- BUILD_SINGLE_HEADER=true
- CONAN_GCC_VERSIONS=9
- CONAN_DOCKER_IMAGE=conanio/gcc9
addons:
apt:
packages:
- g++-9
sources:
- ubuntu-toolchain-r-test
# GCC 8
- env: COMPILER=g++-8
addons:
apt:
packages:
- g++-8
sources:
- ubuntu-toolchain-r-test
# GCC 7
- env: COMPILER=g++-7
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
# Clang 9
- env: COMPILER=clang++-9
addons:
apt:
packages:
- clang-9
- libc++-9-dev
- libc++abi-9-dev
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: https://apt.llvm.org/llvm-snapshot.gpg.key
# Clang 8
- env: COMPILER=clang++-8
addons:
apt:
packages:
- clang-8
- libc++-8-dev
- libc++abi-8-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-8
# Clang 7
- env: COMPILER=clang++-7
addons:
apt:
packages:
- clang-7
- libc++-7-dev
- libc++abi-7-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-7
# Clang 6
- env: COMPILER=clang++-6.0
addons:
apt:
packages:
- clang-6.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-6.0
# Clang 5
- env: COMPILER=clang++-5.0
addons:
apt:
packages:
- clang-5.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-5.0
install:
- DEPS_DIR="${HOME}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
- ${CXX} --version
############################################################################
# Install libc++ and libc++abi if needed
# Taken from https://github.com/boostorg/hana/blob/master/.travis.yml
############################################################################
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "${CXX%%+*}" == "clang" ]]; then
if [[ "${CXX}" == "clang++-5.0" || "${CXX}" == "clang++-6.0" ]]; then
if [[ "${CXX}" == "clang++-5.0" ]]; then LLVM_VERSION="5.0.2";
elif [[ "${CXX}" == "clang++-6.0" ]]; then LLVM_VERSION="6.0.0";
elif [[ "${CXX}" == "clang++-7" ]]; then LLVM_VERSION="7.0.0";
elif [[ "${CXX}" == "clang++-8" ]]; then LLVM_VERSION="8.0.0";
elif [[ "${CXX}" == "clang++-9" ]]; then LLVM_VERSION="9.0.0";
fi
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 llvm/build llvm/projects/libcxx llvm/projects/libcxxabi
travis_retry wget -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C llvm || exit 1
travis_retry wget -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx || exit 1
travis_retry wget -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi || exit 1
(cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${DEPS_DIR}/llvm/install) || exit 1
(cd llvm/build/projects/libcxx && make install -j2) || exit 1
(cd llvm/build/projects/libcxxabi && make install -j2) || exit 1
export CXXFLAGS="-isystem ${DEPS_DIR}/llvm/install/include/c++/v1"
export LDFLAGS="-L ${DEPS_DIR}/llvm/install/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DEPS_DIR}/llvm/install/lib"
else
export CXXFLAGS="-stdlib=libc++"
fi
fi
before_script:
- cd $TRAVIS_BUILD_DIR
- mkdir -p -v build
script:
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=$COMPILER
- cmake --build . --target test_nanorange -- -j2
- ctest -j2
after_success:
- |
if [[ "${BUILD_SINGLE_HEADER}" == "true" ]]; then
if [[ "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" == "master" ]]; then
cmake --build . --target make_single_header
cd ..
./build/tools/make_single_header include/nanorange.hpp single_include/nanorange.hpp
# Suppress output to avoid leaking the token when the command fails
git clone https://tcbrindle:${GITHUB_TOKEN}@github.com/tcbrindle/nanorange --depth 1 checkout &>/dev/null
rm -rf checkout/single_include/nanorange.hpp
cp -R single_include/nanorange.hpp checkout/single_include/nanorange.hpp
pushd checkout
git config --global user.name "Travis Bot"
git config --global user.email "[email protected]"
git add --all .
git commit --allow-empty -m "[skip ci] Update single header"
# Suppress output to avoid leaking the token
travis_retry git push origin master &>/dev/null
popd
python .conan/build.py
fi
fi
notifications:
email: off