Skip to content

Commit 70f0036

Browse files
committed
Update Travis config to use Trusty and several C++11 standards
Since we're now on Trusty, there are more and cleaner options for testing clang, so the test matrix is expanded by adding several extra clang builds. I tried to put in a good mix of C++11, C++14 and C++17 builds. The former two ought to behave the same, whereas C++17 has a change to std::string::data() which causes a different optimized code path to be selected. Testing it with C++17 will verify the build fix for #41 from my previous commit. I also believe that passing the CMAKE_BUILD_TYPE didn't work for selecting Debug/Release configurations, which is fixed now by passing it as a command line argument instead of merely setting an environment variable.
1 parent 3e1382a commit 70f0036

File tree

1 file changed

+83
-27
lines changed

1 file changed

+83
-27
lines changed

.travis.yml

Lines changed: 83 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,127 @@
1+
dist: trusty
12
language: cpp
23

34
# sources list: https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json,
4-
# packages list: https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
5+
# packages list: https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-trusty
56

67
matrix:
78
include:
9+
# Newest/oldest GCC
810
- os: linux
911
compiler: gcc
1012
addons:
1113
apt:
12-
sources: [ 'ubuntu-toolchain-r-test', 'kalakris-cmake' ]
13-
packages: [ 'g++-4.8', 'libstdc++-4.8-dev', 'cmake' ]
14-
env: CMAKE_BUILD_TYPE=DEBUG GXX=4.8
14+
sources: [ 'ubuntu-toolchain-r-test' ]
15+
packages: [ 'g++-7' ]
16+
env: BUILD_TYPE=MinSizeRel GXX=7 CXX_STD=17
1517

1618
- os: linux
1719
compiler: gcc
1820
addons:
1921
apt:
20-
sources: [ 'ubuntu-toolchain-r-test', 'kalakris-cmake' ]
21-
packages: [ 'g++-4.8', 'libstdc++-4.8-dev', 'cmake' ]
22-
env: CMAKE_BUILD_TYPE=RELEASE GXX=4.8
22+
sources: [ 'ubuntu-toolchain-r-test' ]
23+
packages: [ 'g++-7' ]
24+
env: BUILD_TYPE=Release GXX=7 CXX_STD=17
2325

2426
- os: linux
2527
compiler: gcc
2628
addons:
2729
apt:
28-
sources: [ 'ubuntu-toolchain-r-test', 'kalakris-cmake' ]
29-
packages: [ 'g++-4.9', 'libstdc++-4.9-dev', 'cmake' ]
30-
env: CMAKE_BUILD_TYPE=DEBUG GXX=4.9
30+
sources: [ 'ubuntu-toolchain-r-test' ]
31+
packages: [ 'g++-4.8' ]
32+
env: BUILD_TYPE=Release GXX=4.8
3133

34+
# Newest/oldest clang
35+
# At the time of writing, clang-6.0 doesn't yet apt-get install properly
36+
# on Travis. Use 5.0 until the issue is fixed or a workaround is found.
37+
- os: linux
38+
compiler: clang
39+
addons:
40+
apt:
41+
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0' ]
42+
packages: [ 'clang-5.0', 'libstdc++-7-dev', 'libstdc++6' ] # C++17 support in libstd++
43+
env: BUILD_TYPE=MinSizeRel CLANGXX=5.0 CXX_STD=17
44+
45+
- os: linux
46+
compiler: clang
47+
addons:
48+
apt:
49+
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0' ]
50+
packages: [ 'clang-5.0', 'libstdc++-7-dev', 'libstdc++6' ] # C++17 support in libstd++
51+
env: BUILD_TYPE=Release CLANGXX=5.0 CXX_STD=17
52+
53+
- os: linux
54+
compiler: clang
55+
addons:
56+
apt:
57+
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6' ]
58+
packages: [ 'clang-3.6' ]
59+
env: BUILD_TYPE=Release CLANGXX=3.6
60+
61+
# Other compiler versions
3262
- os: linux
3363
compiler: gcc
3464
addons:
3565
apt:
36-
sources: [ 'ubuntu-toolchain-r-test', 'kalakris-cmake' ]
37-
packages: [ 'g++-4.9', 'libstdc++-4.9-dev', 'cmake' ]
38-
env: CMAKE_BUILD_TYPE=RELEASE GXX=4.9
66+
sources: [ 'ubuntu-toolchain-r-test' ]
67+
packages: [ 'g++-7' ]
68+
env: BUILD_TYPE=Debug GXX=7
3969

