env:
  global:
    - RCT_NO_LAUNCH_PACKAGER=true

jobs:
  include:

    - stage: test
      env: TYPE=js
      os: linux
      language: generic
      script:
        - ./scripts/travis-fold.sh "npm run test-js"

    - stage: test
      env: TYPE=iOS
      os: osx
      osx_image: xcode9
      language: objective-c
      before_install:
        - source ./scripts/env/env.ios.sh
      script:
        - ./scripts/travis-fold.sh "npm run test-unit-ios -- --release"
        - ./scripts/travis-fold.sh "npm run test-e2e-ios -- --release"

    - stage: test
      env: TYPE=Android
      os: linux
      jdk: oraclejdk8
      language: java
      before_install:
        - source ./scripts/env/env.android.sh
      script:
        - ./scripts/travis-fold.sh "npm run test-unit-android -- --release"
        - ./scripts/travis-fold.sh "npm run test-e2e-android -- --release"
      before_cache:
        - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
        - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
      cache:
        directories:
          - $HOME/.m2
          - $HOME/.gradle/caches/
          - $HOME/.gradle/wrapper/
          - $HOME/.android/build-cache

    - stage: deploy
      if: NOT type = pull_request
      env: TYPE=deploy
      os: linux
      language: generic
      script:
          - ./scripts/travis-fold.sh "npm run release"

branches:
  only:
  - master
  - v2

install:
  - nvm install 8
  - ./scripts/travis-fold.sh "npm install"
  - ./scripts/travis-fold.sh "npm run clean"

after_script:
  - echo "BUILD FINISHED"

notifications:
  slack:
    secure: tZRC5hbi7iWy4hgWC0ET67kOKjn77945UZJEm8XeOnahVjfBL7gSpBTtyjD6D7Ah7qJTZNtK2lfItciT4gJfH4HYDVUBlLYKzVvw/9usYpEvsdAaAnpT2gMwXHEIupUYh0tv5ccvHt/SqHmK0HVTFdzGR/IztmHIcFlDcbNdTUtUg+9RUTBkO2n946UHk/I8xKhW4GefEuv4bRbm44H27G/VWcOABsMNvYA+kF7VDTjSlyJmACgG1BMbMDwn6lM6c7HLhVbQi52Oyt9E3dz0o1/puWldq60jiESsay99CrAr4pi4LAeMu+TdQnc8QzsCd+CZBFNIk1t56ElM2aQ8w43W+IYfu1/0+w12ySOasamqyOdLJng0MXmqzVoBcfisefVuBNmx4n+yQO+qu4a3Qze/PgPeqWHF9Jy5EbVezg+lb/4m/0NK/3o2za3dJjTKJGxuCLvdCGLVEeDLw50FQxbV+k+tgeB/1jmIWymhdUteWBjBdPUqL+ntaqWuSbMjC0euOdGkR1ibfYaUy5UmBtTRkcb/AwSti9lCNdBN8Ez1qmIO4U92gN93B10fEObLjv76T7NLJQUPks/u4nCClsYRclJPDTDe/kv9HL6R6eHJGWd045r0tKtYj1WVFUlv8EvB5rIzVKCn6cjM636+enavuTzg66aRZvu8DgNqLNo=
