language: node_js

jobs:  
  include:
    - stage: "Tests"
      name: "Unit Tests"
      node_js: "8"
      script: 
        - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
        - chmod +x ./cc-test-reporter && ./cc-test-reporter before-build
        - npm test  
        - ./cc-test-reporter after-build -t lcov
    - stage: Publish
      name: "Publish to npm"
      node_js: "8"
      if: branch = master
      deploy:
        provider: script
        skip_cleanup: true
        script:
          - npm run semantic-release
