image: node:8.2.1

# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
  paths:
   - node_modules/
   - lib/

stages:
  - build
  - test
  - deploy

before_script:  
  - npm install

build:
  stage: build
  script:
   - npm run compile

lint:
  stage: test
  script:
   - npm run lint

test:node:4.4.6:
  image: node:4.4.6
  stage: test
  script:
   - npm run cover
   
test:node:6.10.0:
  image: node:6.10.0
  stage: test
  script:
   - npm run cover
   
test:node:8.2.1:
  image: node:8.2.1
  stage: test
  script:
   - npm run cover
   
publish:
  image: node:8.2.1
  stage: deploy
  only:
    - tags
    - triggers
  script:
    - npm run compile
    - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
    - npm publish
