language: node_js
sudo: false
cache:
  directories:
  - node_modules
node_js:
 - 6
env:
  matrix:
  - TEST_BROWSER_NAME=chrome TEST_BROWSER_OS='Windows 10'
# FIXME Skip tests in Linux since Sauce Labs browser versions are ancient.
#  - TEST_BROWSER_NAME=chrome TEST_BROWSER_OS='Linux'
  - TEST_BROWSER_NAME=chrome TEST_BROWSER_OS='OS X 10.11'
  - TEST_BROWSER_NAME=firefox TEST_BROWSER_OS='Windows 10'
#  - TEST_BROWSER_NAME=firefox TEST_BROWSER_OS='Linux'
  - TEST_BROWSER_NAME=firefox TEST_BROWSER_OS='OS X 10.11'
  - TEST_BROWSER_NAME='internet explorer' TEST_BROWSER_OS='Windows 10'
  - TEST_BROWSER_NAME='internet explorer' TEST_BROWSER_OS='Windows 7'
  - TEST_BROWSER_NAME=microsoftedge TEST_BROWSER_OS='Windows 10'
  - TEST_BROWSER_NAME=safari TEST_BROWSER_OS='OS X 10.13'
before_script: npm install -g karma-cli
addons:
  sauce_connect:
    username: "directxman12"
  jwt:
    secure: "d3ekMYslpn6R4f0ajtRMt9SUFmNGDiItHpqaXC5T4KI0KMEsxgvEOfJot5PiFFJWg1DSpJZH6oaW2UxGZ3duJLZrXIEd/JePY8a6NtT35BNgiDPgcp+eu2Bu3rhrSNg7/HEsD1ma+JeUTnv18Ai5oMFfCCQJx2J6osIxyl/ZVxA="
stages:
- lint
- test
- name: deploy
  if: tag is PRESENT
jobs:
  include:
  - stage: lint
    env:
    addons:
    before_script:
    script: npm run lint
  -
    env:
    addons:
    before_script:
    script: git ls-tree --name-only -r HEAD | grep -E "[.](html|css)$" | xargs ./utils/validate
  - stage: deploy
    env:
    addons:
    script: skip
    before_script: skip
    deploy:
      provider: npm
      email: ossman@cendio.se
      api_key:
        secure: "Qq2Mi9xQawO2zlAigzshzMu2QMHvu1IaN9l0ZIivE99wHJj7eS5f4miJ9wB+/mWRRgb3E8uj9ZRV24+Oc36drlBTU9sz+lHhH0uFMfAIseceK64wZV9sLAZm472fmPp2xdUeTCCqPaRy7g1XBqiJ0LyZvEFLsRijqcLjPBF+b8w="
      on:
        tags: true
        repo: novnc/noVNC


