# https://github.com/andstatus/andstatus/blob/master/.travis.yml language: android branches: only: - master - /^v\d+\.\d+\.\d+$/ sudo: false jdk: - oraclejdk8 env: global: # Where to run androidTests - EMULATOR_API=22 # 24 has some issues, probably some overlayed window - EMULATOR_ABI=armeabi-v7a - EMULATOR_TAG=default - PATH=$ANDROID_HOME:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$PATH android: components: - tools - platform-tools - build-tools-27.0.3 - android-27 - doc-27 install: # Setup - echo $ANDROID_HOME # We assume this is correctly set when setting path - sdkmanager --list || true # Look at the packages - echo yes | sdkmanager "tools" # Ensure tools is updated - echo yes | sdkmanager "emulator" # Ensure emulator is present # Install emulator - export EMULATOR="system-images;android-$EMULATOR_API;$EMULATOR_TAG;$EMULATOR_ABI" - echo yes | sdkmanager "platforms;android-$EMULATOR_API" # Install sdk - echo yes | sdkmanager "$EMULATOR" # Install system image - sdkmanager --list || true # Check everything is updated # Create adn start emulator - echo no | avdmanager create avd -n test -k "$EMULATOR" -f # Create emulator - which emulator # ensure we are using the right emulator (home/emulator/) - emulator -avd test -no-window -camera-back emulated -camera-front emulated -memory 2048 -writable-system & # Launch - adb wait-for-device # Wait for adb process - adb remount # Mount as writable before_script: # Wait for emulator - android-wait-for-emulator # Wait for emulator ready to interact - adb shell settings put global window_animation_scale 0 & # Disable animations - adb shell settings put global transition_animation_scale 0 & # Disable animations - adb shell settings put global animator_duration_scale 0 & # Disable animations # Unlock and configure logs. # Would be great to use -v color to adb logcat but looks not supported on travis. - sleep 20 # Sleep 20 seconds just in case - adb shell input keyevent 82 & # Dispatch unlock event - adb logcat --help # See if this version supports color - adb logcat -c # Clear logcat - adb logcat Test:V TestRunner:V CameraView:V CameraController:V Camera1:V WorkerHandler:V THREAD_STATE:S *:E & # - export LOGCAT_PID=$! # Save PID of the logcat process. Should kill later with kill $LOGCAT_PID script: - ./gradlew clean testDebugUnitTest connectedCheck mergedCoverageReport after_success: - bash <(curl -s https://codecov.io/bash) -s "*/build/reports/mergedCoverageReport/" cache: directories: - $HOME/.gradle - $HOME/.m2/repository deploy: provider: script script: ./gradlew bintrayUpload skip_cleanup: true on: branch: master tags: true