language: node_js
os: linux
node_js:
    - lts/*
dist: bionic

cache:
    directories:
        - node_modules
install:
    - npm install -q --no-color --no-progress
before_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
script:
    - npm run test
    - npm run build
after_script:
    - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

before_deploy:
    - npm run build

deploy:
    provider: npm
    email: $NPM_EMAIL
    api_key: $NPM_API_TOKEN
    skip_cleanup: true
    on:
        branch: master

notifications:
    email:
        on_success: always
        on_failure: always