4070
- os: linux
4171
compiler: gcc
4272
addons:
4373
apt:
44-
sources: [ 'ubuntu-toolchain-r-test', 'kalakris-cmake' ]
45-
packages: [ 'g++-5', 'libstdc++-5-dev', 'cmake' ]
46-
env: CMAKE_BUILD_TYPE=DEBUG GXX=5
74+
sources: [ 'ubuntu-toolchain-r-test' ]
75+
packages: [ 'g++-6' ]
76+
env: BUILD_TYPE=MinSizeRel GXX=6 CXX_STD=14
4777

4878
- os: linux
4979
compiler: gcc
5080
addons:
5181
apt:
52-
sources: [ 'ubuntu-toolchain-r-test', 'kalakris-cmake' ]
53-
packages: [ 'g++-5', 'libstdc++-5-dev', 'cmake' ]
54-
env: CMAKE_BUILD_TYPE=RELEASE GXX=5
82+
sources: [ 'ubuntu-toolchain-r-test' ]
83+
packages: [ 'g++-5' ]
84+
env: BUILD_TYPE=Release GXX=5
85+
86+
- os: linux
87+
compiler: gcc
88+
addons:
89+
apt:
90+
sources: [ 'ubuntu-toolchain-r-test' ]
91+
packages: [ 'g++-4.9' ]
92+
env: BUILD_TYPE=MinSizeRel GXX=4.9
93+
94+
- os: linux
95+
compiler: gcc
96+
addons:
97+
apt:
98+
sources: [ 'ubuntu-toolchain-r-test' ]
99+
packages: [ 'g++-4.8' ]
100+
env: BUILD_TYPE=Debug GXX=4.8
101+
102+
- os: linux
103+
compiler: clang
104+
addons:
105+
apt:
106+
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0' ]
107+
packages: [ 'clang-5.0' ]
108+
env: BUILD_TYPE=Debug CLANGXX=5.0
55109

56110
- os: linux
57111
compiler: clang
58112
addons:
59113
apt:
60-
sources: [ 'ubuntu-toolchain-r-test', 'kalakris-cmake' ]
61-
packages: [ 'libstdc++-4.8-dev', 'cmake' ]
62-
env: CMAKE_BUILD_TYPE=DEBUG
114+
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-4.0' ]
115+
packages: [ 'clang-4.0' ]
116+
env: BUILD_TYPE=Release CLANGXX=4.0
63117

64118
- os: linux
65119
compiler: clang
66120
addons:
67121
apt:
68-
sources: [ 'ubuntu-toolchain-r-test', 'kalakris-cmake' ]
69-
packages: [ 'libstdc++-4.8-dev', 'cmake' ]
70-
env: CMAKE_BUILD_TYPE=RELEASE
122+
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6' ]
123+
packages: [ 'clang-3.6' ]
124+
env: BUILD_TYPE=Debug CLANGXX=3.6 CXX_STD=14
71125

72126
# container-based builds
73127
sudo: false
@@ -76,13 +130,15 @@ before_install:
76130
- env
77131
- export SRC_DIR="`pwd`"
78132
- if [ "$CXX" = "g++" ]; then export CXX="g++-$GXX" CC="gcc-$GXX"; fi
133+
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-$CLANGXX" CC="clang-$CLANGXX"; fi
79134

80135
script:
81136
- $CXX --version
82137
- cmake --version
83138
- mkdir "$TRAVIS_BUILD_DIR/build"
84139
- cd "$TRAVIS_BUILD_DIR/build"
85140
- pwd
86-
- cmake "$SRC_DIR"
87-
- make
141+
- CXX_STD_ARG=""; if [ ! -z "${CXX_STD}" ]; then CXX_STD_ARG="-DCMAKE_CXX_STANDARD=${CXX_STD}"; fi
142+
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${CXX_STD_ARG} "$SRC_DIR"
143+
- make -j2 # cores according to https://docs.travis-ci.com/user/reference/overview/
88144
- CTEST_OUTPUT_ON_FAILURE=1 make test

0 commit comments

Comments
 (0)