1######################### 2# project configuration # 3######################### 4 5# C++ project 6language: cpp 7 8dist: trusty 9sudo: required 10group: edge 11 12 13################ 14# build matrix # 15################ 16 17matrix: 18 include: 19 20 # Coverity (only for branch coverity_scan) 21 22 - os: linux 23 compiler: clang 24 before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt 25 addons: 26 apt: 27 sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6'] 28 packages: ['g++-6', 'clang-3.6', 'ninja-build'] 29 coverity_scan: 30 project: 31 name: "nlohmann/json" 32 description: "Build submitted via Travis CI" 33 notification_email: niels.lohmann@gmail.com 34 build_command_prepend: "mkdir coverity_build ; cd coverity_build ; cmake .. ; cd .." 35 build_command: "make -C coverity_build" 36 branch_pattern: coverity_scan 37 env: 38 - SPECIAL=coverity 39 - COMPILER=clang++-3.6 40 # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created 41 # via the "travis encrypt" command using the project repo's public key 42 - secure: "m89SSgE+ASLO38rSKx7MTXK3n5NkP9bIx95jwY71YEiuFzib30PDJ/DifKnXxBjvy/AkCGztErQRk/8ZCvq+4HXozU2knEGnL/RUitvlwbhzfh2D4lmS3BvWBGS3N3NewoPBrRmdcvnT0xjOGXxtZaJ3P74TkB9GBnlz/HmKORA=" 43 44 # OSX / Clang 45 46 - os: osx 47 osx_image: xcode10.2 48 49 # Linux / GCC 50 51 - os: linux 52 compiler: gcc 53 env: COMPILER=g++-6 54 addons: 55 apt: 56 sources: ['ubuntu-toolchain-r-test'] 57 packages: ['g++-6', 'ninja-build'] 58 59################ 60# build script # 61################ 62 63script: 64 # get CMake and Ninja (only for systems with brew - macOS) 65 - | 66 if [[ (-x $(which brew)) ]]; then 67 brew update 68 brew install cmake ninja 69 brew upgrade cmake 70 cmake --version 71 fi 72 73 # make sure CXX is correctly set 74 - if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi 75 76 # append CXX_STANDARD to CMAKE_OPTIONS if required 77 - CMAKE_OPTIONS+=${CXX_STANDARD:+ -DCMAKE_CXX_STANDARD=$CXX_STANDARD -DCMAKE_CXX_STANDARD_REQUIRED=ON} 78 79 # build configuration 80 - CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release" 81 82 # compile and execute unit tests 83 - mkdir -p build && cd build 84 - cmake .. ${CMAKE_OPTIONS} -DJSON_BuildTests=On -GNinja && cmake --build . 85 - ctest --timeout 2700 -V -j 86 - cd .. 87 88 # check if homebrew works (only checks develop branch) 89 - if [ `which brew` ]; then 90 brew update ; 91 brew tap nlohmann/json ; 92 brew install nlohmann_json --HEAD ; 93 brew test nlohmann_json ; 94 fi 95