blob: 36708ef4293a92da80d60d73c8424b5f3ae2e57a [file] [log] [blame]
onqtame85b1bb2016-06-26 16:41:09 +03001# this file is HEAVILY influenced by https://github.com/boostorg/hana/blob/master/.travis.yml
2
onqtam803bb8f2017-09-05 13:00:24 +03003dist: trusty
onqtame4c75fc2016-05-21 01:24:48 +03004sudo: false
5language: c++
6
7notifications:
onqtamf5169772016-09-09 18:33:13 +03008 email: false
onqtame4c75fc2016-05-21 01:24:48 +03009 # gitter
10 webhooks:
11 urls: https://webhooks.gitter.im/e/10941dd1c67e5e967706
12 on_success: change
13 on_failure: always
14git:
onqtam9f934f82016-08-02 12:42:19 +030015 depth: 500
onqtame4c75fc2016-05-21 01:24:48 +030016
17# both apt and ccache make the builds slower...
18#cache:
19# - apt
20# - ccache
21
22env:
23 global:
24# - USE_CCACHE=1
25# - CCACHE_SLOPPINESS=pch_defines,time_macros
26# - CCACHE_COMPRESS=1
27# - CCACHE_MAXSIZE=200M
28# - CCACHE_CPP2=1
29 - CMAKE_OPTIONS_GLOBAL="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
onqtame4c75fc2016-05-21 01:24:48 +030030
31addons:
32 coverity_scan:
33 # COVERITY_SCAN_TOKEN added as env var in travis project
34 project:
35 name: onqtam/doctest
36 notification_email: vik.kirilov@gmail.com
onqtam92a9ce12017-05-29 23:56:22 +030037 build_command: clang++ scripts/hello_world.cpp -I doctest
onqtame4c75fc2016-05-21 01:24:48 +030038 branch_pattern: coverity_scan
39 # these apt sources will be referenced later (by using *name)
40 apt:
onqtam2c8036f2016-06-26 17:12:42 +030041 sources: &apt_sources
42 - ubuntu-toolchain-r-test
onqtam3bf83c42017-04-23 15:30:23 +030043 - llvm-toolchain-trusty
onqtam1cb49f82018-06-01 11:44:43 +030044 - llvm-toolchain-precise-3.7
onqtam803bb8f2017-09-05 13:00:24 +030045 - llvm-toolchain-trusty-3.9
onqtam3bf83c42017-04-23 15:30:23 +030046 - llvm-toolchain-trusty-4.0
onqtam803bb8f2017-09-05 13:00:24 +030047 - llvm-toolchain-trusty-5.0
onqtamcb279b22018-03-09 01:31:09 +070048 - llvm-toolchain-trusty-6.0
onqtame4c75fc2016-05-21 01:24:48 +030049
50compiler: clang
51os: linux
52
53matrix:
onqtame4c75fc2016-05-21 01:24:48 +030054 include:
onqtamd1737e42016-08-01 19:05:07 +030055 # coverage
onqtamf6d1a512017-05-01 13:56:12 +030056 - env: COMPILER=g++ CODE_COVERAGE=true
onqtamd1737e42016-08-01 19:05:07 +030057 compiler: gcc
58 addons:
59 apt:
onqtamf6d1a512017-05-01 13:56:12 +030060 packages: ["lcov"]
onqtamd1737e42016-08-01 19:05:07 +030061
onqtamaec53d22017-05-03 06:29:47 +030062 # static code analysis
onqtam8c3352f2018-05-09 12:09:32 +030063 - env: COMPILER=clang++-4.0 STATIC_CODE_ANALYSIS=true
64 addons: &static_analysis
onqtamaec53d22017-05-03 06:29:47 +030065 apt:
onqtam8c3352f2018-05-09 12:09:32 +030066 packages: ["clang-4.0", "clang-tidy-4.0", "cppcheck"]
onqtamaec53d22017-05-03 06:29:47 +030067 sources: *apt_sources
68
onqtamaec53d22017-05-03 06:29:47 +030069 # GCC 4.8
onqtam50177682018-08-17 15:36:06 +030070 - env: COMPILER=g++-4.8 HAS_ASAN_32=true HAS_ASAN_64=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +030071 compiler: gcc
72 addons: &gcc48
73 apt:
onqtamd43ae6d2018-05-29 23:40:00 +030074 packages: ["g++-4.8", "valgrind", "g++-4.8-multilib", "libc6-dbg", "libc6-dbg:i386", "linux-libc-dev", "linux-libc-dev:i386"]
onqtamaec53d22017-05-03 06:29:47 +030075 sources: *apt_sources
76
77 # GCC 4.9
onqtam50177682018-08-17 15:36:06 +030078 - env: COMPILER=g++-4.9 HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true # no ASAN_32 - errors when using ASAN_OPTIONS - probably g++ 4.9 bug
onqtamaec53d22017-05-03 06:29:47 +030079 compiler: gcc
80 addons: &gcc49
81 apt:
onqtamd43ae6d2018-05-29 23:40:00 +030082 packages: ["g++-4.9", "valgrind", "g++-4.9-multilib", "libc6-dbg", "libc6-dbg:i386", "linux-libc-dev", "linux-libc-dev:i386"]
onqtamaec53d22017-05-03 06:29:47 +030083 sources: *apt_sources
84
85 # GCC 5
onqtam50177682018-08-17 15:36:06 +030086 - env: COMPILER=g++-5 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true ADDITIONAL_CXX_FLAGS=" -fuse-ld=gold"
onqtamaec53d22017-05-03 06:29:47 +030087 compiler: gcc
88 addons: &gcc5
89 apt:
onqtamd43ae6d2018-05-29 23:40:00 +030090 packages: ["g++-5", "valgrind", "g++-5-multilib", "libc6-dbg", "libc6-dbg:i386", "linux-libc-dev", "linux-libc-dev:i386"]
onqtamaec53d22017-05-03 06:29:47 +030091 sources: *apt_sources
92
93 # GCC 6
onqtam50177682018-08-17 15:36:06 +030094 - env: COMPILER=g++-6 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true ADDITIONAL_CXX_FLAGS=" -fuse-ld=gold"
onqtamaec53d22017-05-03 06:29:47 +030095 compiler: gcc
96 addons: &gcc6
97 apt:
onqtamd43ae6d2018-05-29 23:40:00 +030098 packages: ["g++-6", "valgrind", "g++-6-multilib", "libc6-dbg", "libc6-dbg:i386", "linux-libc-dev", "linux-libc-dev:i386"]
onqtamaec53d22017-05-03 06:29:47 +030099 sources: *apt_sources
100
101 # GCC 7
onqtam50177682018-08-17 15:36:06 +0300102 - env: COMPILER=g++-7 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true ADDITIONAL_CXX_FLAGS=" -fuse-ld=gold"
onqtamaec53d22017-05-03 06:29:47 +0300103 compiler: gcc
onqtam051def32018-05-09 11:30:10 +0300104 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamaec53d22017-05-03 06:29:47 +0300105 addons: &gcc7
106 apt:
onqtamd43ae6d2018-05-29 23:40:00 +0300107 packages: ["g++-7", "valgrind", "g++-7-multilib", "libc6-dbg", "libc6-dbg:i386", "linux-libc-dev", "linux-libc-dev:i386"]
onqtamaec53d22017-05-03 06:29:47 +0300108 sources: *apt_sources
109
onqtame5f8b672018-05-03 16:02:32 +0300110 # GCC 8
onqtam50177682018-08-17 15:36:06 +0300111 - env: COMPILER=g++-8 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true ADDITIONAL_CXX_FLAGS=" -fuse-ld=gold"
onqtame5f8b672018-05-03 16:02:32 +0300112 compiler: gcc
onqtam051def32018-05-09 11:30:10 +0300113 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtame5f8b672018-05-03 16:02:32 +0300114 addons: &gcc8
115 apt:
onqtamd43ae6d2018-05-29 23:40:00 +0300116 packages: ["g++-8", "valgrind", "g++-8-multilib", "libc6-dbg", "libc6-dbg:i386", "linux-libc-dev", "linux-libc-dev:i386"]
onqtame5f8b672018-05-03 16:02:32 +0300117 sources: *apt_sources
118
onqtamaec53d22017-05-03 06:29:47 +0300119 # Clang 3.5
onqtam50177682018-08-17 15:36:06 +0300120 - env: COMPILER=clang++-3.5 HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300121 addons: &clang35
122 apt:
123 packages: ["clang-3.5", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
124 sources: *apt_sources
125
126 # Clang 3.6
onqtam50177682018-08-17 15:36:06 +0300127 - env: COMPILER=clang++-3.6 HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300128 addons: &clang36
129 apt:
130 packages: ["clang-3.6", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
131 sources: *apt_sources
132
133 # Clang 3.7
134 - env: COMPILER=clang++-3.7
135 addons: &clang37
136 apt:
137 packages: ["clang-3.7", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
138 sources: *apt_sources
139
140 # Clang 3.8
onqtam50177682018-08-17 15:36:06 +0300141 - env: COMPILER=clang++-3.8 HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300142 addons: &clang38
143 apt:
144 packages: ["clang-3.8", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
145 sources: *apt_sources
146
147 # Clang 3.9
onqtam1cb49f82018-06-01 11:44:43 +0300148 - env: COMPILER=clang++-3.9 # no HAS_ASAN_64=true HAS_UBSAN_64=true - see errors: https://travis-ci.org/onqtam/doctest/jobs/386263910
onqtamaec53d22017-05-03 06:29:47 +0300149 addons: &clang39
150 apt:
151 packages: ["clang-3.9", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
152 sources: *apt_sources
153
154 # Clang 4.0
onqtam50177682018-08-17 15:36:06 +0300155 - env: COMPILER=clang++-4.0 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtam051def32018-05-09 11:30:10 +0300156 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamaec53d22017-05-03 06:29:47 +0300157 addons: &clang40
158 apt:
159 packages: ["clang-4.0", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
160 sources: *apt_sources
161
onqtam803bb8f2017-09-05 13:00:24 +0300162 # Clang 5.0
onqtam50177682018-08-17 15:36:06 +0300163 - env: COMPILER=clang++-5.0 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtam051def32018-05-09 11:30:10 +0300164 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtam803bb8f2017-09-05 13:00:24 +0300165 addons: &clang50
166 apt:
167 packages: ["clang-5.0", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
168 sources: *apt_sources
169
onqtamcb279b22018-03-09 01:31:09 +0700170 # Clang 6.0
onqtam50177682018-08-17 15:36:06 +0300171 - env: COMPILER=clang++-6.0 HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true # no ASAN_32/UBSAN_32 - errors:
onqtam051def32018-05-09 11:30:10 +0300172 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamcb279b22018-03-09 01:31:09 +0700173 addons: &clang60
174 apt:
175 packages: ["clang-6.0", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
176 sources: *apt_sources
177
onqtamaec53d22017-05-03 06:29:47 +0300178 # Xcode 8 Clang
onqtam50177682018-08-17 15:36:06 +0300179 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_TSAN_32=true HAS_TSAN_64=true # no HAS_ASAN_64 - errors since using thread_local even in single-threaded cases - see errors: https://travis-ci.org/onqtam/doctest/builds/417181981
onqtamaec53d22017-05-03 06:29:47 +0300180 osx_image: xcode8
181 os: osx
182
onqtamaec53d22017-05-03 06:29:47 +0300183 # Xcode 8.3 Clang
onqtam50177682018-08-17 15:36:06 +0300184 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true # no HAS_ASAN_64 - errors since using thread_local even in single-threaded cases - see errors: https://travis-ci.org/onqtam/doctest/builds/417181981
onqtamaec53d22017-05-03 06:29:47 +0300185 osx_image: xcode8.3
186 os: osx
187
onqtam50cbb802017-12-09 17:17:39 +0200188 # Xcode 9.2 Clang
onqtam50177682018-08-17 15:36:06 +0300189 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true # no HAS_ASAN_64 - errors since using thread_local even in single-threaded cases - see errors: https://travis-ci.org/onqtam/doctest/builds/417181981
onqtam50cbb802017-12-09 17:17:39 +0200190 osx_image: xcode9.2
191 os: osx
192
onqtam7c606ea2018-08-15 10:16:21 +0300193 # Xcode 9.4 Clang
onqtam50177682018-08-17 15:36:06 +0300194 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true # no HAS_ASAN_64 - errors since using thread_local even in single-threaded cases - see errors: https://travis-ci.org/onqtam/doctest/builds/417181981
onqtam7c606ea2018-08-15 10:16:21 +0300195 osx_image: xcode9.4
onqtam3a3bc202018-04-10 13:54:28 +0300196 os: osx
197
onqtam09fd51d2018-08-16 19:55:21 +0300198 # Xcode 10.0 Clang
onqtam50177682018-08-17 15:36:06 +0300199 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtam09fd51d2018-08-16 19:55:21 +0300200 osx_image: xcode10
201 os: osx
202
onqtamaec53d22017-05-03 06:29:47 +0300203 # OSX GCC 4.9
onqtam50177682018-08-17 15:36:06 +0300204 - env: COMPILER=g++-4.9 HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true # no ASAN_32 - errors when using ASAN_OPTIONS - probably g++ 4.9 bug
onqtamaec53d22017-05-03 06:29:47 +0300205 compiler: gcc
onqtam10c20182018-08-17 15:14:52 +0300206 osx_image: xcode8
onqtamaec53d22017-05-03 06:29:47 +0300207 os: osx
208
209 # OSX GCC 5
onqtam50177682018-08-17 15:36:06 +0300210 - env: COMPILER=g++-5 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300211 compiler: gcc
onqtam10c20182018-08-17 15:14:52 +0300212 osx_image: xcode8
onqtamaec53d22017-05-03 06:29:47 +0300213 os: osx
214
215 # OSX GCC 6
onqtam50177682018-08-17 15:36:06 +0300216 - env: COMPILER=g++-6 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300217 compiler: gcc
onqtamce1b2042018-08-17 15:30:02 +0300218 osx_image: xcode10
onqtamaec53d22017-05-03 06:29:47 +0300219 os: osx
220
221 # OSX GCC 7
onqtam50177682018-08-17 15:36:06 +0300222 - env: COMPILER=g++-7 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300223 compiler: gcc
onqtamce1b2042018-08-17 15:30:02 +0300224 osx_image: xcode10
onqtamaec53d22017-05-03 06:29:47 +0300225 os: osx
226
onqtamba6808f2018-05-09 12:00:28 +0300227 # OSX GCC 8
onqtam50177682018-08-17 15:36:06 +0300228 - env: COMPILER=g++-8 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtamba6808f2018-05-09 12:00:28 +0300229 compiler: gcc
onqtamce1b2042018-08-17 15:30:02 +0300230 osx_image: xcode10
onqtamba6808f2018-05-09 12:00:28 +0300231 os: osx
232
onqtamaec53d22017-05-03 06:29:47 +0300233 # OSX LLVM-GCC
onqtam50177682018-08-17 15:36:06 +0300234 - env: COMPILER=g++ HAS_ASAN_32=true HAS_ASAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300235 compiler: gcc
onqtam25fff352018-08-17 15:27:20 +0300236 osx_image: xcode10
onqtamaec53d22017-05-03 06:29:47 +0300237 os: osx
238
239 allow_failures:
240
onqtamd6e86612018-05-31 14:32:16 +0300241 # static code analysis
242 - env: COMPILER=clang++-4.0 STATIC_CODE_ANALYSIS=true
243
onqtamaec53d22017-05-03 06:29:47 +0300244 # OSX GCC 6
onqtam50177682018-08-17 15:36:06 +0300245 - env: COMPILER=g++-6 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300246 compiler: gcc
onqtamce1b2042018-08-17 15:30:02 +0300247 osx_image: xcode10
onqtamaec53d22017-05-03 06:29:47 +0300248 os: osx
249
onqtam803bb8f2017-09-05 13:00:24 +0300250 # OSX GCC 7
onqtam50177682018-08-17 15:36:06 +0300251 - env: COMPILER=g++-7 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtamaec53d22017-05-03 06:29:47 +0300252 compiler: gcc
onqtamce1b2042018-08-17 15:30:02 +0300253 osx_image: xcode10
onqtamaec53d22017-05-03 06:29:47 +0300254 os: osx
onqtamb1a3de82016-10-10 22:22:00 +0300255
onqtamba6808f2018-05-09 12:00:28 +0300256 # OSX GCC 8
onqtam50177682018-08-17 15:36:06 +0300257 - env: COMPILER=g++-8 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true HAS_TSAN_32=true HAS_TSAN_64=true
onqtamba6808f2018-05-09 12:00:28 +0300258 compiler: gcc
onqtamce1b2042018-08-17 15:30:02 +0300259 osx_image: xcode10
onqtamba6808f2018-05-09 12:00:28 +0300260 os: osx
261
onqtam2c8036f2016-06-26 17:12:42 +0300262install:
onqtamf6d1a512017-05-01 13:56:12 +0300263 - if [[ "${CODE_COVERAGE}" == "true" ]]; then gem install coveralls-lcov ; fi
264
onqtam01158572016-06-28 14:29:32 +0300265 ############################################################################
onqtamc7aaa962016-09-10 02:16:57 +0300266 # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/
267 ############################################################################
268
onqtam5a2b2552017-05-01 14:03:04 +0300269 # Make a dir for all
onqtamc7aaa962016-09-10 02:16:57 +0300270 - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
271 - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
272
onqtamc7aaa962016-09-10 02:16:57 +0300273 # Install a recent CMake
onqtamc7aaa962016-09-10 02:16:57 +0300274 - |
275 if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
onqtam84015352017-03-15 20:11:07 +0200276 CMAKE_URL="http://www.cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
onqtamc7aaa962016-09-10 02:16:57 +0300277 mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
278 export PATH=${DEPS_DIR}/cmake/bin:${PATH}
279 fi
280
onqtamebc7da32017-05-13 21:33:19 +0300281 # Install OCLint
282 - |
283 if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then
onqtam0a2554a2018-05-09 13:09:58 +0300284 OCLINT_URL="https://github.com/oclint/oclint/releases/download/v0.12/oclint-0.12-x86_64-linux-3.13.0-112-generic.tar.gz"
onqtamebc7da32017-05-13 21:33:19 +0300285 mkdir oclint && travis_retry wget --no-check-certificate --quiet -O - ${OCLINT_URL} | tar --strip-components=1 -xz -C oclint
286 export PATH=${DEPS_DIR}/oclint/bin:${PATH}
287 fi
288
onqtamc7aaa962016-09-10 02:16:57 +0300289 # Go back to ${TRAVIS_BUILD_DIR}
onqtamc7aaa962016-09-10 02:16:57 +0300290 - cd ${TRAVIS_BUILD_DIR}
291
292 ############################################################################
onqtam01158572016-06-28 14:29:32 +0300293 # Install stuff with homebrew under OSX
294 ############################################################################
onqtamc7aaa962016-09-10 02:16:57 +0300295
onqtam23c6a342016-06-28 14:09:10 +0300296 - |
onqtame4c75fc2016-05-21 01:24:48 +0300297 if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
298 brew update
299 # brew install ccache
onqtam27a8c082017-04-04 17:42:41 +0300300 # brew install valgrind
onqtame4c75fc2016-05-21 01:24:48 +0300301 # cmake
302 if brew list -1 | grep -q "^cmake\$"; then
303 brew outdated cmake || brew upgrade cmake
304 else
305 brew install cmake
306 fi
307 # gcc
onqtame4c75fc2016-05-21 01:24:48 +0300308 if [[ "${COMPILER}" = "g++-4.9" ]]; then
309 brew install gcc49
310 fi
311 if [[ "${COMPILER}" = "g++-5" ]]; then
312 brew install gcc5
313 fi
314 if [[ "${COMPILER}" = "g++-6" ]]; then
315 brew install gcc6
onqtam26d5d652018-05-09 16:23:40 +0300316 brew link --overwrite gcc@6
onqtame4c75fc2016-05-21 01:24:48 +0300317 fi
onqtamaab98c52017-05-02 19:48:42 +0300318 if [[ "${COMPILER}" = "g++-7" ]]; then
319 brew install gcc7
onqtam26d5d652018-05-09 16:23:40 +0300320 brew link --overwrite gcc@7
onqtamaab98c52017-05-02 19:48:42 +0300321 fi
onqtamba6808f2018-05-09 12:00:28 +0300322 if [[ "${COMPILER}" = "g++-8" ]]; then
323 brew install gcc8
onqtam26d5d652018-05-09 16:23:40 +0300324 brew link --overwrite gcc@8
onqtamba6808f2018-05-09 12:00:28 +0300325 fi
onqtame4c75fc2016-05-21 01:24:48 +0300326 fi
onqtamf6d1a512017-05-01 13:56:12 +0300327
onqtame4c75fc2016-05-21 01:24:48 +0300328 - export CXX="${COMPILER}"
onqtam9f934f82016-08-02 12:42:19 +0300329# - export CXX="ccache ${COMPILER}"
onqtame4c75fc2016-05-21 01:24:48 +0300330# - ccache -s
onqtam7dec6aa2016-06-26 16:01:15 +0300331
332before_script:
333 - ${CXX} --version
onqtame4c75fc2016-05-21 01:24:48 +0300334
335script:
onqtam81eab5e2017-05-08 11:51:20 +0300336 # coverage
onqtame4c75fc2016-05-21 01:24:48 +0300337 - |
onqtamf6d1a512017-05-01 13:56:12 +0300338 if [[ "${CODE_COVERAGE}" = "true" ]]; then
onqtam8b8f2402018-05-29 19:05:14 +0300339 cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -std=c++0x" -DCMAKE_BUILD_TYPE=Debug . || exit 1
onqtam81eab5e2017-05-08 11:51:20 +0300340 make -k -j2 || exit 1
341 ctest --output-on-failure || exit 1
342
onqtamfdb8fcc2018-06-01 15:36:28 +0300343 lcov -d . -c -o coverage.info # parse coverage data
344 lcov -r coverage.info "/usr*" -o coverage.info # remove data for system headers
345 lcov -r coverage.info "$(readlink -f examples)/*" -o coverage.info # remove data for .cpp files
346 lcov -r coverage.info "$(readlink -f scripts)/*" -o coverage.info # remove data for .cpp files
347 lcov -l coverage.info # just list a short summary of the results
348 coveralls-lcov --repo-token=${COVERALLS_REPO_TOKEN} coverage.info # upload results
onqtam5a2b2552017-05-01 14:03:04 +0300349
onqtam81eab5e2017-05-08 11:51:20 +0300350 # do not continue with other build configurations after that
onqtame4c75fc2016-05-21 01:24:48 +0300351 exit
352 fi
353
onqtam81eab5e2017-05-08 11:51:20 +0300354 # static code analysis
onqtam21623a62017-04-27 21:47:46 +0300355 - |
onqtam0decb1d2017-04-30 19:37:29 +0300356 if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then
onqtamebc7da32017-05-13 21:33:19 +0300357 # setup a test file "doctest.cpp" that is the header + a test case at the end
358 echo "#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN\n" >> doctest.cpp
359 cat doctest/doctest.h >> doctest.cpp
onqtamc2b6e132017-05-08 16:37:31 +0300360 echo -e "TEST_CASE(\"\") {\n\tint a = 6;\n\tSUBCASE(\"\") a = 5;\n\tCAPTURE(a);\n\tCHECK(a == 6);\n}\n" >> doctest.cpp
361
onqtamebc7da32017-05-13 21:33:19 +0300362 # cppcheck
363 cppcheck doctest.cpp --enable=all --suppress=unmatchedSuppression --suppress=missingIncludeSystem --suppress=unusedFunction --suppress=functionConst --inline-suppr --platform=unix64 --inconclusive --std=posix --inconclusive -v --error-exitcode=1 --template "{file}({line}): {severity} ({id}): {message}"
364
365 # oclint
366 oclint doctest.cpp -disable-rule=ShortVariableName -disable-rule=LongLine -disable-rule=LongMethod -disable-rule=HighNcssMethod -disable-rule=LongVariableName -disable-rule=HighCyclomaticComplexity -disable-rule=HighNPathComplexity -disable-rule=UnusedLocalVariable -disable-rule=DoubleNegative -disable-rule=MultipleUnaryOperator -disable-rule=DeepNestedBlock || exit 1
onqtam81eab5e2017-05-08 11:51:20 +0300367
368 # clang-tidy
369 cd scripts/playground
onqtamc2b6e132017-05-08 16:37:31 +0300370 cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} . || exit 1
onqtam4d87d562018-07-03 22:23:42 +0300371 clang-tidy-4.0 -std=c++11 -p=. *.cpp -header-filter=.* -warnings-as-errors=* -checks='*,-misc-misplaced-widening-cast,-misc-macro-parentheses,-misc-definitions-in-headers,-misc-unused-parameters,-llvm-header-guard,-llvm-include-order,-google-readability-braces-around-statements,-google-runtime-references,-google-readability-todo,-google-build-using-namespace,-google-explicit-constructor,-cert-err58-cpp,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-special-member-functions,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-union-access,-clang-analyzer-security.insecureAPI.strcpy,-modernize-loop-convert,-modernize-use-auto,-modernize-use-bool-literals,-readability-braces-around-statements,-readability-named-parameter,-readability-else-after-return,-readability-redundant-declaration,-readability-implicit-bool-cast,-clang-diagnostic-variadic-macros,-clang-diagnostic-c++11-compat' || exit 1
onqtam81eab5e2017-05-08 11:51:20 +0300372
373 # do not continue with other build configurations after that
374 exit
375 fi
onqtam21623a62017-04-27 21:47:46 +0300376
onqtame4c75fc2016-05-21 01:24:48 +0300377 # initial run with options
onqtamcc350302016-06-28 14:36:28 +0300378 - cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} .
onqtame4c75fc2016-05-21 01:24:48 +0300379
onqtam1586ea22016-05-21 18:02:26 +0300380 # debug x64
onqtam8b8f2402018-05-29 19:05:14 +0300381 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m64" .
onqtam1586ea22016-05-21 18:02:26 +0300382 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300383 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi
384 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtam1586ea22016-05-21 18:02:26 +0300385 # release x64
onqtam8b8f2402018-05-29 19:05:14 +0300386 - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m64" .
onqtam1586ea22016-05-21 18:02:26 +0300387 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300388 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi
389 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtame4c75fc2016-05-21 01:24:48 +0300390 # debug x86
onqtam8b8f2402018-05-29 19:05:14 +0300391 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m32" .
onqtam316fce22016-05-21 16:57:13 +0300392 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300393 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi
394 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtame4c75fc2016-05-21 01:24:48 +0300395 # release x86
onqtam8b8f2402018-05-29 19:05:14 +0300396 - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m32" .
onqtam316fce22016-05-21 16:57:13 +0300397 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300398 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi
399 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtame4c75fc2016-05-21 01:24:48 +0300400
onqtam2cd4f082018-08-19 16:17:26 +0300401 # sanitizers - again 32/64 bit Debug/Release configs through address/undefined/thread sanitizers
onqtam56d91702017-04-16 21:03:58 +0300402 - cmake -DDOCTEST_TEST_MODE=NORMAL .
onqtame4c75fc2016-05-21 01:24:48 +0300403 # on separate commands because when something fails I want to see which one exactly
onqtam84b19bc2016-08-26 12:40:31 +0300404 # TODO: when this http://stackoverflow.com/questions/39081183 gets resolved - add these to ASAN as well: check_initialization_order=true:strict_init_order=true
onqtam2cd4f082018-08-19 16:17:26 +0300405 - export ASAN_OPTIONS=verbosity=2:strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true
406 - export UBSAN_OPTIONS=verbosity=2
407 - export TSAN_OPTIONS=verbosity=2:force_seq_cst_atomics=1
408 - if [[ "${HAS_ASAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m64 -fsanitize=address" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
409 - if [[ "${HAS_ASAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m32 -fsanitize=address" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
410 - if [[ "${HAS_ASAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m64 -fsanitize=address" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
411 - if [[ "${HAS_ASAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m32 -fsanitize=address" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
412 - if [[ "${HAS_UBSAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m64 -fsanitize=undefined" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
413 - if [[ "${HAS_UBSAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m32 -fsanitize=undefined" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
414 - if [[ "${HAS_UBSAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m64 -fsanitize=undefined" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
415 - if [[ "${HAS_UBSAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m32 -fsanitize=undefined" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
416 - if [[ "${HAS_TSAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m64 -fsanitize=thread -pie -fPIE -ltsan" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
417 #- if [[ "${HAS_TSAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m32 -fsanitize=thread -pie -fPIE -ltsan" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
418 - if [[ "${HAS_TSAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m64 -fsanitize=thread -pie -fPIE -ltsan" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
419 #- if [[ "${HAS_TSAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -g -fno-omit-frame-pointer -m32 -fsanitize=thread -pie -fPIE -ltsan" . && make clean && make -k -j2 && ctest --output-on-failure ; fi
onqtam5cab8e92016-10-10 17:58:38 +0300420
onqtam7a3ad262017-03-18 18:05:10 +0200421 # test without rtti - just Debug/x64
onqtam8b8f2402018-05-29 19:05:14 +0300422 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m64 -fno-rtti" .
onqtamf63c5102017-02-25 20:00:52 +0200423 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300424 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtamf63c5102017-02-25 20:00:52 +0200425
onqtam7a3ad262017-03-18 18:05:10 +0200426 # test only compilation without exceptions - just Debug/x64
onqtam8b8f2402018-05-29 19:05:14 +0300427 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m64 -fno-exceptions -DDOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS" .
onqtam2d93e042017-03-17 18:57:59 +0200428 - make clean && make -k -j2
429
onqtame4c75fc2016-05-21 01:24:48 +0300430# - ccache -s
431
onqtam2dd55282016-06-13 18:05:38 +0300432#after_script:
433# - cat compile_commands.json