blob: f0c78e63b0d10f734e947122618ca2601517838c [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 +03004language: c++
5
6notifications:
onqtamf5169772016-09-09 18:33:13 +03007 email: false
onqtame4c75fc2016-05-21 01:24:48 +03008 # gitter
9 webhooks:
10 urls: https://webhooks.gitter.im/e/10941dd1c67e5e967706
11 on_success: change
12 on_failure: always
13git:
onqtam9f934f82016-08-02 12:42:19 +030014 depth: 500
onqtame4c75fc2016-05-21 01:24:48 +030015
16# both apt and ccache make the builds slower...
17#cache:
18# - apt
19# - ccache
20
21env:
22 global:
23# - USE_CCACHE=1
24# - CCACHE_SLOPPINESS=pch_defines,time_macros
25# - CCACHE_COMPRESS=1
26# - CCACHE_MAXSIZE=200M
27# - CCACHE_CPP2=1
28 - CMAKE_OPTIONS_GLOBAL="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
onqtame4c75fc2016-05-21 01:24:48 +030029
30addons:
31 coverity_scan:
32 # COVERITY_SCAN_TOKEN added as env var in travis project
33 project:
34 name: onqtam/doctest
35 notification_email: vik.kirilov@gmail.com
onqtam92a9ce12017-05-29 23:56:22 +030036 build_command: clang++ scripts/hello_world.cpp -I doctest
onqtame4c75fc2016-05-21 01:24:48 +030037 branch_pattern: coverity_scan
38 # these apt sources will be referenced later (by using *name)
39 apt:
onqtam2c8036f2016-06-26 17:12:42 +030040 sources: &apt_sources
41 - ubuntu-toolchain-r-test
onqtam3bf83c42017-04-23 15:30:23 +030042 - llvm-toolchain-trusty
onqtam1cb49f82018-06-01 11:44:43 +030043 - llvm-toolchain-precise-3.7
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
AMS2115274822018-11-12 08:55:30 +010048 - llvm-toolchain-trusty-7
onqtam08754062019-03-20 18:53:33 +020049 - llvm-toolchain-trusty-8
onqtam399b01a2020-02-24 19:12:30 +020050 - llvm-toolchain-trusty-9
Viktor Kirilovb1790b82020-09-06 19:49:29 +030051 - llvm-toolchain-trusty-10
onqtame4c75fc2016-05-21 01:24:48 +030052
53compiler: clang
54os: linux
55
56matrix:
onqtame4c75fc2016-05-21 01:24:48 +030057 include:
onqtamd1737e42016-08-01 19:05:07 +030058 # coverage
onqtamf6d1a512017-05-01 13:56:12 +030059 - env: COMPILER=g++ CODE_COVERAGE=true
onqtamd1737e42016-08-01 19:05:07 +030060 compiler: gcc
61 addons:
62 apt:
onqtamf6d1a512017-05-01 13:56:12 +030063 packages: ["lcov"]
onqtamd1737e42016-08-01 19:05:07 +030064
onqtamaec53d22017-05-03 06:29:47 +030065 # static code analysis
onqtam8c3352f2018-05-09 12:09:32 +030066 - env: COMPILER=clang++-4.0 STATIC_CODE_ANALYSIS=true
67 addons: &static_analysis
onqtamaec53d22017-05-03 06:29:47 +030068 apt:
onqtam8c3352f2018-05-09 12:09:32 +030069 packages: ["clang-4.0", "clang-tidy-4.0", "cppcheck"]
onqtamaec53d22017-05-03 06:29:47 +030070 sources: *apt_sources
71
onqtamaec53d22017-05-03 06:29:47 +030072 # GCC 4.8
onqtam9e060732019-10-11 08:37:41 +030073 - env: COMPILER=g++-4.8 HAS_ASAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults
onqtamaec53d22017-05-03 06:29:47 +030074 compiler: gcc
75 addons: &gcc48
76 apt:
onqtam589fd212018-08-19 16:48:17 +030077 packages: ["g++-4.8", "valgrind", "libc6-dbg", "linux-libc-dev"]
onqtamaec53d22017-05-03 06:29:47 +030078 sources: *apt_sources
79
80 # GCC 4.9
onqtam9e060732019-10-11 08:37:41 +030081 - env: COMPILER=g++-4.9 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults
onqtamaec53d22017-05-03 06:29:47 +030082 compiler: gcc
83 addons: &gcc49
84 apt:
onqtam589fd212018-08-19 16:48:17 +030085 packages: ["g++-4.9", "valgrind", "libc6-dbg", "linux-libc-dev"]
onqtamaec53d22017-05-03 06:29:47 +030086 sources: *apt_sources
87
88 # GCC 5
onqtam9e060732019-10-11 08:37:41 +030089 - env: COMPILER=g++-5 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults
onqtamaec53d22017-05-03 06:29:47 +030090 compiler: gcc
91 addons: &gcc5
92 apt:
onqtam589fd212018-08-19 16:48:17 +030093 packages: ["g++-5", "valgrind", "libc6-dbg", "linux-libc-dev"]
onqtamaec53d22017-05-03 06:29:47 +030094 sources: *apt_sources
95
96 # GCC 6
onqtam9e060732019-10-11 08:37:41 +030097 - env: COMPILER=g++-6 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults
onqtamaec53d22017-05-03 06:29:47 +030098 compiler: gcc
99 addons: &gcc6
100 apt:
onqtam589fd212018-08-19 16:48:17 +0300101 packages: ["g++-6", "valgrind", "libc6-dbg", "linux-libc-dev"]
onqtamaec53d22017-05-03 06:29:47 +0300102 sources: *apt_sources
103
104 # GCC 7
onqtam9e060732019-10-11 08:37:41 +0300105 - env: COMPILER=g++-7 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults
onqtamaec53d22017-05-03 06:29:47 +0300106 compiler: gcc
onqtam051def32018-05-09 11:30:10 +0300107 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamaec53d22017-05-03 06:29:47 +0300108 addons: &gcc7
109 apt:
onqtam589fd212018-08-19 16:48:17 +0300110 packages: ["g++-7", "valgrind", "libc6-dbg", "linux-libc-dev"]
onqtamaec53d22017-05-03 06:29:47 +0300111 sources: *apt_sources
112
onqtame5f8b672018-05-03 16:02:32 +0300113 # GCC 8
onqtam9e060732019-10-11 08:37:41 +0300114 - env: COMPILER=g++-8 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan"
onqtame5f8b672018-05-03 16:02:32 +0300115 compiler: gcc
onqtam051def32018-05-09 11:30:10 +0300116 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtame5f8b672018-05-03 16:02:32 +0300117 addons: &gcc8
118 apt:
onqtam589fd212018-08-19 16:48:17 +0300119 packages: ["g++-8", "valgrind", "libc6-dbg", "linux-libc-dev"]
onqtame5f8b672018-05-03 16:02:32 +0300120 sources: *apt_sources
121
onqtam0df6ead2019-05-06 11:18:28 +0300122 # GCC 9
onqtam9e060732019-10-11 08:37:41 +0300123 - env: COMPILER=g++-9 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan"
onqtam0df6ead2019-05-06 11:18:28 +0300124 compiler: gcc
125 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
126 addons: &gcc9
127 apt:
128 packages: ["g++-9", "valgrind", "libc6-dbg", "linux-libc-dev"]
129 sources: *apt_sources
130
onqtamea792bc2020-05-17 18:21:55 +0300131 # GCC 10
132 - env: COMPILER=g++-10 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan"
133 compiler: gcc
134 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
135 addons: &gcc10
136 apt:
137 packages: ["g++-10", "valgrind", "libc6-dbg", "linux-libc-dev"]
138 sources: *apt_sources
139
onqtamaec53d22017-05-03 06:29:47 +0300140 # Clang 3.5
onqtam3c549c92018-08-19 23:14:34 +0300141 - env: COMPILER=clang++-3.5 HAS_ASAN=true HAS_UBSAN=true # no HAS_TSAN - see errors: https://travis-ci.org/onqtam/doctest/builds/417926743
onqtamaec53d22017-05-03 06:29:47 +0300142 addons: &clang35
143 apt:
onqtam589fd212018-08-19 16:48:17 +0300144 packages: ["clang-3.5", "valgrind", "libc6-dbg", "g++-6"]
onqtamaec53d22017-05-03 06:29:47 +0300145 sources: *apt_sources
146
147 # Clang 3.6
onqtam3c549c92018-08-19 23:14:34 +0300148 - env: COMPILER=clang++-3.6 HAS_ASAN=true HAS_UBSAN=true # no HAS_TSAN - see errors: https://travis-ci.org/onqtam/doctest/builds/417926743
onqtamaec53d22017-05-03 06:29:47 +0300149 addons: &clang36
150 apt:
onqtam589fd212018-08-19 16:48:17 +0300151 packages: ["clang-3.6", "valgrind", "libc6-dbg", "g++-6"]
onqtamaec53d22017-05-03 06:29:47 +0300152 sources: *apt_sources
153
154 # Clang 3.7
155 - env: COMPILER=clang++-3.7
156 addons: &clang37
157 apt:
onqtam589fd212018-08-19 16:48:17 +0300158 packages: ["clang-3.7", "valgrind", "libc6-dbg", "g++-6"]
onqtamaec53d22017-05-03 06:29:47 +0300159 sources: *apt_sources
160
161 # Clang 3.8
onqtam3c549c92018-08-19 23:14:34 +0300162 - env: COMPILER=clang++-3.8 HAS_ASAN=true HAS_UBSAN=true # no HAS_TSAN - see errors: https://travis-ci.org/onqtam/doctest/builds/417926743
onqtamaec53d22017-05-03 06:29:47 +0300163 addons: &clang38
164 apt:
onqtam589fd212018-08-19 16:48:17 +0300165 packages: ["clang-3.8", "valgrind", "libc6-dbg", "g++-6"]
onqtamaec53d22017-05-03 06:29:47 +0300166 sources: *apt_sources
167
168 # Clang 3.9
onqtamd9d22d72018-08-19 19:28:03 +0300169 - env: COMPILER=clang++-3.9 # no HAS_ASAN/HAS_UBSAN - see errors: https://travis-ci.org/onqtam/doctest/jobs/386263910
onqtamaec53d22017-05-03 06:29:47 +0300170 addons: &clang39
171 apt:
onqtam589fd212018-08-19 16:48:17 +0300172 packages: ["clang-3.9", "valgrind", "libc6-dbg", "g++-6"]
onqtamaec53d22017-05-03 06:29:47 +0300173 sources: *apt_sources
174
175 # Clang 4.0
onqtamd9d22d72018-08-19 19:28:03 +0300176 - env: COMPILER=clang++-4.0 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
onqtam051def32018-05-09 11:30:10 +0300177 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamaec53d22017-05-03 06:29:47 +0300178 addons: &clang40
179 apt:
onqtam589fd212018-08-19 16:48:17 +0300180 packages: ["clang-4.0", "valgrind", "libc6-dbg", "g++-6"]
onqtamaec53d22017-05-03 06:29:47 +0300181 sources: *apt_sources
182
onqtam803bb8f2017-09-05 13:00:24 +0300183 # Clang 5.0
onqtamd9d22d72018-08-19 19:28:03 +0300184 - env: COMPILER=clang++-5.0 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
onqtam051def32018-05-09 11:30:10 +0300185 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtam803bb8f2017-09-05 13:00:24 +0300186 addons: &clang50
187 apt:
onqtam589fd212018-08-19 16:48:17 +0300188 packages: ["clang-5.0", "valgrind", "libc6-dbg", "g++-6"]
onqtam803bb8f2017-09-05 13:00:24 +0300189 sources: *apt_sources
190
onqtamcb279b22018-03-09 01:31:09 +0700191 # Clang 6.0
onqtamd9d22d72018-08-19 19:28:03 +0300192 - env: COMPILER=clang++-6.0 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
onqtam589fd212018-08-19 16:48:17 +0300193 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
onqtamcb279b22018-03-09 01:31:09 +0700194 addons: &clang60
195 apt:
onqtam589fd212018-08-19 16:48:17 +0300196 packages: ["clang-6.0", "valgrind", "libc6-dbg", "g++-6"]
onqtamcb279b22018-03-09 01:31:09 +0700197 sources: *apt_sources
onqtam08754062019-03-20 18:53:33 +0200198
AMS2115274822018-11-12 08:55:30 +0100199 # Clang 7
200 - env: COMPILER=clang++-7 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
201 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
202 addons: &clang7
203 apt:
204 packages: ["clang-7", "valgrind", "libc6-dbg", "g++-6"]
205 sources: *apt_sources
onqtamcb279b22018-03-09 01:31:09 +0700206
onqtam08754062019-03-20 18:53:33 +0200207 # Clang 8
208 - env: COMPILER=clang++-8 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
209 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
210 addons: &clang8
211 apt:
212 packages: ["clang-8", "valgrind", "libc6-dbg", "g++-6"]
213 sources: *apt_sources
214
onqtam399b01a2020-02-24 19:12:30 +0200215 # Clang 9
216 - env: COMPILER=clang++-9 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
217 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
218 addons: &clang9
219 apt:
220 packages: ["clang-9", "valgrind", "libc6-dbg", "g++-6"]
221 sources: *apt_sources
222
Viktor Kirilovb1790b82020-09-06 19:49:29 +0300223 # Clang 10
224 - env: COMPILER=clang++-10 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
225 sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033
226 addons: &clang9
227 apt:
228 packages: ["clang-10", "valgrind", "libc6-dbg", "g++-6"]
229 sources: *apt_sources
onqtam50cbb802017-12-09 17:17:39 +0200230
onqtam7c606ea2018-08-15 10:16:21 +0300231 # Xcode 9.4 Clang
onqtam589fd212018-08-19 16:48:17 +0300232 - env: COMPILER=clang++ HAS_UBSAN=true HAS_TSAN=true # no HAS_ASAN - 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 +0300233 osx_image: xcode9.4
onqtam3a3bc202018-04-10 13:54:28 +0300234 os: osx
235
onqtam09fd51d2018-08-16 19:55:21 +0300236 # Xcode 10.0 Clang
onqtam589fd212018-08-19 16:48:17 +0300237 - env: COMPILER=clang++ HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
onqtam09fd51d2018-08-16 19:55:21 +0300238 osx_image: xcode10
239 os: osx
240
onqtam5a18b492019-03-02 16:04:25 +0200241 # Xcode 10.2 Clang
242 - env: COMPILER=clang++ HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
243 osx_image: xcode10.2
244 os: osx
245
onqtamaccd1e42019-10-10 22:02:11 +0300246 # Xcode 11.2 Clang
247 - env: COMPILER=clang++ HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
248 osx_image: xcode11.2
249 os: osx
250
onqtamaec53d22017-05-03 06:29:47 +0300251 # OSX LLVM-GCC
onqtam589fd212018-08-19 16:48:17 +0300252 - env: COMPILER=g++ HAS_ASAN=true HAS_TSAN=true
onqtamaec53d22017-05-03 06:29:47 +0300253 compiler: gcc
onqtam25fff352018-08-17 15:27:20 +0300254 osx_image: xcode10
onqtamaec53d22017-05-03 06:29:47 +0300255 os: osx
256
257 allow_failures:
258
onqtamd6e86612018-05-31 14:32:16 +0300259 # static code analysis
260 - env: COMPILER=clang++-4.0 STATIC_CODE_ANALYSIS=true
261
onqtamf70d7e12020-05-17 20:28:45 +0300262 # seems to not be present yet: https://travis-ci.org/github/onqtam/doctest/jobs/688097537
263 # GCC 10
264 - env: COMPILER=g++-10 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan"
265 compiler: gcc
266 sudo: required
267
Viktor Kirilovb1790b82020-09-06 19:49:29 +0300268 # Clang 10
269 - env: COMPILER=clang++-10 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true
270 sudo: required
271
onqtam2c8036f2016-06-26 17:12:42 +0300272install:
onqtamf6d1a512017-05-01 13:56:12 +0300273 - if [[ "${CODE_COVERAGE}" == "true" ]]; then gem install coveralls-lcov ; fi
274
onqtam01158572016-06-28 14:29:32 +0300275 ############################################################################
onqtamc7aaa962016-09-10 02:16:57 +0300276 # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/
277 ############################################################################
278
onqtam5a2b2552017-05-01 14:03:04 +0300279 # Make a dir for all
onqtamc7aaa962016-09-10 02:16:57 +0300280 - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
281 - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
282
onqtamc7aaa962016-09-10 02:16:57 +0300283 # Install a recent CMake
onqtamc7aaa962016-09-10 02:16:57 +0300284 - |
285 if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
onqtam84015352017-03-15 20:11:07 +0200286 CMAKE_URL="http://www.cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
onqtamc7aaa962016-09-10 02:16:57 +0300287 mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
288 export PATH=${DEPS_DIR}/cmake/bin:${PATH}
289 fi
290
onqtamebc7da32017-05-13 21:33:19 +0300291 # Install OCLint
292 - |
293 if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then
onqtam0a2554a2018-05-09 13:09:58 +0300294 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 +0300295 mkdir oclint && travis_retry wget --no-check-certificate --quiet -O - ${OCLINT_URL} | tar --strip-components=1 -xz -C oclint
296 export PATH=${DEPS_DIR}/oclint/bin:${PATH}
297 fi
298
onqtamc7aaa962016-09-10 02:16:57 +0300299 # Go back to ${TRAVIS_BUILD_DIR}
onqtamc7aaa962016-09-10 02:16:57 +0300300 - cd ${TRAVIS_BUILD_DIR}
301
302 ############################################################################
onqtam01158572016-06-28 14:29:32 +0300303 # Install stuff with homebrew under OSX
304 ############################################################################
onqtamc7aaa962016-09-10 02:16:57 +0300305
onqtam23c6a342016-06-28 14:09:10 +0300306 - |
onqtame4c75fc2016-05-21 01:24:48 +0300307 if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
308 brew update
309 # brew install ccache
onqtam27a8c082017-04-04 17:42:41 +0300310 # brew install valgrind
onqtame4c75fc2016-05-21 01:24:48 +0300311 # cmake
312 if brew list -1 | grep -q "^cmake\$"; then
313 brew outdated cmake || brew upgrade cmake
314 else
315 brew install cmake
316 fi
onqtame4c75fc2016-05-21 01:24:48 +0300317 fi
onqtamf6d1a512017-05-01 13:56:12 +0300318
onqtame4c75fc2016-05-21 01:24:48 +0300319 - export CXX="${COMPILER}"
onqtam9f934f82016-08-02 12:42:19 +0300320# - export CXX="ccache ${COMPILER}"
onqtame4c75fc2016-05-21 01:24:48 +0300321# - ccache -s
onqtam7dec6aa2016-06-26 16:01:15 +0300322
323before_script:
324 - ${CXX} --version
onqtame4c75fc2016-05-21 01:24:48 +0300325
326script:
onqtam81eab5e2017-05-08 11:51:20 +0300327 # coverage
onqtame4c75fc2016-05-21 01:24:48 +0300328 - |
onqtamf6d1a512017-05-01 13:56:12 +0300329 if [[ "${CODE_COVERAGE}" = "true" ]]; then
onqtam8b8f2402018-05-29 19:05:14 +0300330 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 +0300331 make -k -j2 || exit 1
onqtam366c3682019-03-19 13:58:02 +0200332 ctest -j2 --output-on-failure || exit 1
onqtam81eab5e2017-05-08 11:51:20 +0300333
onqtamfdb8fcc2018-06-01 15:36:28 +0300334 lcov -d . -c -o coverage.info # parse coverage data
335 lcov -r coverage.info "/usr*" -o coverage.info # remove data for system headers
336 lcov -r coverage.info "$(readlink -f examples)/*" -o coverage.info # remove data for .cpp files
337 lcov -r coverage.info "$(readlink -f scripts)/*" -o coverage.info # remove data for .cpp files
338 lcov -l coverage.info # just list a short summary of the results
339 coveralls-lcov --repo-token=${COVERALLS_REPO_TOKEN} coverage.info # upload results
onqtam5a2b2552017-05-01 14:03:04 +0300340
onqtam81eab5e2017-05-08 11:51:20 +0300341 # do not continue with other build configurations after that
onqtame4c75fc2016-05-21 01:24:48 +0300342 exit
343 fi
344
onqtam81eab5e2017-05-08 11:51:20 +0300345 # static code analysis
onqtam21623a62017-04-27 21:47:46 +0300346 - |
onqtam0decb1d2017-04-30 19:37:29 +0300347 if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then
onqtamebc7da32017-05-13 21:33:19 +0300348 # setup a test file "doctest.cpp" that is the header + a test case at the end
349 echo "#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN\n" >> doctest.cpp
350 cat doctest/doctest.h >> doctest.cpp
onqtamc2b6e132017-05-08 16:37:31 +0300351 echo -e "TEST_CASE(\"\") {\n\tint a = 6;\n\tSUBCASE(\"\") a = 5;\n\tCAPTURE(a);\n\tCHECK(a == 6);\n}\n" >> doctest.cpp
352
onqtamebc7da32017-05-13 21:33:19 +0300353 # cppcheck
354 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}"
355
356 # oclint
357 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 +0300358
359 # clang-tidy
360 cd scripts/playground
onqtamc2b6e132017-05-08 16:37:31 +0300361 cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} . || exit 1
onqtam4d87d562018-07-03 22:23:42 +0300362 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 +0300363
364 # do not continue with other build configurations after that
365 exit
366 fi
onqtam21623a62017-04-27 21:47:46 +0300367
onqtame4c75fc2016-05-21 01:24:48 +0300368 # initial run with options
onqtamcc350302016-06-28 14:36:28 +0300369 - cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} .
onqtame4c75fc2016-05-21 01:24:48 +0300370
onqtamdd40fa92018-08-19 16:29:10 +0300371 # set the common CXX flags
372 - export CXX_FLAGS="${CXX_FLAGS} -std=c++0x"
373
onqtam589fd212018-08-19 16:48:17 +0300374 # debug
375 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" .
onqtam1586ea22016-05-21 18:02:26 +0300376 - make clean && make -k -j2
onqtam366c3682019-03-19 13:58:02 +0200377 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest -j2 --output-on-failure ; fi
378 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest -j2 --output-on-failure
onqtam589fd212018-08-19 16:48:17 +0300379 # release
380 - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" .
onqtam316fce22016-05-21 16:57:13 +0300381 - make clean && make -k -j2
onqtam366c3682019-03-19 13:58:02 +0200382 - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest -j2 --output-on-failure ; fi
383 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest -j2 --output-on-failure
onqtame4c75fc2016-05-21 01:24:48 +0300384
onqtam589fd212018-08-19 16:48:17 +0300385 # sanitizers - again Debug/Release configs through address/undefined/thread sanitizers
onqtame4c75fc2016-05-21 01:24:48 +0300386 # on separate commands because when something fails I want to see which one exactly
onqtam558afbb2018-08-19 16:50:05 +0300387 - cmake -DDOCTEST_TEST_MODE=NORMAL .
388
389 - export ASAN_OPTIONS=verbosity=2:strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true:check_initialization_order=true:strict_init_order=true
onqtam9e060732019-10-11 08:37:41 +0300390 - if [[ "${HAS_ASAN}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${CXX_FLAGS} ${SANITIZER_CXX_FLAGS} -g -fno-omit-frame-pointer -fsanitize=address" . && make clean && make -k -j2 && ctest -j2 --output-on-failure ; fi
391 - if [[ "${HAS_ASAN}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CXX_FLAGS} ${SANITIZER_CXX_FLAGS} -g -fno-omit-frame-pointer -fsanitize=address" . && make clean && make -k -j2 && ctest -j2 --output-on-failure ; fi
onqtam558afbb2018-08-19 16:50:05 +0300392
393 - export UBSAN_OPTIONS=verbosity=2
onqtam366c3682019-03-19 13:58:02 +0200394 - if [[ "${HAS_UBSAN}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${CXX_FLAGS} ${SANITIZER_CXX_FLAGS} -g -fno-omit-frame-pointer -fsanitize=undefined" . && make clean && make -k -j2 && ctest -j2 --output-on-failure ; fi
395 - if [[ "${HAS_UBSAN}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CXX_FLAGS} ${SANITIZER_CXX_FLAGS} -g -fno-omit-frame-pointer -fsanitize=undefined" . && make clean && make -k -j2 && ctest -j2 --output-on-failure ; fi
onqtam558afbb2018-08-19 16:50:05 +0300396
onqtam43919672018-08-19 17:36:09 +0300397 - export TSAN_OPTIONS=verbosity=2:force_seq_cst_atomics=1
onqtam366c3682019-03-19 13:58:02 +0200398 - if [[ "${HAS_TSAN}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${CXX_FLAGS} ${SANITIZER_CXX_FLAGS} -g -fno-omit-frame-pointer -fsanitize=thread -pie -fPIE ${TSAN_CXX_FLAGS}" . && make clean && make -k -j2 && ctest -j2 --output-on-failure ; fi
399 - if [[ "${HAS_TSAN}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CXX_FLAGS} ${SANITIZER_CXX_FLAGS} -g -fno-omit-frame-pointer -fsanitize=thread -pie -fPIE ${TSAN_CXX_FLAGS}" . && make clean && make -k -j2 && ctest -j2 --output-on-failure ; fi
onqtam5cab8e92016-10-10 17:58:38 +0300400
onqtame58aa532018-08-19 16:50:58 +0300401 # test without rtti - just Debug
onqtam589fd212018-08-19 16:48:17 +0300402 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${CXX_FLAGS} -fno-rtti" .
onqtamf63c5102017-02-25 20:00:52 +0200403 - make clean && make -k -j2
onqtam366c3682019-03-19 13:58:02 +0200404 - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest -j2 --output-on-failure
onqtamf63c5102017-02-25 20:00:52 +0200405
onqtame58aa532018-08-19 16:50:58 +0300406 # test only compilation without exceptions - just Debug
onqtam589fd212018-08-19 16:48:17 +0300407 - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${CXX_FLAGS} -fno-exceptions -DDOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS" .
onqtam2d93e042017-03-17 18:57:59 +0200408 - make clean && make -k -j2
409
onqtame4c75fc2016-05-21 01:24:48 +0300410# - ccache -s
411
onqtam2dd55282016-06-13 18:05:38 +0300412#after_script:
413# - cat compile_commands.json