blob: 04daf27a6b70da5cdba87a84fd05a6058220d4fa [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
onqtam803bb8f2017-09-05 13:00:24 +030044 - llvm-toolchain-trusty-3.9
onqtam3bf83c42017-04-23 15:30:23 +030045 - llvm-toolchain-trusty-4.0
onqtam803bb8f2017-09-05 13:00:24 +030046 - llvm-toolchain-trusty-5.0
onqtamcb279b22018-03-09 01:31:09 +070047 - llvm-toolchain-trusty-6.0
onqtame4c75fc2016-05-21 01:24:48 +030048
49compiler: clang
50os: linux
51
52matrix:
onqtame4c75fc2016-05-21 01:24:48 +030053 include:
onqtamd1737e42016-08-01 19:05:07 +030054 # coverage
onqtamf6d1a512017-05-01 13:56:12 +030055 - env: COMPILER=g++ CODE_COVERAGE=true
onqtamd1737e42016-08-01 19:05:07 +030056 compiler: gcc
57 addons:
58 apt:
onqtamf6d1a512017-05-01 13:56:12 +030059 packages: ["lcov"]
onqtamd1737e42016-08-01 19:05:07 +030060
onqtamaec53d22017-05-03 06:29:47 +030061 # static code analysis
onqtam8c3352f2018-05-09 12:09:32 +030062 - env: COMPILER=clang++-4.0 STATIC_CODE_ANALYSIS=true
63 addons: &static_analysis
onqtamaec53d22017-05-03 06:29:47 +030064 apt:
onqtam8c3352f2018-05-09 12:09:32 +030065 packages: ["clang-4.0", "clang-tidy-4.0", "cppcheck"]
onqtamaec53d22017-05-03 06:29:47 +030066 sources: *apt_sources
67
onqtamaec53d22017-05-03 06:29:47 +030068 # GCC 4.7
69 - env: COMPILER=g++-4.7
70 compiler: gcc
71 addons: &gcc47
72 apt:
onqtamd43ae6d2018-05-29 23:40:00 +030073 packages: ["g++-4.7", "valgrind", "g++-4.7-multilib", "libc6-dbg", "libc6-dbg:i386", "linux-libc-dev", "linux-libc-dev:i386"]
onqtamaec53d22017-05-03 06:29:47 +030074 sources: *apt_sources
75
76 # GCC 4.8
77 - env: COMPILER=g++-4.8 HAS_ASAN_32=true HAS_ASAN_64=true
78 compiler: gcc
79 addons: &gcc48
80 apt:
onqtamd43ae6d2018-05-29 23:40:00 +030081 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 +030082 sources: *apt_sources
83
84 # GCC 4.9
85 - env: COMPILER=g++-4.9 HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true # no ASAN_32 - errors when using ASAN_OPTIONS - probably g++ 4.9 bug
86 compiler: gcc
87 addons: &gcc49
88 apt:
onqtamd43ae6d2018-05-29 23:40:00 +030089 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 +030090 sources: *apt_sources
91
92 # GCC 5
93 - env: COMPILER=g++-5 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true ADDITIONAL_CXX_FLAGS=" -fuse-ld=gold"
94 compiler: gcc
95 addons: &gcc5
96 apt:
onqtamd43ae6d2018-05-29 23:40:00 +030097 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 +030098 sources: *apt_sources
99
100 # GCC 6
101 - env: COMPILER=g++-6 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true ADDITIONAL_CXX_FLAGS=" -fuse-ld=gold"
102 compiler: gcc
103 addons: &gcc6
104 apt:
onqtamd43ae6d2018-05-29 23:40:00 +0300105 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 +0300106 sources: *apt_sources
107
108 # GCC 7
109 - env: COMPILER=g++-7 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true ADDITIONAL_CXX_FLAGS=" -fuse-ld=gold"
110 compiler: gcc
onqtam051def32018-05-09 11:30:10 +0300111 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamaec53d22017-05-03 06:29:47 +0300112 addons: &gcc7
113 apt:
onqtamd43ae6d2018-05-29 23:40:00 +0300114 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 +0300115 sources: *apt_sources
116
onqtame5f8b672018-05-03 16:02:32 +0300117 # GCC 8
118 - env: COMPILER=g++-8 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true ADDITIONAL_CXX_FLAGS=" -fuse-ld=gold"
119 compiler: gcc
onqtam051def32018-05-09 11:30:10 +0300120 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtame5f8b672018-05-03 16:02:32 +0300121 addons: &gcc8
122 apt:
onqtamd43ae6d2018-05-29 23:40:00 +0300123 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 +0300124 sources: *apt_sources
125
onqtamaec53d22017-05-03 06:29:47 +0300126 # Clang 3.5
127 - env: COMPILER=clang++-3.5 HAS_ASAN_64=true HAS_UBSAN_64=true
128 addons: &clang35
129 apt:
130 packages: ["clang-3.5", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
131 sources: *apt_sources
132
133 # Clang 3.6
134 - env: COMPILER=clang++-3.6 HAS_ASAN_64=true HAS_UBSAN_64=true
135 addons: &clang36
136 apt:
137 packages: ["clang-3.6", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
138 sources: *apt_sources
139
140 # Clang 3.7
141 - env: COMPILER=clang++-3.7
142 addons: &clang37
143 apt:
144 packages: ["clang-3.7", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
145 sources: *apt_sources
146
147 # Clang 3.8
148 - env: COMPILER=clang++-3.8 HAS_ASAN_64=true HAS_UBSAN_64=true
149 addons: &clang38
150 apt:
151 packages: ["clang-3.8", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
152 sources: *apt_sources
153
154 # Clang 3.9
155 - env: COMPILER=clang++-3.9 HAS_ASAN_64=true HAS_UBSAN_64=true
156 addons: &clang39
157 apt:
158 packages: ["clang-3.9", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
159 sources: *apt_sources
160
161 # Clang 4.0
162 - env: COMPILER=clang++-4.0 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
onqtam051def32018-05-09 11:30:10 +0300163 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamaec53d22017-05-03 06:29:47 +0300164 addons: &clang40
165 apt:
166 packages: ["clang-4.0", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
167 sources: *apt_sources
168
onqtam803bb8f2017-09-05 13:00:24 +0300169 # Clang 5.0
170 - env: COMPILER=clang++-5.0 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
onqtam051def32018-05-09 11:30:10 +0300171 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtam803bb8f2017-09-05 13:00:24 +0300172 addons: &clang50
173 apt:
174 packages: ["clang-5.0", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
175 sources: *apt_sources
176
onqtamcb279b22018-03-09 01:31:09 +0700177 # Clang 6.0
onqtam8c3352f2018-05-09 12:09:32 +0300178 - env: COMPILER=clang++-6.0 HAS_ASAN_64=true HAS_UBSAN_64=true # no ASAN_32/UBSAN_32 - errors:
onqtam051def32018-05-09 11:30:10 +0300179 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamcb279b22018-03-09 01:31:09 +0700180 addons: &clang60
181 apt:
182 packages: ["clang-6.0", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"]
183 sources: *apt_sources
184
onqtamaec53d22017-05-03 06:29:47 +0300185 # Xcode 6.4 Clang
186 - env: COMPILER=clang++
187 osx_image: xcode6.4
188 os: osx
189
190 # Xcode 7.3 Clang
191 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_ASAN_64=true
192 osx_image: xcode7.3
193 os: osx
194
195 # Xcode 8 Clang
196 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_ASAN_64=true
197 osx_image: xcode8
198 os: osx
199
onqtamaec53d22017-05-03 06:29:47 +0300200 # Xcode 8.3 Clang
201 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
202 osx_image: xcode8.3
203 os: osx
204
onqtam8603d872017-10-06 10:53:25 +0300205 # Xcode 9 Clang
206 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
207 osx_image: xcode9
208 os: osx
209
210 # Xcode 9.1 Clang
211 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
212 osx_image: xcode9.1
213 os: osx
214
onqtam50cbb802017-12-09 17:17:39 +0200215 # Xcode 9.2 Clang
216 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
217 osx_image: xcode9.2
218 os: osx
219
onqtam3a3bc202018-04-10 13:54:28 +0300220 # Xcode 9.3 Clang
221 - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
222 osx_image: xcode9.3
223 os: osx
224
onqtamaec53d22017-05-03 06:29:47 +0300225 # OSX GCC 4.9
226 - env: COMPILER=g++-4.9 HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true # no ASAN_32 - errors when using ASAN_OPTIONS - probably g++ 4.9 bug
227 compiler: gcc
228 osx_image: xcode6.4
229 os: osx
230
231 # OSX GCC 5
232 - env: COMPILER=g++-5 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
233 compiler: gcc
234 osx_image: xcode7.3
235 os: osx
236
237 # OSX GCC 6
238 - env: COMPILER=g++-6 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
239 compiler: gcc
onqtam8c3352f2018-05-09 12:09:32 +0300240 osx_image: xcode9.3
onqtamaec53d22017-05-03 06:29:47 +0300241 os: osx
242
243 # OSX GCC 7
244 - env: COMPILER=g++-7 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
245 compiler: gcc
onqtam8c3352f2018-05-09 12:09:32 +0300246 osx_image: xcode9.3
onqtamaec53d22017-05-03 06:29:47 +0300247 os: osx
248
onqtamba6808f2018-05-09 12:00:28 +0300249 # OSX GCC 8
250 - env: COMPILER=g++-8 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
251 compiler: gcc
onqtam8c3352f2018-05-09 12:09:32 +0300252 osx_image: xcode9.3
onqtamba6808f2018-05-09 12:00:28 +0300253 os: osx
254
onqtamaec53d22017-05-03 06:29:47 +0300255 # OSX LLVM-GCC
256 - env: COMPILER=g++ HAS_ASAN_32=true HAS_ASAN_64=true
257 compiler: gcc
258 os: osx
259
260 allow_failures:
261
onqtamd6e86612018-05-31 14:32:16 +0300262 # static code analysis
263 - env: COMPILER=clang++-4.0 STATIC_CODE_ANALYSIS=true
264
onqtam803bb8f2017-09-05 13:00:24 +0300265 # Clang 3.7
266 - env: COMPILER=clang++-3.7
267
268 # Clang 3.9
269 - env: COMPILER=clang++-3.9 HAS_ASAN_64=true HAS_UBSAN_64=true
270
onqtamaec53d22017-05-03 06:29:47 +0300271 # OSX GCC 6
272 - env: COMPILER=g++-6 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
273 compiler: gcc
onqtam8c3352f2018-05-09 12:09:32 +0300274 osx_image: xcode9.3
onqtamaec53d22017-05-03 06:29:47 +0300275 os: osx
276
onqtam803bb8f2017-09-05 13:00:24 +0300277 # OSX GCC 7
onqtamaec53d22017-05-03 06:29:47 +0300278 - env: COMPILER=g++-7 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
279 compiler: gcc
onqtam8c3352f2018-05-09 12:09:32 +0300280 osx_image: xcode9.3
onqtamaec53d22017-05-03 06:29:47 +0300281 os: osx
onqtamb1a3de82016-10-10 22:22:00 +0300282
onqtamba6808f2018-05-09 12:00:28 +0300283 # OSX GCC 8
284 - env: COMPILER=g++-8 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true
285 compiler: gcc
onqtam8c3352f2018-05-09 12:09:32 +0300286 osx_image: xcode9.3
onqtamba6808f2018-05-09 12:00:28 +0300287 os: osx
288
onqtam2c8036f2016-06-26 17:12:42 +0300289install:
onqtamf6d1a512017-05-01 13:56:12 +0300290 - if [[ "${CODE_COVERAGE}" == "true" ]]; then gem install coveralls-lcov ; fi
291
onqtam01158572016-06-28 14:29:32 +0300292 ############################################################################
onqtamc7aaa962016-09-10 02:16:57 +0300293 # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/
294 ############################################################################
295
onqtam5a2b2552017-05-01 14:03:04 +0300296 # Make a dir for all
onqtamc7aaa962016-09-10 02:16:57 +0300297 - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
298 - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
299
onqtamc7aaa962016-09-10 02:16:57 +0300300 # Install a recent CMake
onqtamc7aaa962016-09-10 02:16:57 +0300301 - |
302 if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
onqtam84015352017-03-15 20:11:07 +0200303 CMAKE_URL="http://www.cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
onqtamc7aaa962016-09-10 02:16:57 +0300304 mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
305 export PATH=${DEPS_DIR}/cmake/bin:${PATH}
306 fi
307
onqtamebc7da32017-05-13 21:33:19 +0300308 # Install OCLint
309 - |
310 if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then
onqtam0a2554a2018-05-09 13:09:58 +0300311 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 +0300312 mkdir oclint && travis_retry wget --no-check-certificate --quiet -O - ${OCLINT_URL} | tar --strip-components=1 -xz -C oclint
313 export PATH=${DEPS_DIR}/oclint/bin:${PATH}
314 fi
315
onqtamc7aaa962016-09-10 02:16:57 +0300316 # Go back to ${TRAVIS_BUILD_DIR}
onqtamc7aaa962016-09-10 02:16:57 +0300317 - cd ${TRAVIS_BUILD_DIR}
318
319 ############################################################################
onqtam01158572016-06-28 14:29:32 +0300320 # Install stuff with homebrew under OSX
321 ############################################################################
onqtamc7aaa962016-09-10 02:16:57 +0300322
onqtam23c6a342016-06-28 14:09:10 +0300323 - |
onqtame4c75fc2016-05-21 01:24:48 +0300324 if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
325 brew update
326 # brew install ccache
onqtam27a8c082017-04-04 17:42:41 +0300327 # brew install valgrind
onqtame4c75fc2016-05-21 01:24:48 +0300328 # cmake
329 if brew list -1 | grep -q "^cmake\$"; then
330 brew outdated cmake || brew upgrade cmake
331 else
332 brew install cmake
333 fi
334 # gcc
onqtame4c75fc2016-05-21 01:24:48 +0300335 if [[ "${COMPILER}" = "g++-4.9" ]]; then
336 brew install gcc49
337 fi
338 if [[ "${COMPILER}" = "g++-5" ]]; then
339 brew install gcc5
340 fi
341 if [[ "${COMPILER}" = "g++-6" ]]; then
342 brew install gcc6
onqtam26d5d652018-05-09 16:23:40 +0300343 brew link --overwrite gcc@6
onqtame4c75fc2016-05-21 01:24:48 +0300344 fi
onqtamaab98c52017-05-02 19:48:42 +0300345 if [[ "${COMPILER}" = "g++-7" ]]; then
346 brew install gcc7
onqtam26d5d652018-05-09 16:23:40 +0300347 brew link --overwrite gcc@7
onqtamaab98c52017-05-02 19:48:42 +0300348 fi
onqtamba6808f2018-05-09 12:00:28 +0300349 if [[ "${COMPILER}" = "g++-8" ]]; then
350 brew install gcc8
onqtam26d5d652018-05-09 16:23:40 +0300351 brew link --overwrite gcc@8
onqtamba6808f2018-05-09 12:00:28 +0300352 fi
onqtame4c75fc2016-05-21 01:24:48 +0300353 fi
onqtamf6d1a512017-05-01 13:56:12 +0300354
onqtame4c75fc2016-05-21 01:24:48 +0300355 - export CXX="${COMPILER}"
onqtam9f934f82016-08-02 12:42:19 +0300356# - export CXX="ccache ${COMPILER}"
onqtame4c75fc2016-05-21 01:24:48 +0300357# - ccache -s
onqtam7dec6aa2016-06-26 16:01:15 +0300358
359before_script:
360 - ${CXX} --version
onqtame4c75fc2016-05-21 01:24:48 +0300361
362script:
onqtam81eab5e2017-05-08 11:51:20 +0300363 # coverage
onqtame4c75fc2016-05-21 01:24:48 +0300364 - |
onqtamf6d1a512017-05-01 13:56:12 +0300365 if [[ "${CODE_COVERAGE}" = "true" ]]; then
onqtam8b8f2402018-05-29 19:05:14 +0300366 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 +0300367 make -k -j2 || exit 1
368 ctest --output-on-failure || exit 1
369
onqtamf6d1a512017-05-01 13:56:12 +0300370 lcov -d . -c -o coverage.info # parse coverage data
371 lcov -r coverage.info "/usr*" "$(readlink -f examples)/*" -o coverage.info # remove data for system headers and .cpp files
372 lcov -l coverage.info # just list a short summary of the results
onqtama6a866f2017-08-28 12:31:43 +0300373 coveralls-lcov --repo-token=${COVERALLS_REPO_TOKEN} coverage.info # upload results
onqtam5a2b2552017-05-01 14:03:04 +0300374
onqtam81eab5e2017-05-08 11:51:20 +0300375 # do not continue with other build configurations after that
onqtame4c75fc2016-05-21 01:24:48 +0300376 exit
377 fi
378
onqtam81eab5e2017-05-08 11:51:20 +0300379 # static code analysis
onqtam21623a62017-04-27 21:47:46 +0300380 - |
onqtam0decb1d2017-04-30 19:37:29 +0300381 if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then
onqtamebc7da32017-05-13 21:33:19 +0300382 # setup a test file "doctest.cpp" that is the header + a test case at the end
383 echo "#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN\n" >> doctest.cpp
384 cat doctest/doctest.h >> doctest.cpp
onqtamc2b6e132017-05-08 16:37:31 +0300385 echo -e "TEST_CASE(\"\") {\n\tint a = 6;\n\tSUBCASE(\"\") a = 5;\n\tCAPTURE(a);\n\tCHECK(a == 6);\n}\n" >> doctest.cpp
386
onqtamebc7da32017-05-13 21:33:19 +0300387 # cppcheck
388 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}"
389
390 # oclint
391 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 +0300392
393 # clang-tidy
394 cd scripts/playground
onqtamc2b6e132017-05-08 16:37:31 +0300395 cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} . || exit 1
onqtam42fa9c42018-05-30 00:25:05 +0300396 clang-tidy-4.0 -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-use-nullptr,-modernize-use-equals-default,-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' || exit 1
onqtam81eab5e2017-05-08 11:51:20 +0300397
398 # do not continue with other build configurations after that
399 exit
400 fi
onqtam21623a62017-04-27 21:47:46 +0300401
onqtame4c75fc2016-05-21 01:24:48 +0300402 # initial run with options
onqtamcc350302016-06-28 14:36:28 +0300403 - cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} .
onqtame4c75fc2016-05-21 01:24:48 +0300404
onqtam1586ea22016-05-21 18:02:26 +0300405 # debug x64
onqtam8b8f2402018-05-29 19:05:14 +0300406 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m64" .
onqtam1586ea22016-05-21 18:02:26 +0300407 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300408 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi
409 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtam1586ea22016-05-21 18:02:26 +0300410 # release x64
onqtam8b8f2402018-05-29 19:05:14 +0300411 - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m64" .
onqtam1586ea22016-05-21 18:02:26 +0300412 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300413 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi
414 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtame4c75fc2016-05-21 01:24:48 +0300415 # debug x86
onqtam8b8f2402018-05-29 19:05:14 +0300416 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m32" .
onqtam316fce22016-05-21 16:57:13 +0300417 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300418 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi
419 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtame4c75fc2016-05-21 01:24:48 +0300420 # release x86
onqtam8b8f2402018-05-29 19:05:14 +0300421 - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m32" .
onqtam316fce22016-05-21 16:57:13 +0300422 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300423 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi
424 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtame4c75fc2016-05-21 01:24:48 +0300425
426 # sanitizers - again 32/64 bit Debug/Release configs through address/undefined sanitizers
onqtam56d91702017-04-16 21:03:58 +0300427 - cmake -DDOCTEST_TEST_MODE=NORMAL .
onqtame4c75fc2016-05-21 01:24:48 +0300428 # on separate commands because when something fails I want to see which one exactly
onqtam84b19bc2016-08-26 12:40:31 +0300429 # TODO: when this http://stackoverflow.com/questions/39081183 gets resolved - add these to ASAN as well: check_initialization_order=true:strict_init_order=true
onqtam8b8f2402018-05-29 19:05:14 +0300430 - 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 && ASAN_OPTIONS=verbosity=2:strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true ctest --output-on-failure ; fi
431 - 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 && ASAN_OPTIONS=verbosity=2:strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true ctest --output-on-failure ; fi
432 - 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 && ASAN_OPTIONS=verbosity=2:strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true ctest --output-on-failure ; fi
433 - 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 && ASAN_OPTIONS=verbosity=2:strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true ctest --output-on-failure ; fi
434 - 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 && UBSAN_OPTIONS=verbosity=2 ctest --output-on-failure ; fi
435 - 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 && UBSAN_OPTIONS=verbosity=2 ctest --output-on-failure ; fi
436 - 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 && UBSAN_OPTIONS=verbosity=2 ctest --output-on-failure ; fi
437 - 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 && UBSAN_OPTIONS=verbosity=2 ctest --output-on-failure ; fi
onqtam5cab8e92016-10-10 17:58:38 +0300438
onqtam7a3ad262017-03-18 18:05:10 +0200439 # test without rtti - just Debug/x64
onqtam8b8f2402018-05-29 19:05:14 +0300440 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m64 -fno-rtti" .
onqtamf63c5102017-02-25 20:00:52 +0200441 - make clean && make -k -j2
onqtam56d91702017-04-16 21:03:58 +0300442 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure
onqtamf63c5102017-02-25 20:00:52 +0200443
onqtam7a3ad262017-03-18 18:05:10 +0200444 # test only compilation without exceptions - just Debug/x64
onqtam8b8f2402018-05-29 19:05:14 +0300445 - 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 +0200446 - make clean && make -k -j2
447
onqtame4c75fc2016-05-21 01:24:48 +0300448# - ccache -s
449
onqtam2dd55282016-06-13 18:05:38 +0300450#after_script:
451# - cat compile_commands.json