language: ruby
sudo: required
rvm:
  - 2.1.10
  - 2.2.6
  - 2.3.3
  - 2.4.0
cache: bundler
cache:
  directories:
  - $TEST_DIR/vendor/bundle
services:
  - docker
before_install:
  - ./build/travis/before_install.sh
env:
  global:
    - secure: "UyygtUDLvV2+14mEG6Pddo/deLazXc2Hit63KlbZ26Pi8cxbr1FeDUBi4WFVWlFh01smKe5mO+kk/4k06aSdolcTC59QUsltRrsINmsxj/BS66L7JbWP8/yPQP1drE6CH5oh6t1JAchuK19bLUOK9Tycn0J2VufW69ckw3D+rqU="
    - secure: "YKHqxWKFfrhJoQ5ptfgnByGNdcRLcQVpI22EGjU5WWzQrUw3Frq8+zsRmSNjzF6qEi5oXfxzxUaOItzY8W8bkWUVHCaVGalfyK+C4ad55n8ZpP2cZkOJtenocPhhUTRFwOuAZsUYCI+hXroMyoBUsnu4AJqpkYVimlNblOdcWoA="
    - secure: "UlPV+vpgZnzb1zRgGlk6U0/i6B22W+YzUDjgUZRFmLobBzZgDoVcVZUIKRjVanFuc75sd/GV2SKm39RTV/ihJ5I5BAiL20E4XtSf52w1oX2PiAXDeLiW6+4flcs8JiejGdnJplYJwWkls39Sdq/KOR+J3erpxI70JlK19/oRtOc=" # BINTRAY_USER
    - secure: "CjBV1vcOnzkz2lDJiyrVaHiJf9ukZAisF3Jglp7k/eFSjBs13I0klSurPL0Lkm+R8/lF98EW+C79jbSsQ/bYpyaGUxakJ2pY0i5r7JP4YBK5MKmLIURUuiRU358ywp1z/T41ldqyK78OoyGt9cmSilTx1f1FVN0rAqQtsALHZVs=" # BINTRAY_KEY
    - secure: "IV/3PBCZ0bVYqLdDUlvqjbXU0a+Vk/seNH57i9X8axENoS0166VXwjwTN8AlSWhKZQVadxG3J6T7V6U1G366gOOmlqtGT7AVNpvn7h4ShE0rE05sdo5GoCPGbs+5YB5qNchA7TUHrXC9pvDwmSz/pt/nA/WLiN1MJ4L8vtxLgKg=" # g
    - DOCS_GA=UA-60024048-1
    - DOCS_HS=2126125
  matrix:
    - TEST_DIR=agent
    - TEST_DIR=cli
    - TEST_DIR=server
matrix:
    exclude:
    - rvm: 2.1.10
      env: TEST_DIR=agent
    - rvm: 2.1.10
      env: TEST_DIR=server
    - rvm: 2.2.6
      env: TEST_DIR=agent
    - rvm: 2.2.6
      env: TEST_DIR=server
    - rvm: 2.4.0
      env: TEST_DIR=agent
    - rvm: 2.4.0
      env: TEST_DIR=server
script: ./build/travis/test.sh
deploy:
  - provider: script
    script: "rvm $TRAVIS_RUBY_VERSION do $TRAVIS_BUILD_DIR/build/travis/deploy_gem.sh"
    on:
      tags: true
      condition: $TEST_DIR = cli && $TRAVIS_OS_NAME = linux
      rvm: 2.3.3
      repo: kontena/kontena
  - provider: script
    script: "rvm $TRAVIS_RUBY_VERSION do $TRAVIS_BUILD_DIR/build/travis/deploy.sh"
    on:
      tags: true
      condition: $TEST_DIR = server && $TRAVIS_OS_NAME = linux
      rvm: 2.3.3
      repo: kontena/kontena
  - provider: script
    script: "rvm $TRAVIS_RUBY_VERSION do $TRAVIS_BUILD_DIR/build/travis/deploy_docs.sh"
    on:
      tags: true
      condition: $TEST_DIR = cli && $TRAVIS_OS_NAME = linux
      rvm: 2.2.6
      repo: kontena/kontena
