-
Notifications
You must be signed in to change notification settings - Fork 24
/
.travis.yml
166 lines (150 loc) · 7.47 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
# This file configures the build and run environment on https://travis-ci.org/
# Specify the operating systems on which to test for.
os:
- linux
# For details on building a C++ project see: https://docs.travis-ci.com/user/languages/cpp/
language: cpp
# Choices available now are trusty, xenial, or bionic.
# Trusty is "EOL" however. bionic appears to be latest Ubunntu release version.
dist: bionic
# Specifiy which compiler or compilers to test against.
# For details, see https://docs.travis-ci.com/user/languages/cpp/#Choosing-compilers-to-test-against
compiler:
- clang
- gcc
# Define build environment variables.
# Each variable causes an individual build.
env:
- REAL_TYPE=float
- REAL_TYPE=double
# Specify explicitly which branches to build or not build
# For details see: https://docs.travis-ci.com/user/customizing-the-build/#Building-Specific-Branches
#branches:
# only:
# - master
# Specify which OS X image to use.
# "xcode8" is supposed to provide a macosx10.11 SK preinstalled.
# For details see: https://docs.travis-ci.com/user/osx-ci-environment/
#osx_image: xcode8
#xcode_project: Build/xcode5/PlayRho.xcodeproj
#xcode_scheme: UnitTest
# https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz
# Specify which "apt" packages to install/update.
# For white-listed aliases, see https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
#
# Ideally there are usable packages for GLFW version 3 or GLEW version 2 but
# I haven't found usable ones. The closest I got was from a source that
# appeared to cause package conflicts. So these are dealt with later in the
# install stage by downloading, building and installing them the manual way.
#
addons:
apt:
sources:
- deadsnakes
- ubuntu-toolchain-r-test
packages:
- build-essential
- cmake
- cmake-data
- clang-8
- g++-8
- gcc-8
- xorg-dev
- libx11-dev
- libxmu-dev
- libxi-dev
- libgl1-mesa-dev
- libglu1-mesa-dev
- libosmesa-dev
- lcov
- ggcov
- libglfw3-dev
- libglew2.0
# Seems new way is to call: pip install --user cpp-coveralls
# That works for installing cpp-coveralls, but haven't figured out how to get cpp-coveralls to work.
before_install:
- gem install coveralls-lcov
- pip install --user cpp-coveralls
# Install stage. Setup dependencies that can't be setup as addon packages.
#
# I'd prefer that GLFW and GLEW get installed as packages but I didn't find
# usable packages for GLFW version 3 (or newer) and GLEW version 2 (or newer).
# Both of which are required for the PlayRho Testbed and ONLY the Testbed.
#
# Additional notes:
# Linux seems to usually support "sha256sum". OS X meanwhile calls it "shasum".
# For dumping compiler macros: $CXX -dM -E - < /dev/null | sort
# Don't use backslashes for line folding/breaking; they don't work for that.
#
install:
- |
if [ "$CXX" = "g++" ]
then
export CXX="g++-8" CC="gcc-8"
wget https://github.com/linux-test-project/lcov/releases/download/v1.14/lcov-1.14.tar.gz
tar xf lcov-1.14.tar.gz
mkdir -p /tmp/usr
make -C lcov-1.14/ PREFIX=/tmp/usr install
fi
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-8" CC="clang-8"; fi
- |
echo CXX=$CXX HOME=$HOME TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR
cmake --version
export SOURCE_ROOT="${TRAVIS_BUILD_DIR}" BUILD_ROOT="${TRAVIS_BUILD_DIR}-Build"
PLAYRHO_BUILD_OPTIONS="-DPLAYRHO_BUILD_UNIT_TESTS=ON -DPLAYRHO_BUILD_HELLOWORLD=ON -DPLAYRHO_BUILD_TESTBED=ON"
- |
if [ "${REAL_TYPE}foo" != "foo" ]; then
PLAYRHO_BUILD_OPTIONS="$PLAYRHO_BUILD_OPTIONS -DPLAYRHO_REAL_TYPE=$REAL_TYPE"
fi
if [ "$CXX" = "clang++" ]; then
PLAYRHO_BUILD_OPTIONS="$PLAYRHO_BUILD_OPTIONS -DPLAYRHO_BUILD_BENCHMARK=ON"
fi
echo $PLAYRHO_BUILD_OPTIONS
- git clone https://github.com/louis-langholtz/units.git && wget https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.bz2 -O /tmp/boost_1_63_0.tar.bz2 && sha256sum /tmp/boost_1_63_0.tar.bz2 && echo "Expect SHA256 Hash of beae2529f759f6b3bf3f4969a19c2e9d6f0c503edcb2de4a61d1428519fcb3b0" && export BOOST_INC_DST=/tmp/boost_1_63_0/include/boost BOOST_SRC=$HOME/boost-src && mkdir -p $BOOST_SRC $BOOST_INC_DST && pushd $BOOST_SRC && tar --bzip2 -xf /tmp/boost_1_63_0.tar.bz2 && cp -a boost_1_63_0/boost/* $BOOST_INC_DST && popd && pushd $BOOST_INC_DST && mv units units.old && ln -s $HOME/units/include/boost/units . && popd
- |
export GLFW_URL=https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.zip
mkdir /tmp/glfw && pushd /tmp/glfw && curl --location --remote-name $GLFW_URL && md5sum *.zip && echo "Expect MD5 hash of 824c99eea073bdd6d2fec76b538f79af" && unzip -q *.zip && rm *.zip && mkdir ../glfw-build && cd ../glfw-build && cmake -DCMAKE_INSTALL_PREFIX=/tmp/usr ../glfw/* && make && make install && popd
- |
export GLEW_URL=https://sourceforge.net/projects/glew/files/glew/2.0.0/glew-2.0.0.zip
mkdir /tmp/glew && pushd /tmp/glew && curl --location --remote-name $GLEW_URL && md5sum *.zip && echo "Expect MD5 hash of 54c913d0c00726fb028d089ad1664ede" && unzip -q *.zip && rm *.zip && cd * && make && make DESTDIR=/tmp install && popd
script:
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "clang++-8" ]]; then
(pwd && mkdir -p $BUILD_ROOT && cd $BUILD_ROOT && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/tmp/usr -DCMAKE_LIBRARY_PATH=/tmp/usr/lib $PLAYRHO_BUILD_OPTIONS $SOURCE_ROOT && make && cd UnitTests && ./UnitTests --gtest_filter=-Dump.OneBodyWorld )
fi
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "g++-8" ]]; then
# Have CMake build with unit test code coverage enabled...
# (pwd && mkdir -p $BUILD_ROOT && cd $BUILD_ROOT && cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/tmp/usr -DCMAKE_LIBRARY_PATH=/tmp/usr/lib -DPLAYRHO_ENABLE_COVERAGE=ON $PLAYRHO_BUILD_OPTIONS $SOURCE_ROOT && make && cd UnitTests && ./UnitTests --gtest_filter=-Dump.OneBodyWorld:Math.LengthFasterThanHypot )
pwd
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/tmp/usr -DCMAKE_LIBRARY_PATH=/tmp/usr/lib -DPLAYRHO_ENABLE_COVERAGE=ON $PLAYRHO_BUILD_OPTIONS . && make && cd UnitTests && ./UnitTests --gtest_filter=-Dump.OneBodyWorld:Math.LengthFasterThanHypot
fi
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
(cd PlayRho && xcodebuild -project Build/xcode5/PlayRho.xcodeproj -list)
fi
# Notes:
# .gcno files are binary files.
after_success:
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "g++-8" ]]; then
echo "BUILD_ROOT: "$BUILD_ROOT
echo "SOURCE_ROOT: "$SOURCE_ROOT
export PATH=/tmp/usr/bin:$PATH
which lcov
lcov --version
pwd && ls -laF . /usr/bin/gcov*
# cd $BUILD_ROOT && pwd
cd $SOURCE_ROOT && pwd
# find ~/ -name "*gcno" -or -name "*gcda"
# lcov --gcov-tool /usr/bin/gcov-8 --directory PlayRho --directory UnitTests --base-directory $SOURCE_ROOT --capture --output-file coverage.info
lcov --gcov-tool /usr/bin/gcov-8 --compat-libtool --directory PlayRho --directory UnitTests --base-directory ../PlayRho/ --capture --output-file coverage.info --quiet
echo "Lcov exited with status $?"
ls -laF coverage.info
lcov --gcov-tool /usr/bin/gcov-8 --remove coverage.info '*/UnitTests/*' -o coverage.info
lcov --gcov-tool /usr/bin/gcov-8 --remove coverage.info '/usr/include/*' -o coverage.info
ls -laF coverage.info
lcov --list coverage.info
cd $SOURCE_ROOT && pwd
coveralls-lcov --verbose $SOURCE_ROOT/coverage.info
fi