branches:
  only:
  - develop
  - master
  - "/^\\d+\\.\\d+\\.\\d+(-rc\\.\\d+)?$/"

matrix:
  include:
  - os: linux
    dist: trusty
    sudo: false
    language: android
    before_install:
      - openssl aes-256-cbc -K $encrypted_985c748be78d_key -iv $encrypted_985c748be78d_iv -in key.keystore.enc -out android/app/key.keystore -d

      - mkdir -p ~/.gradle
      - echo -e "ROCKETCHAT_RN_RELEASE_STORE_FILE=$ROCKETCHAT_RN_RELEASE_STORE_FILE" > ~/.gradle/gradle.properties
      - echo -e "ROCKETCHAT_RN_RELEASE_STORE_PASSWORD=$ROCKETCHAT_RN_RELEASE_STORE_PASSWORD" >> ~/.gradle/gradle.properties
      - echo -e "ROCKETCHAT_RN_RELEASE_KEY_ALIAS=$ROCKETCHAT_RN_RELEASE_KEY_ALIAS" >> ~/.gradle/gradle.properties
      - echo -e "ROCKETCHAT_RN_RELEASE_KEY_PASSWORD=$ROCKETCHAT_RN_RELEASE_KEY_PASSWORD" >> ~/.gradle/gradle.properties
      - nvm install 8
      - node --version
    install:
      - npm install -g codecov
      - npm install
    android:
      components:
        - tools
        - build-tools-23.0.1
        - build-tools-25.0.1
        - build-tools-26.0.1
        - android-23
        - android-25
        - android-26
        - extra-android-m2repository
        - extra-google-google_play_services
        - extra-google-m2repository
        - addon-google_apis-google-16
    script:
      - npm run ci
      - cd android && ./gradlew assembleRelease

  - os: osx
    osx_image: xcode8.3
    language: node_js
    node_js: 8
    script:
      - npm run ci
