# Travis-CI Build for libgit2
# see travis-ci.org for details

language: c

os:
  - linux
  - osx

compiler:
  - gcc
  - clang

# Settings to try
env:
 global:
  - secure: "YnhS+8n6B+uoyaYfaJ3Lei7cSJqHDPiKJCKFIF2c87YDfmCvAJke8QtE7IzjYDs7UFkTCM4ox+ph2bERUrxZbSCyEkHdjIZpKuMJfYWja/jgMqTMxdyOH9y8JLFbZsSXDIXDwqBlC6vVyl1fP90M35wuWcNTs6tctfVWVofEFbs="
  - GITTEST_INVASIVE_FS_SIZE=1
  - MBEDTLS_DIR=/tmp/mbedtls
  - SKIP_APT=1
  - SKIP_MBEDTLS_INSTALL=1
  - PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
 matrix:
  - CMAKE_OPTIONS="-DTHREADSAFE=ON -DENABLE_TRACE=ON -DCMAKE_BUILD_TYPE=Release"
  - CMAKE_OPTIONS="-DTHREADSAFE=OFF -DBUILD_EXAMPLES=ON"

dist: trusty
sudo: false

addons:
 apt:
  sources:
   - sourceline: 'deb https://dl.bintray.com/libgit2/ci-dependencies trusty libgit2deps'
     key_url: 'https://bintray.com/user/downloadSubjectPublicKey?username=bintray'
  packages:
   cmake
   curl
   libcurl3
   libcurl3-gnutls
   libcurl4-gnutls-dev
   libssh2-1-dev
   openssh-client
   openssh-server
   valgrind

matrix:
 fast_finish: true
 exclude:
   - os: osx
     compiler: gcc
 include:
   - compiler: gcc
     env:
       - LEAK_CHECK=valgrind
         CMAKE_OPTIONS="-DBUILD_CLAR=ON -DBUILD_EXAMPLES=OFF -DDEBUG_POOL=ON -DCMAKE_BUILD_TYPE=Debug"
     os: linux
     dist: trusty
   - compiler: gcc
     env:
       - MBEDTLS=1
         CMAKE_OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release -DUSE_HTTPS=mbedTLS -DSHA1_BACKEND=mbedTLS -DMBEDTLS_ROOT_DIR=/tmp/mbedtls"
     os: linux
   - compiler: gcc
     env:
       - MBEDTLS=1
         CMAKE_OPTIONS="-DTHREADSAFE=OFF -DBUILD_EXAMPLES=ON -DUSE_HTTPS=mbedTLS -DSHA1_BACKEND=mbedTLS -DMBEDTLS_ROOT_DIR=/tmp/mbedtls"
     os: linux
   - compiler: gcc
     if: type = cron
     env:
       - CMAKE_OPTIONS="-DBUILD_CLAR=ON -DCMAKE_BUILD_TYPE=Debug"
         COVERITY=1
     os: linux

install:
  - if [ -f ./ci/setup-${TRAVIS_OS_NAME}.sh ]; then ./ci/setup-${TRAVIS_OS_NAME}.sh; fi

# Run the Build script and tests
script:
 - mkdir build
 - cd build
 - if [ -n "$COVERITY" ]; then ../ci/coverity.sh; fi
 - if [ -z "$COVERITY" ]; then ../ci/build.sh && ../ci/test.sh; fi

# Only watch the development and master branches
branches:
 only:
   - master
   - /^maint.*/

# Notify development list when needed
notifications:
 irc:
  channels:
    - irc.freenode.net#libgit2
  on_success: change
  on_failure: always
  use_notice: true
  skip_join: true
 campfire:
  on_success: always
  on_failure: always
  rooms:
   - secure: "sH0dpPWMirbEe7AvLddZ2yOp8rzHalGmv0bYL/LIhVw3JDI589HCYckeLMSB\n3e/FeXw4bn0EqXWEXijVa4ijbilVY6d8oprdqMdWHEodng4KvY5vID3iZSGT\nxylhahO1XHmRynKQLOAvxlc93IlpVW38vQfby8giIY1nkpspb2w="
