sudo: false
language: node_js
node_js:
  - "4"
  - "6"
  - "7"

env:
  - JOB=test

before_script:
  - 'if [ "$JOB" = "babel-test" ]; then make bootstrap-babel ; fi'
  - 'if [ "$JOB" = "flow-test" ]; then make bootstrap-flow ; fi'
  - 'if [ "$JOB" = "test" ]; then yarn run build; fi'

script:
  - 'if [ "$JOB" = "test" ]; then yarn test-only; fi'
  - 'if [ "$JOB" = "lint" ]; then yarn run lint && yarn run flow; fi'
  - 'if [ "$JOB" = "flow-test" ]; then make test-flow; fi'
  - 'if [ "$JOB" = "babel-test" ]; then make test-babel; fi'
  - 'if [ "$JOB" = "test-coverage" ]; then yarn run test-coverage; fi'

matrix:
  fast_finish: true
  include:
    - node_js: "lts/*"
      env: JOB=test-coverage
    - node_js: "lts/*"
      env: JOB=lint
    - node_js: "lts/*"
      env: JOB=babel-test
    - node_js: "lts/*"
      env: JOB=flow-test
  allow_failures:
    - node_js: "lts/*"
      env: JOB=flow-test

after_success:
  - 'if [ "$JOB" = "babel-test" ]; then bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json -F babel ; fi'
  - 'if [ "$JOB" = "test-coverage" ]; then bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json -F babylon ; fi'

notifications:
  slack: babeljs:5Wy4QX13KVkGy9CnU0rmvgeK
