language: cpp

# http://docs.travis-ci.com/user/multi-os/
os:
  - linux
  - osx

# don't re-build for tags so that [publish binary] is not re-run
# https://github.com/travis-ci/travis-ci/issues/1532
branches:
  except:
    - /^v[0-9]/

env:
  matrix:
   - NODE_VERSION="0.10"
   - NODE_VERSION="0.11"
   - NODE_WEBKIT="0.8.6" TARGET_ARCH="ia32"
   - NODE_WEBKIT="0.8.6" TARGET_ARCH="x64"
   - NODE_WEBKIT="0.10.2" TARGET_ARCH="ia32"
   - NODE_WEBKIT="0.10.2" TARGET_ARCH="x64"
  global:
    - secure: PifMOSnn+mWR1RUptXse+fLvWiTrzg0R/mazO7RWhXHWBKv0uAJ/qV3dI0GIRBLtjG10Iy+tT5RNh1TIbBzB9Y67wMcGvylUPG1+3EOKoBMEPnOD9AgCEQw4SOXfGPx0cq2N6ueSKieCgu1yKN9Wq7XCbE+zTk/DiRNIdLirVoo=
    - secure: cc4esJY1vPXL31IeumAJoKWDDO2BTGFiltwfO1jbTbiV7QT911QUjTUasxXIVpOaHNCpxSTyevPwwTWfzt2EtF92Lli+qhQ2bbzMiDSBZstSrHdAe62Ai2M1oYYUwk/0cABB/2nO9uRyYwITCxpTSNzZBrYhn3C29WqBhPeVDmM=

matrix:
  allow_failures:
    - env: NODE_WEBKIT="0.8.6" TARGET_ARCH="x64"
      os: osx
    - env: NODE_WEBKIT="0.10.0" TARGET_ARCH="x64"
      os: osx

before_install:
# check if tag exists and matches package.json
- scripts/validate_tag.sh
- echo $NODE_VERSION
# upgrade nvm
- node --version
- npm --version
- npm update -g npm
- npm --version

install:
# put node-pre-gyp on path
- export PATH=./node_modules/.bin/:$PATH

before_script:
# get commit message
- export COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')

script:
- if [[ "${NODE_VERSION}" ]]; then ./scripts/build_against_node.sh; fi;
- if [[ "${NODE_WEBKIT}" ]]; then ./scripts/build_against_node_webkit.sh; fi;
