sudo: false
dist: "precise"
language: "node_js"
node_js:
  - "4"
  - "6"
env:
  global:
    # GH_TOKEN and NPM_TOKEN encrypted by 'travis encrypt' utility
    - secure: "gO5DrzOfF+l3hjvs0kLYUrGEnYVwrDy7NTGNrtPmLrrfdS6qmUNbTVggjra2aDM82lZYo0slZaOtjedSd8GMNE41egHAq0aGMJfhNrXjr+ROOIkc1BRUn3vTp5lk/n4eU7bLozoiriBphmKHHwZqekSn2orvIpAtoWL/JPVzheY="
cache:
  directories:
    - "node_modules"
before_install:
  # Travis CI has only shallow clone of the repository. We need to get the 'master' branch
  # so 'conventional-changelog-lint' could compare commits and lint them: marionebl/conventional-changelog-lint#7
  - "git remote set-branches origin master && git fetch && git checkout master && git checkout -"
  - "npm -g install npm@latest"
install: "npm install --no-optional"
script:
  - "npm run lint && npm run test:coverage"
after_success:
  - "npm run coveralls || true"
  - "npm run semantic-release || true"

sudo: false
dist: "precise"
language: "node_js"
env:
  global:
    # GH_TOKEN and NPM_TOKEN encrypted by 'travis encrypt' utility
    - secure: "gO5DrzOfF+l3hjvs0kLYUrGEnYVwrDy7NTGNrtPmLrrfdS6qmUNbTVggjra2aDM82lZYo0slZaOtjedSd8GMNE41egHAq0aGMJfhNrXjr+ROOIkc1BRUn3vTp5lk/n4eU7bLozoiriBphmKHHwZqekSn2orvIpAtoWL/JPVzheY="
cache:
  directories:
    - "node_modules"
before_install:
  # Travis CI has only shallow clone of the repository. We need to get the 'master' branch
  # so 'conventional-changelog-lint' could compare commits and lint them: marionebl/conventional-changelog-lint#7
  - "git remote set-branches origin master && git fetch && git checkout master && git checkout -"
  - "npm -g install npm@4"
install: "npm install --no-optional"
jobs:
  include:
    - stage: "code/docs/commits quality checks"
      node_js: "6"
      script: "npm run lint"
    - stage: "tests & code coverage"
      node_js: "4"
      script: "npm run test:coverage && npm run coveralls"
    - node_js: "6"
      script: "npm run test:coverage && npm run coveralls"
    - stage: "semantic release"
      node_js: "6"
      script: "npm run semantic-release || true"

Introduce Travis CI build stages
chore: Introduce Travis CI build stages

See https://blog.travis-ci.com/2017-05-11-introducing-build-stages
and https://docs.travis-ci.com/user/build-stages
