language: cpp
dist: trusty

# Exclude ghpages,
# but even better, don't build branch and PR, just PR
# Include tags starting with v and a digit
branches:
  only:
  - master
  - /^v\d/

cache:
  apt: true
  directories:
  - "${TRAVIS_BUILD_DIR}/deps/doxygen"

matrix:
  include:
    # Default clang
  - compiler: clang
    script:
    - .ci/make_and_test.sh 11
    - .ci/make_and_test.sh 14
    - .ci/make_and_test.sh 17

    # Docs and clang 3.5
  - compiler: clang
    language: node_js
    node_js: "7.4.0"
    env:
    - DEPLOY_MAT=yes
    addons:
      apt:
        packages:
        - clang-3.5
    install:
    - export CC=clang-3.5
    - export CXX=clang++-3.5
    - npm install gitbook-cli -g
    - gitbook fetch 3.2.3
    - gitbook install book
    script:
    - .ci/make_and_test.sh 11
    after_success:
    - export DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
    - . .ci/build_doxygen.sh
    - doxygen docs/Doxyfile
    - gitbook build book html/book

    # GCC 7 and coverage (8 does not support lcov, wait till 9 and new lcov)
  - compiler: gcc
    dist: bionic
    addons:
      apt:
        packages:
        - curl
        - lcov
    install:
    - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
    - cd $TRAVIS_BUILD_DIR
    - ". .ci/build_lcov.sh"
    - ".ci/run_codecov.sh"
    script:
    - .ci/make_and_test.sh 11 -DCLI11_EXAMPLE_JSON=ON
    - .ci/make_and_test.sh 14 -DCLI11_EXAMPLE_JSON=ON
    - .ci/make_and_test.sh 17 -DCLI11_EXAMPLE_JSON=ON

    # GCC 4.8 and Conan
  - compiler: gcc
    dist: bionic
    addons:
      apt:
        packages:
        - python3-pip
        - python3-setuptools
    install:
    - python3 -VV
    - python3 -m pip install --user conan
    - conan user
    script:
    - .ci/make_and_test.sh 11
    after_success:
    - conan create . cliutils/stable
    - |
      if [ "${TRAVIS_TAG}" ]
      then
        conan remote add origin https://api.bintray.com/conan/cliutils/CLI11
        conan user -p ${BINFROG_API_KEY} -r origin henryiii
        conan upload "*" -c -r origin --all
      fi


install: skip

script:
- .ci/make_and_test.sh 11
- .ci/make_and_test.sh 14


deploy:
- provider: pages
  skip_cleanup: true
  github_token: ${GH_REPO_TOKEN}
  keep_history: false
  local_dir: ${TRAVIS_BUILD_DIR}/html
  on:
    branch: master
    condition: "$DEPLOY_MAT = yes"

notifications:
  webhooks:
    urls:
    - https://webhooks.gitter.im/e/bbdb3befce4c00448d24
    on_success: change
    on_failure: always
    on_start: never

env:
  global:
  - secure: cY0OI609iTAxLRYuYQnNMi+H6n0dBwioTAoFXGGRTnngw2V9om3UmY5eUu4HQEQsQZovHdYpNhlSgRmdwQ4UqSp3FGyrwobf0kzacV4bVnMDeXDmHt8RzE5wP/LwDd8elNF6RRYjElY99f0k0FyXVd0fIvuVkGKQECNLOtEk0jQo+4YTh7dhuCxRhBYgTbNiRL6UJynfrcK0YN+DQ+8CJNupu2VxgaEpCSngTfvDHLcddcrXwpvn3MPc3FsDUbtN389ZCIe41qqIL0ATv46DQaTw4FOevyVfRyrBOznONoGCVeAYKL6VBdrk01Fh6aytF5zgI3hKaKobgEn+QFfzR6l68c6APvqA0Qv39iLjuh6KbdIV2YsqXfyt6FBgqP2xZuNEZW1jZ8LxUOLl2I40UEh87nFutvnSbfIzN+FcLrajm2H2jV2kZGNKAMx+4qxkZuXSre4JPkENfJm2WNFAKlqPt4ZSEQarkDYzZPcEr2I9fbGjQYVJICoN4LikCv9K5z7ujpTxCTNbVpQWZcEOT6QQBc6Vml/N/NKAIl9o2OeTLiXCmT31+KQMeO492KYNQ6VmkeqrVhGExOUcJdNyDJV9C+3mSekb3Sq78SneYRKDechkWbMl0ol07wGTdBwQQwgaorjRyn07x1rDxpPr3z19/+eubnpPUW4UQ5MYsjs=
  - secure: G6H5HA9pPUgsd96A+uvTxbLjR1rcT9NtxsknIkFDfzGDpffn6wVX+kCIQLf9zFDnQnsfYA/4piiuoBN5U5C7HQrh9UCvBVptXjWviea0Y7CRbMJZpw2rPvXWQtrFNzYkaV7kdJ5B0Mmvh6rcH/I8gKFrkdjF7i7sfzW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