language: node_js
node_js:
  - 4
  - 5
  - stable

sudo: false

os:
  - linux
  - osx

matrix:
  exclude:
    - os: osx
      node_js: 4
    - os: osx
      node_js: 5

before_install:
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew outdated xctool || brew upgrade xctool; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CHROME_BIN=chromium-browser; fi  # Karma CI
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cask install google-chrome; fi  # Karma CI
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=:99.0; fi

before_script:
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh -e /etc/init.d/xvfb start; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then nohup bash -c "webdriver-manager start 2>&1 &"; fi  # Protractor CI

after_failure:
  - cat /home/travis/build/mgechev/angular2-seed/npm-debug.log

branches:
  only: master

notifications:
  email: true
  webhooks:
    urls: https://webhooks.gitter.im/e/565e4b2fed3b96c1b964
    on_success: change  # options: [always|never|change] default: always
    on_failure: always  # options: [always|never|change] default: always
    on_start: never     # options: [always|never|change] default: always

env:
  global:
    # https://github.com/DefinitelyTyped/tsd#tsdrc
    # Token has no scope (read-only access to public information)
    - TSD_GITHUB_TOKEN=9b18c72997769f3867ef2ec470e626d39661795d

cache:
  directories: node_modules

script:
  - npm run tests.all
