# Build matrix
language: node_js
matrix:
  include:
    # Run lint only in Node.js 6.x
    - node_js: '6'
      env: LINT=true

    # Run tests in Node.js 4.x
    - node_js: '4'

    # Run tests in Node.js 5.x
    - node_js: '5'

    # Run tests in Node.js 6.x
    - node_js: '6'

    # Run tests in the latest version of Node.js
    - node_js: 'node'

# Dependencies require GCC 4.8
env:
  global:
    CXX=g++-4.8
addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - g++-4.8

# Restrict builds on branches
branches:
  only:
    - master
    - /^\d+\.\d+\.\d+$/

# Build script
script:
  - 'if [ $LINT ]; then npm run lint; fi'
  - 'if [ ! $LINT ]; then npm run test; fi'

# Updates the dashboard after a successful deployment
after_success:
  - snyk monitor --org=springernature
