-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
141 lines (128 loc) · 4.87 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
# Reference
# - https://github.com/Microsoft/GSL/blob/master/.travis.yml
language: cpp
matrix:
include:
- os: osx
env: COMPILER=g++-7
- os: osx
env: COMPILER=clang++ # osx simply names "clang" the latest clang installed with Xcode toolchain
compiler: clang++
- os: linux
env: COMPILER=g++-7
addons:
apt:
packages:
- xorg-dev
- g++-7
- lcov
sources:
- ubuntu-toolchain-r-test
- os: linux
env: COMPILER=clang++-5.0
addons:
apt:
packages:
- xorg-dev
- clang-5.0
- lcov
sources:
- llvm-toolchain-trusty-5.0
compiler: clang++
env:
global:
- PREMAKE_VERSION="5.0.0-alpha12"
- CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -std=c++17"
linux:
- JOBS="$(nproc)" # should be ~2
osx:
- JOBS="$(sysctl -n hw.ncpu)" # should be 2
cache:
apt: true # private repositories only
directories:
- premake-${PREMAKE_VERSION}
before_install:
# install g++-7 and lcov for OSX
# remove c++ include folder symlink from brew-cask oclint, we don't need it and Cask devs say they don't want
# to auto-link themselves anymore
- |
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
rm /usr/local/include/c++
brew install gcc@7
brew install lcov
fi
install:
# Set the ${CXX} variable properly (don't do it in env, it is too early and would be overriden
# by travis compiler settings just afterward)
# and do it after the initial package install to have g++-7 available if used
- export CXX=${COMPILER}
- ${CXX} --version
# Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p "${DEPS_DIR}"
- cd "${DEPS_DIR}"
# Install premake if not already downloaded, built and up-to-date
- |
if [[ -z "$(ls -A premake-${PREMAKE_VERSION})" || ! -x "$HOME/bin/premake5" || "$(premake5 --version)" == *"${PREMAKE_VERSION}" ]]; then
wget "https://github.com/premake/premake-core/releases/download/v${PREMAKE_VERSION}/premake-${PREMAKE_VERSION}-src.zip"
rm -rf "premake-${PREMAKE_VERSION}"
unzip "premake-${PREMAKE_VERSION}-src.zip"
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
PREMAKE_BUILD_DIR="gmake.unix"
elif [ "$TRAVIS_OS_NAME" == "osx" ]; then
PREMAKE_BUILD_DIR="gmake.macosx"
fi
fi
- pushd "premake-${PREMAKE_VERSION}/build/${PREMAKE_BUILD_DIR}"
- make ${MAKEFLAGS}
- popd
- mkdir "$HOME/bin" -p
- cp "premake-${PREMAKE_VERSION}/bin/release/premake5" "$HOME/bin/premake5"
############################################################################
# [linux]: Install the right version of libc++ (required for e.g. C++14)
############################################################################
- |
LLVM_INSTALL=${DEPS_DIR}/llvm/install
# if in linux and compiler clang and llvm not installed
if [[ "${TRAVIS_OS_NAME}" == "linux" && "${CXX%%+*}" == "clang" && ( ! -d "${LLVM_INSTALL}" || -z "$(ls -A ${LLVM_INSTALL})" ) ]]; then
LLVM_VERSION="5.0.1"
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
travis_retry wget -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx
travis_retry wget -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi
(cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_INSTALL})
(cd llvm/build/projects/libcxx && make install -j2)
(cd llvm/build/projects/libcxxabi && make install -j2)
export CXXFLAGS="-isystem ${LLVM_INSTALL}/include/c++/v1"
export LDFLAGS="-L ${LLVM_INSTALL}/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_INSTALL}/lib"
fi
before_script:
- cd "${TRAVIS_BUILD_DIR}"
# Build Box2D
- pushd "third-party/Box2D/Box2D"
- premake5 gmake
- pushd "Build/gmake"
- export config=release
- make Box2D ${MAKEFLAGS} # we don't need to build the examples
- popd
- popd
script:
- mkdir -p build/Release
- pushd build/Release
# Fail on first error
- set -e
# Optimization: consider cmake -GNinja and ninja
- cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON
- make -j${JOBS}
- set +e
- popd
# Creating test report
# ctest --output-on-failure groups all tests from the same target in one, and does not output colors
- build/Release/bin/test_engine
after_success:
# Uploading report to CodeCov
- bash <(curl -s https://codecov.io/bash)