onqtam | e85b1bb | 2016-06-26 16:41:09 +0300 | [diff] [blame] | 1 | # this file is HEAVILY influenced by https://github.com/boostorg/hana/blob/master/.travis.yml |
| 2 | |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 3 | sudo: false |
| 4 | language: c++ |
| 5 | |
| 6 | notifications: |
onqtam | f516977 | 2016-09-09 18:33:13 +0300 | [diff] [blame] | 7 | email: false |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 8 | # gitter |
| 9 | webhooks: |
| 10 | urls: https://webhooks.gitter.im/e/10941dd1c67e5e967706 |
| 11 | on_success: change |
| 12 | on_failure: always |
| 13 | git: |
onqtam | 9f934f8 | 2016-08-02 12:42:19 +0300 | [diff] [blame] | 14 | depth: 500 |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 15 | |
| 16 | # both apt and ccache make the builds slower... |
| 17 | #cache: |
| 18 | # - apt |
| 19 | # - ccache |
| 20 | |
| 21 | env: |
| 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" |
| 29 | # Workaround for https://github.com/travis-ci/travis-ci/issues/4681 |
| 30 | # "Defining the build matrix only with matrix.include leads to an additional, unwanted job" |
| 31 | matrix: |
| 32 | - TRAVIS_EMPTY_JOB_WORKAROUND=true |
| 33 | |
| 34 | addons: |
| 35 | coverity_scan: |
| 36 | # COVERITY_SCAN_TOKEN added as env var in travis project |
| 37 | project: |
| 38 | name: onqtam/doctest |
| 39 | notification_email: vik.kirilov@gmail.com |
onqtam | 92a9ce1 | 2017-05-29 23:56:22 +0300 | [diff] [blame^] | 40 | build_command: clang++ scripts/hello_world.cpp -I doctest |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 41 | branch_pattern: coverity_scan |
| 42 | # these apt sources will be referenced later (by using *name) |
| 43 | apt: |
onqtam | 2c8036f | 2016-06-26 17:12:42 +0300 | [diff] [blame] | 44 | sources: &apt_sources |
| 45 | - ubuntu-toolchain-r-test |
onqtam | 7e775f9 | 2016-11-15 02:41:10 +0200 | [diff] [blame] | 46 | - llvm-toolchain-precise |
onqtam | b382bd3 | 2016-08-01 20:53:56 +0300 | [diff] [blame] | 47 | - llvm-toolchain-precise-3.5 |
| 48 | - llvm-toolchain-precise-3.6 |
| 49 | - llvm-toolchain-precise-3.7 |
| 50 | - llvm-toolchain-precise-3.8 |
onqtam | fd62aa0 | 2016-11-15 03:00:44 +0200 | [diff] [blame] | 51 | - llvm-toolchain-precise-3.9 |
onqtam | 3bf83c4 | 2017-04-23 15:30:23 +0300 | [diff] [blame] | 52 | - llvm-toolchain-trusty |
| 53 | - llvm-toolchain-trusty-4.0 |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 54 | |
| 55 | compiler: clang |
| 56 | os: linux |
| 57 | |
| 58 | matrix: |
| 59 | exclude: |
| 60 | - env: TRAVIS_EMPTY_JOB_WORKAROUND=true |
| 61 | |
| 62 | include: |
onqtam | d1737e4 | 2016-08-01 19:05:07 +0300 | [diff] [blame] | 63 | # coverage |
onqtam | f6d1a51 | 2017-05-01 13:56:12 +0300 | [diff] [blame] | 64 | - env: COMPILER=g++ CODE_COVERAGE=true |
onqtam | d1737e4 | 2016-08-01 19:05:07 +0300 | [diff] [blame] | 65 | compiler: gcc |
| 66 | addons: |
| 67 | apt: |
onqtam | f6d1a51 | 2017-05-01 13:56:12 +0300 | [diff] [blame] | 68 | packages: ["lcov"] |
onqtam | d1737e4 | 2016-08-01 19:05:07 +0300 | [diff] [blame] | 69 | |
onqtam | aec53d2 | 2017-05-03 06:29:47 +0300 | [diff] [blame] | 70 | # static code analysis |
| 71 | - env: COMPILER=clang++-4.0 STATIC_CODE_ANALYSIS=true |
| 72 | dist: trusty |
| 73 | addons: &clang40 |
| 74 | apt: |
| 75 | packages: ["clang-4.0", "clang-tidy-4.0", "cppcheck"] |
| 76 | sources: *apt_sources |
| 77 | |
| 78 | # GCC 4.4 |
| 79 | - env: COMPILER=g++-4.4 |
| 80 | compiler: gcc |
| 81 | addons: &gcc44 |
| 82 | apt: |
| 83 | packages: ["g++-4.4", "valgrind", "g++-4.4-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 84 | sources: *apt_sources |
| 85 | |
| 86 | # GCC 4.5 |
| 87 | - env: COMPILER=g++-4.5 |
| 88 | compiler: gcc |
| 89 | addons: &gcc45 |
| 90 | apt: |
| 91 | packages: ["g++-4.5", "valgrind", "g++-4.5-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 92 | sources: *apt_sources |
| 93 | |
| 94 | # GCC 4.6 |
| 95 | - env: COMPILER=g++-4.6 |
| 96 | compiler: gcc |
| 97 | addons: &gcc46 |
| 98 | apt: |
| 99 | packages: [ "valgrind", "g++-4.6-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 100 | sources: *apt_sources |
| 101 | |
| 102 | # GCC 4.7 |
| 103 | - env: COMPILER=g++-4.7 |
| 104 | compiler: gcc |
| 105 | addons: &gcc47 |
| 106 | apt: |
| 107 | packages: ["g++-4.7", "valgrind", "g++-4.7-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 108 | sources: *apt_sources |
| 109 | |
| 110 | # GCC 4.8 |
| 111 | - env: COMPILER=g++-4.8 HAS_ASAN_32=true HAS_ASAN_64=true |
| 112 | compiler: gcc |
| 113 | addons: &gcc48 |
| 114 | apt: |
| 115 | packages: ["g++-4.8", "valgrind", "g++-4.8-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 116 | sources: *apt_sources |
| 117 | |
| 118 | # GCC 4.9 |
| 119 | - 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 |
| 120 | compiler: gcc |
| 121 | addons: &gcc49 |
| 122 | apt: |
| 123 | packages: ["g++-4.9", "valgrind", "g++-4.9-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 124 | sources: *apt_sources |
| 125 | |
| 126 | # GCC 5 |
| 127 | - 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" |
| 128 | compiler: gcc |
| 129 | addons: &gcc5 |
| 130 | apt: |
| 131 | packages: ["g++-5", "valgrind", "g++-5-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 132 | sources: *apt_sources |
| 133 | |
| 134 | # GCC 6 |
| 135 | - 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" |
| 136 | compiler: gcc |
| 137 | addons: &gcc6 |
| 138 | apt: |
| 139 | packages: ["g++-6", "valgrind", "g++-6-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 140 | sources: *apt_sources |
| 141 | |
| 142 | # GCC 7 |
| 143 | - 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" |
| 144 | compiler: gcc |
| 145 | addons: &gcc7 |
| 146 | apt: |
| 147 | packages: ["g++-7", "valgrind", "g++-7-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 148 | sources: *apt_sources |
| 149 | |
| 150 | # Clang 3.4 |
| 151 | - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true |
| 152 | addons: &clang |
| 153 | apt: |
| 154 | packages: [ "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"] |
| 155 | sources: *apt_sources |
| 156 | |
| 157 | # Clang 3.5 |
| 158 | - env: COMPILER=clang++-3.5 HAS_ASAN_64=true HAS_UBSAN_64=true |
| 159 | addons: &clang35 |
| 160 | apt: |
| 161 | packages: ["clang-3.5", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"] |
| 162 | sources: *apt_sources |
| 163 | |
| 164 | # Clang 3.6 |
| 165 | - env: COMPILER=clang++-3.6 HAS_ASAN_64=true HAS_UBSAN_64=true |
| 166 | addons: &clang36 |
| 167 | apt: |
| 168 | packages: ["clang-3.6", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"] |
| 169 | sources: *apt_sources |
| 170 | |
| 171 | # Clang 3.7 |
| 172 | - env: COMPILER=clang++-3.7 |
| 173 | addons: &clang37 |
| 174 | apt: |
| 175 | packages: ["clang-3.7", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"] |
| 176 | sources: *apt_sources |
| 177 | |
| 178 | # Clang 3.8 |
| 179 | - env: COMPILER=clang++-3.8 HAS_ASAN_64=true HAS_UBSAN_64=true |
| 180 | addons: &clang38 |
| 181 | apt: |
| 182 | packages: ["clang-3.8", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"] |
| 183 | sources: *apt_sources |
| 184 | |
| 185 | # Clang 3.9 |
| 186 | - env: COMPILER=clang++-3.9 HAS_ASAN_64=true HAS_UBSAN_64=true |
| 187 | addons: &clang39 |
| 188 | apt: |
| 189 | packages: ["clang-3.9", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"] |
| 190 | sources: *apt_sources |
| 191 | |
| 192 | # Clang 4.0 |
| 193 | - env: COMPILER=clang++-4.0 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true |
| 194 | dist: trusty |
| 195 | addons: &clang40 |
| 196 | apt: |
| 197 | packages: ["clang-4.0", "valgrind", "g++-multilib", "libc6-dbg", "libc6-dbg:i386", "g++-6"] |
| 198 | sources: *apt_sources |
| 199 | |
| 200 | # Xcode 6.4 Clang |
| 201 | - env: COMPILER=clang++ |
| 202 | osx_image: xcode6.4 |
| 203 | os: osx |
| 204 | |
| 205 | # Xcode 7.3 Clang |
| 206 | - env: COMPILER=clang++ HAS_ASAN_32=true HAS_ASAN_64=true |
| 207 | osx_image: xcode7.3 |
| 208 | os: osx |
| 209 | |
| 210 | # Xcode 8 Clang |
| 211 | - env: COMPILER=clang++ HAS_ASAN_32=true HAS_ASAN_64=true |
| 212 | osx_image: xcode8 |
| 213 | os: osx |
| 214 | |
| 215 | # Xcode 8.1 Clang |
| 216 | - env: COMPILER=clang++ HAS_ASAN_32=true HAS_ASAN_64=true |
| 217 | osx_image: xcode8.1 |
| 218 | os: osx |
| 219 | |
| 220 | # Xcode 8.2 Clang |
| 221 | - env: COMPILER=clang++ HAS_ASAN_32=true HAS_ASAN_64=true |
| 222 | osx_image: xcode8.2 |
| 223 | os: osx |
| 224 | |
| 225 | # Xcode 8.3 Clang |
| 226 | - env: COMPILER=clang++ HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true |
| 227 | osx_image: xcode8.3 |
| 228 | os: osx |
| 229 | |
| 230 | # OSX GCC 4.6 |
| 231 | - env: COMPILER=g++-4.6 |
| 232 | compiler: gcc |
| 233 | osx_image: xcode6.4 |
| 234 | os: osx |
| 235 | |
| 236 | # OSX GCC 4.7 |
| 237 | - env: COMPILER=g++-4.7 |
| 238 | compiler: gcc |
| 239 | osx_image: xcode6.4 |
| 240 | os: osx |
| 241 | |
| 242 | # OSX GCC 4.8 |
| 243 | - env: COMPILER=g++-4.8 HAS_ASAN_32=true HAS_ASAN_64=true |
| 244 | compiler: gcc |
| 245 | osx_image: xcode6.4 |
| 246 | os: osx |
| 247 | |
| 248 | # OSX GCC 4.9 |
| 249 | - 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 |
| 250 | compiler: gcc |
| 251 | osx_image: xcode6.4 |
| 252 | os: osx |
| 253 | |
| 254 | # OSX GCC 5 |
| 255 | - env: COMPILER=g++-5 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true |
| 256 | compiler: gcc |
| 257 | osx_image: xcode7.3 |
| 258 | os: osx |
| 259 | |
| 260 | # OSX GCC 6 |
| 261 | - env: COMPILER=g++-6 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true |
| 262 | compiler: gcc |
| 263 | osx_image: xcode7.3 |
| 264 | os: osx |
| 265 | |
| 266 | # OSX GCC 7 |
| 267 | - env: COMPILER=g++-7 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true |
| 268 | compiler: gcc |
| 269 | osx_image: xcode7.3 |
| 270 | os: osx |
| 271 | |
| 272 | # OSX LLVM-GCC |
| 273 | - env: COMPILER=g++ HAS_ASAN_32=true HAS_ASAN_64=true |
| 274 | compiler: gcc |
| 275 | os: osx |
| 276 | |
| 277 | allow_failures: |
| 278 | |
| 279 | # GCC 7 |
| 280 | - 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" |
| 281 | compiler: gcc |
| 282 | addons: &gcc7 |
| 283 | apt: |
| 284 | packages: ["g++-7", "valgrind", "g++-7-multilib", "libc6-dbg", "libc6-dbg:i386"] |
| 285 | sources: *apt_sources |
| 286 | |
| 287 | # OSX GCC 4.8 |
| 288 | - env: COMPILER=g++-4.8 HAS_ASAN_32=true HAS_ASAN_64=true |
| 289 | compiler: gcc |
| 290 | osx_image: xcode6.4 |
| 291 | os: osx |
| 292 | |
| 293 | # OSX GCC 6 |
| 294 | - env: COMPILER=g++-6 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true |
| 295 | compiler: gcc |
| 296 | osx_image: xcode7.3 |
| 297 | os: osx |
| 298 | |
| 299 | - env: COMPILER=g++-7 HAS_ASAN_32=true HAS_UBSAN_32=true HAS_ASAN_64=true HAS_UBSAN_64=true |
| 300 | compiler: gcc |
| 301 | osx_image: xcode7.3 |
| 302 | os: osx |
onqtam | b1a3de8 | 2016-10-10 22:22:00 +0300 | [diff] [blame] | 303 | |
onqtam | 2c8036f | 2016-06-26 17:12:42 +0300 | [diff] [blame] | 304 | install: |
onqtam | f6d1a51 | 2017-05-01 13:56:12 +0300 | [diff] [blame] | 305 | - if [[ "${CODE_COVERAGE}" == "true" ]]; then gem install coveralls-lcov ; fi |
| 306 | |
onqtam | 0115857 | 2016-06-28 14:29:32 +0300 | [diff] [blame] | 307 | ############################################################################ |
onqtam | c7aaa96 | 2016-09-10 02:16:57 +0300 | [diff] [blame] | 308 | # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/ |
| 309 | ############################################################################ |
| 310 | |
onqtam | 5a2b255 | 2017-05-01 14:03:04 +0300 | [diff] [blame] | 311 | # Make a dir for all |
onqtam | c7aaa96 | 2016-09-10 02:16:57 +0300 | [diff] [blame] | 312 | - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" |
| 313 | - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR} |
| 314 | |
onqtam | c7aaa96 | 2016-09-10 02:16:57 +0300 | [diff] [blame] | 315 | # Install a recent CMake |
onqtam | c7aaa96 | 2016-09-10 02:16:57 +0300 | [diff] [blame] | 316 | - | |
| 317 | if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then |
onqtam | 8401535 | 2017-03-15 20:11:07 +0200 | [diff] [blame] | 318 | CMAKE_URL="http://www.cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz" |
onqtam | c7aaa96 | 2016-09-10 02:16:57 +0300 | [diff] [blame] | 319 | mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake |
| 320 | export PATH=${DEPS_DIR}/cmake/bin:${PATH} |
| 321 | fi |
| 322 | |
onqtam | ebc7da3 | 2017-05-13 21:33:19 +0300 | [diff] [blame] | 323 | # Install OCLint |
| 324 | - | |
| 325 | if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then |
| 326 | OCLINT_URL="https://github.com/oclint/oclint/releases/download/v0.12/oclint-0.12-x86_64-linux-3.13.0-112-generic.tar.gz" |
| 327 | mkdir oclint && travis_retry wget --no-check-certificate --quiet -O - ${OCLINT_URL} | tar --strip-components=1 -xz -C oclint |
| 328 | export PATH=${DEPS_DIR}/oclint/bin:${PATH} |
| 329 | fi |
| 330 | |
onqtam | c7aaa96 | 2016-09-10 02:16:57 +0300 | [diff] [blame] | 331 | # Go back to ${TRAVIS_BUILD_DIR} |
onqtam | c7aaa96 | 2016-09-10 02:16:57 +0300 | [diff] [blame] | 332 | - cd ${TRAVIS_BUILD_DIR} |
| 333 | |
| 334 | ############################################################################ |
onqtam | 0115857 | 2016-06-28 14:29:32 +0300 | [diff] [blame] | 335 | # Install stuff with homebrew under OSX |
| 336 | ############################################################################ |
onqtam | c7aaa96 | 2016-09-10 02:16:57 +0300 | [diff] [blame] | 337 | |
onqtam | 23c6a34 | 2016-06-28 14:09:10 +0300 | [diff] [blame] | 338 | - | |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 339 | if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then |
| 340 | brew update |
| 341 | # brew install ccache |
onqtam | 27a8c08 | 2017-04-04 17:42:41 +0300 | [diff] [blame] | 342 | # brew install valgrind |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 343 | # cmake |
| 344 | if brew list -1 | grep -q "^cmake\$"; then |
| 345 | brew outdated cmake || brew upgrade cmake |
| 346 | else |
| 347 | brew install cmake |
| 348 | fi |
| 349 | # gcc |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 350 | if [[ "${COMPILER}" = "g++-4.6" ]]; then |
| 351 | brew install gcc46 |
| 352 | fi |
| 353 | if [[ "${COMPILER}" = "g++-4.7" ]]; then |
| 354 | brew install gcc47 |
| 355 | fi |
| 356 | if [[ "${COMPILER}" = "g++-4.8" ]]; then |
onqtam | b1a3de8 | 2016-10-10 22:22:00 +0300 | [diff] [blame] | 357 | brew install gcc48 |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 358 | fi |
| 359 | if [[ "${COMPILER}" = "g++-4.9" ]]; then |
| 360 | brew install gcc49 |
| 361 | fi |
| 362 | if [[ "${COMPILER}" = "g++-5" ]]; then |
| 363 | brew install gcc5 |
| 364 | fi |
| 365 | if [[ "${COMPILER}" = "g++-6" ]]; then |
| 366 | brew install gcc6 |
| 367 | fi |
onqtam | aab98c5 | 2017-05-02 19:48:42 +0300 | [diff] [blame] | 368 | if [[ "${COMPILER}" = "g++-7" ]]; then |
| 369 | brew install gcc7 |
| 370 | fi |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 371 | fi |
onqtam | f6d1a51 | 2017-05-01 13:56:12 +0300 | [diff] [blame] | 372 | |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 373 | - export CXX="${COMPILER}" |
onqtam | 9f934f8 | 2016-08-02 12:42:19 +0300 | [diff] [blame] | 374 | # - export CXX="ccache ${COMPILER}" |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 375 | # - ccache -s |
onqtam | 7dec6aa | 2016-06-26 16:01:15 +0300 | [diff] [blame] | 376 | |
| 377 | before_script: |
| 378 | - ${CXX} --version |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 379 | |
| 380 | script: |
onqtam | 81eab5e | 2017-05-08 11:51:20 +0300 | [diff] [blame] | 381 | # coverage |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 382 | - | |
onqtam | f6d1a51 | 2017-05-01 13:56:12 +0300 | [diff] [blame] | 383 | if [[ "${CODE_COVERAGE}" = "true" ]]; then |
onqtam | 81eab5e | 2017-05-08 11:51:20 +0300 | [diff] [blame] | 384 | cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -std=c++98" -DCMAKE_BUILD_TYPE=Debug . || exit 1 |
| 385 | make -k -j2 || exit 1 |
| 386 | ctest --output-on-failure || exit 1 |
| 387 | |
onqtam | f6d1a51 | 2017-05-01 13:56:12 +0300 | [diff] [blame] | 388 | lcov -d . -c -o coverage.info # parse coverage data |
| 389 | lcov -r coverage.info "/usr*" "$(readlink -f examples)/*" -o coverage.info # remove data for system headers and .cpp files |
| 390 | lcov -l coverage.info # just list a short summary of the results |
| 391 | coveralls-lcov --repo-token ${COVERALLS_REPO_TOKEN} coverage.info # upload results |
onqtam | 5a2b255 | 2017-05-01 14:03:04 +0300 | [diff] [blame] | 392 | |
onqtam | 81eab5e | 2017-05-08 11:51:20 +0300 | [diff] [blame] | 393 | # do not continue with other build configurations after that |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 394 | exit |
| 395 | fi |
| 396 | |
onqtam | 81eab5e | 2017-05-08 11:51:20 +0300 | [diff] [blame] | 397 | # static code analysis |
onqtam | 21623a6 | 2017-04-27 21:47:46 +0300 | [diff] [blame] | 398 | - | |
onqtam | 0decb1d | 2017-04-30 19:37:29 +0300 | [diff] [blame] | 399 | if [[ "${STATIC_CODE_ANALYSIS}" = "true" ]]; then |
onqtam | ebc7da3 | 2017-05-13 21:33:19 +0300 | [diff] [blame] | 400 | # setup a test file "doctest.cpp" that is the header + a test case at the end |
| 401 | echo "#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN\n" >> doctest.cpp |
| 402 | cat doctest/doctest.h >> doctest.cpp |
onqtam | c2b6e13 | 2017-05-08 16:37:31 +0300 | [diff] [blame] | 403 | echo -e "TEST_CASE(\"\") {\n\tint a = 6;\n\tSUBCASE(\"\") a = 5;\n\tCAPTURE(a);\n\tCHECK(a == 6);\n}\n" >> doctest.cpp |
| 404 | |
onqtam | ebc7da3 | 2017-05-13 21:33:19 +0300 | [diff] [blame] | 405 | # cppcheck |
| 406 | 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}" |
| 407 | |
| 408 | # oclint |
| 409 | 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 |
onqtam | 81eab5e | 2017-05-08 11:51:20 +0300 | [diff] [blame] | 410 | |
| 411 | # clang-tidy |
| 412 | cd scripts/playground |
onqtam | c2b6e13 | 2017-05-08 16:37:31 +0300 | [diff] [blame] | 413 | cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} . || exit 1 |
onqtam | fdd233c | 2017-05-09 20:24:32 +0300 | [diff] [blame] | 414 | clang-tidy-4.0 -p=. *.cpp -header-filter=.* -warnings-as-errors=* -checks='*,-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,-readability-braces-around-statements,-readability-named-parameter,-readability-else-after-return,-readability-redundant-declaration,-readability-implicit-bool-cast' || exit 1 |
onqtam | 81eab5e | 2017-05-08 11:51:20 +0300 | [diff] [blame] | 415 | |
| 416 | # do not continue with other build configurations after that |
| 417 | exit |
| 418 | fi |
onqtam | 21623a6 | 2017-04-27 21:47:46 +0300 | [diff] [blame] | 419 | |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 420 | # initial run with options |
onqtam | cc35030 | 2016-06-28 14:36:28 +0300 | [diff] [blame] | 421 | - cmake ${CMAKE_OPTIONS_GLOBAL} ${CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER=${CXX} . |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 422 | |
onqtam | 1586ea2 | 2016-05-21 18:02:26 +0300 | [diff] [blame] | 423 | # debug x64 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 424 | - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -m64" . |
onqtam | 1586ea2 | 2016-05-21 18:02:26 +0300 | [diff] [blame] | 425 | - make clean && make -k -j2 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 426 | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi |
| 427 | - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure |
onqtam | 1586ea2 | 2016-05-21 18:02:26 +0300 | [diff] [blame] | 428 | # release x64 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 429 | - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -m64" . |
onqtam | 1586ea2 | 2016-05-21 18:02:26 +0300 | [diff] [blame] | 430 | - make clean && make -k -j2 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 431 | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi |
| 432 | - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 433 | # debug x86 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 434 | - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -m32" . |
onqtam | 316fce2 | 2016-05-21 16:57:13 +0300 | [diff] [blame] | 435 | - make clean && make -k -j2 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 436 | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi |
| 437 | - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 438 | # release x86 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 439 | - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -m32" . |
onqtam | 316fce2 | 2016-05-21 16:57:13 +0300 | [diff] [blame] | 440 | - make clean && make -k -j2 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 441 | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then cmake -DDOCTEST_TEST_MODE=VALGRIND . && ctest --output-on-failure ; fi |
| 442 | - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 443 | |
| 444 | # sanitizers - again 32/64 bit Debug/Release configs through address/undefined sanitizers |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 445 | - cmake -DDOCTEST_TEST_MODE=NORMAL . |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 446 | # on separate commands because when something fails I want to see which one exactly |
onqtam | 84b19bc | 2016-08-26 12:40:31 +0300 | [diff] [blame] | 447 | # TODO: when this http://stackoverflow.com/questions/39081183 gets resolved - add these to ASAN as well: check_initialization_order=true:strict_init_order=true |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 448 | - if [[ "${HAS_ASAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -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 |
| 449 | - if [[ "${HAS_ASAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -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 |
| 450 | - if [[ "${HAS_ASAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -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 |
| 451 | - if [[ "${HAS_ASAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -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 |
| 452 | - if [[ "${HAS_UBSAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -g -fno-omit-frame-pointer -m64 -fsanitize=undefined" . && make clean && make -k -j2 && UBSAN_OPTIONS=verbosity=2 ctest --output-on-failure ; fi |
| 453 | - if [[ "${HAS_UBSAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -g -fno-omit-frame-pointer -m32 -fsanitize=undefined" . && make clean && make -k -j2 && UBSAN_OPTIONS=verbosity=2 ctest --output-on-failure ; fi |
| 454 | - if [[ "${HAS_UBSAN_64}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -g -fno-omit-frame-pointer -m64 -fsanitize=undefined" . && make clean && make -k -j2 && UBSAN_OPTIONS=verbosity=2 ctest --output-on-failure ; fi |
| 455 | - if [[ "${HAS_UBSAN_32}" = "true" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -g -fno-omit-frame-pointer -m32 -fsanitize=undefined" . && make clean && make -k -j2 && UBSAN_OPTIONS=verbosity=2 ctest --output-on-failure ; fi |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 456 | |
onqtam | 7a3ad26 | 2017-03-18 18:05:10 +0200 | [diff] [blame] | 457 | # test in c++0x mode - just Debug/x64 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 458 | - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++0x -m64" . |
onqtam | 5cab8e9 | 2016-10-10 17:58:38 +0300 | [diff] [blame] | 459 | - make clean && make -k -j2 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 460 | - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure |
onqtam | 5cab8e9 | 2016-10-10 17:58:38 +0300 | [diff] [blame] | 461 | |
onqtam | 7a3ad26 | 2017-03-18 18:05:10 +0200 | [diff] [blame] | 462 | # test without rtti - just Debug/x64 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 463 | - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -m64 -fno-rtti" . |
onqtam | f63c510 | 2017-02-25 20:00:52 +0200 | [diff] [blame] | 464 | - make clean && make -k -j2 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 465 | - cmake -DDOCTEST_TEST_MODE=COMPARE . && ctest --output-on-failure |
onqtam | f63c510 | 2017-02-25 20:00:52 +0200 | [diff] [blame] | 466 | |
onqtam | 7a3ad26 | 2017-03-18 18:05:10 +0200 | [diff] [blame] | 467 | # test only compilation without exceptions - just Debug/x64 |
onqtam | 56d9170 | 2017-04-16 21:03:58 +0300 | [diff] [blame] | 468 | - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="${ADDITIONAL_CXX_FLAGS} -std=c++98 -m64 -fno-exceptions -DDOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS" . |
onqtam | 2d93e04 | 2017-03-17 18:57:59 +0200 | [diff] [blame] | 469 | - make clean && make -k -j2 |
| 470 | |
onqtam | e4c75fc | 2016-05-21 01:24:48 +0300 | [diff] [blame] | 471 | # - ccache -s |
| 472 | |
onqtam | 2dd5528 | 2016-06-13 18:05:38 +0300 | [diff] [blame] | 473 | #after_script: |
| 474 | # - cat compile_commands.json |