---
dist: trusty
language: node_js
node_js: 6
sudo: false
cache:
  yarn: true
  directories:
    - $HOME/.cache/bower

before_install:
  - curl -o- -L https://yarnpkg.com/install.sh | bash
  - export PATH=$HOME/.yarn/bin:$PATH
  - yarn global add bower
  - yarn global add greenkeeper-lockfile@1

install:
  - yarn
  - bower install

script: ember exam --split=$SPLIT --partition=$PARTITION --filter=$FILTER --parallel=$PARALLEL

jobs:
  include:
    - stage: test
      env: PARTITION=false FILTER='!acceptance' SPLIT=4 PARALLEL=true
    - stage: test
      env: PARTITION=1 FILTER='acceptance' SPLIT=4 PARALLEL=false
    - stage: test
      env: PARTITION=2 FILTER='acceptance' SPLIT=4 PARALLEL=false
    - stage: test
      env: PARTITION=3 FILTER='acceptance' SPLIT=4 PARALLEL=false
    - stage: test
      env: PARTITION=4 FILTER='acceptance' SPLIT=4 PARALLEL=false
    - stage: deploy staging
      if: branch = master AND NOT type = pull_request
      script: node_modules/.bin/ember deploy staging --activate
    - stage: deploy production
      if: tag IS present
      script: node_modules/.bin/ember deploy production --activate

---
dist: trusty
language: node_js
node_js: 6
sudo: false
cache:
  yarn: true
  directories:
    - $HOME/.cache/bower

before_install:
  - curl -o- -L https://yarnpkg.com/install.sh | bash
  - export PATH=$HOME/.yarn/bin:$PATH
  - yarn global add bower
  - yarn global add greenkeeper-lockfile@1

install:
  - yarn
  - bower install

script: ember exam --split=$SPLIT --partition=$PARTITION --filter=$FILTER --parallel=$PARALLEL

jobs:
  include:
    - stage: greenkeeper
      if: branch =~ ^greenkeeper
      script:
        - greenkeeper-lockfile-update
        - greenkeeper-lockfile-upload
    - stage: test
      env: PARTITION=false FILTER='!acceptance' SPLIT=4 PARALLEL=true
    - stage: test
      env: PARTITION=1 FILTER='acceptance' SPLIT=4 PARALLEL=false
    - stage: test
      env: PARTITION=2 FILTER='acceptance' SPLIT=4 PARALLEL=false
    - stage: test
      env: PARTITION=3 FILTER='acceptance' SPLIT=4 PARALLEL=false
    - stage: test
      env: PARTITION=4 FILTER='acceptance' SPLIT=4 PARALLEL=false
    - stage: deploy staging
      if: branch = master AND NOT type = pull_request
      script: node_modules/.bin/ember deploy staging --activate
    - stage: deploy production
      if: tag IS present
      script: node_modules/.bin/ember deploy production --activate

Put greenkeeper into it's own job
Put greenkeeper into it's own job

This way it only runs on greenkeeper branches and won't hold up or
interfere with other builds.
