sudo: false

branches:
  only:
    - master
    - /^\d\.\d\.\d$/

os:
  - linux
  - osx

language: node_js
node_js:
  - "6"

matrix:
  include:
    - os: linux
      dist: trusty
      sudo: false
    - os: osx
      osx_image: xcode9.1

stages:
  - lint
  - build
  - test
  - release

before_install:
  - if [ $TRAVIS_OS_NAME == "linux" ]; then
      export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
      sh -e /etc/init.d/xvfb start;
      sleep 3;
    fi

install:
  - npm install

jobs:
  include:
    - stage: lint
      script: tslint -c tslint.json 'src/**/*.ts'
    - stage: build
      script: npm run vscode:prepublish
    - stage: release
      script:
        - npm install vsce
        - vsce package
      deploy:
        - provider: releases
          api_key: $GITHUB_OAUTH_TOKEN
          file: "./doxdocgen-$TRAVIS_TAG.vsix"
          skip_cleanup: true
          on:
            tags: true
        - provider: script
          script: vsce publish -p $VSMARKETPLACE_ACCESS_TOKEN
          skip_cleanup: true
          on:
            tags: true

after_success:
  - ./publish_coverage.sh

notifications:
  webhooks:
    urls:
      - https://webhooks.gitter.im/e/87b3ab4176e6f9506c13
    on_success: always
    on_failure: always
    on_start: never