language: node_js
node_js:
  - "10"

addons:
  chrome: stable

branches:
  only:
    - master
    - beta
    - release
    - next
    # release branches
    - /^(?:release|lts)-\d+-\d+$/
    # npm version tags
    - /^v\d+\.\d+\.\d+/

cache:
  yarn: true
  directories:
    - $HOME/.npm
    - $HOME/.cache # includes bower's cache

stages:
  - basic test
  - additional tests
  - name: deploy
    if: type IN (push) AND branch = release

jobs:
  include:
    - stage: basic test
      name: Basic Tests
      script:
        - yarn lint
        - yarn test

    - stage: additional tests
      name: Node.js 8
      node_js: 8

    - name: Node.js 10
      node_js: 10
      script:
        - yarn test:cover
      after_success:
        - .travis/codecoverage.sh

    - env: NAME=NODE_11
      node_js: 11

    - name: Node.js 12
      node_js: 12

    - env: EMBER_CLI_ENABLE_ALL_EXPERIMENTS=true
    - env: EMBER_CLI_PACKAGER=true
    - env: EMBER_CLI_MODULE_UNIFICATION=true
    - env: EMBER_CLI_DELAYED_TRANSPILATION=true
    - env: EMBER_CLI_SYSTEM_TEMP=false
    - env: EMBER_CLI_BROCCOLI_WATCHER=true

    - stage: deploy
      name: Publish API Docs
      script: skip
      deploy:
        provider: script
        script: ./.travis/deploy.sh

before_install:
  # prevent the npm loading indicator
  - npm config --global set spin false

  # travis currently includes yarn v0.17.8 (20170705)
  # this isn't new enough for our use of --non-interactive
  - curl -o- -L https://yarnpkg.com/install.sh | bash
  - export PATH=$HOME/.yarn/bin:$PATH

script:
  - yarn test:all
