.travis.yml 3.88 KB
Newer Older
John David Taylor's avatar
John David Taylor committed
1
# Setting java 1.8 
Sean Barbeau's avatar
Sean Barbeau committed
2
language: android
John David Taylor's avatar
John David Taylor committed
3 4 5 6 7 8 9 10 11
jdk:
  - oraclejdk8

sudo: required # disables container-based builds which have a maximum of 4GB of memory

# caching as advised by travis
before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -rf $HOME/.gradle/caches/*/plugin-resolution/
Sean Barbeau's avatar
Sean Barbeau committed
12 13 14

cache:
  directories:
John David Taylor's avatar
John David Taylor committed
15 16 17
  - $HOME/.gradle/caches/
  - $HOME/.gradle/wrapper/
  - $HOME/.android/build-cache
Sean Barbeau's avatar
Sean Barbeau committed
18 19

env:
John David Taylor's avatar
John David Taylor committed
20 21 22 23 24
  matrix:
# - EMULATOR_API_LEVEL=23  ANDROID_EMULATOR_IMAGE=sys-img-armeabi-v7a-android-23
  - EMULATOR_API_LEVEL=24  ANDROID_EMULATOR_IMAGE=sys-img-arm64-v8a-android-24
# - EMULATOR_API_LEVEL=21  ANDROID_EMULATOR_IMAGE=sys-img-armeabi-v7a-android-21
# - EMULATOR_API_LEVEL=19  ANDROID_EMULATOR_IMAGE=sys-img-armeabi-v7a-android-19
Sean Barbeau's avatar
Sean Barbeau committed
25

John David Taylor's avatar
John David Taylor committed
26 27 28 29 30 31
  global:
    - ANDROID_API_LEVEL=27
    - ANDROID_BUILD_TOOLS_VERSION=27.0.3
    - ADB_INSTALL_TIMEOUT=20 # wait up to 20 minutes for adb to connect to emulator (2 minutes by default)
    - ANDROID_ABI=arm64-v8a
    
Sean Barbeau's avatar
Sean Barbeau committed
32 33
android:
  components:
John David Taylor's avatar
John David Taylor committed
34
    # Base components 
35
    - tools # to get the new `repository-11.xml`
John David Taylor's avatar
John David Taylor committed
36 37 38 39 40 41 42 43 44
    - tools # https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
    - platform-tools   
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION # get the build tools version to build the project

    # used sdk versions
    - android-$ANDROID_API_LEVEL # get the android sdk version to build the project
    - android-$EMULATOR_API_LEVEL # get the android sdk version for the emulator

    # Get the latest version of additional components
Sean Barbeau's avatar
Sean Barbeau committed
45 46 47
    - extra-android-support
    - extra-google-m2repository
    - extra-android-m2repository
John David Taylor's avatar
John David Taylor committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    - extra-google-google_play_services

    # Specify the needed emulator
    - $ANDROID_EMULATOR_IMAGE

licenses:
  - 'android-sdk-license-.+'
  - '.+'

# Emulator Management: Create, Start and Wait
before_install:
  - echo $ANDROID_TARGET 
  - echo $ANDROID_ABI
  - adb logcat > logcat.log & 

install:
  - sdkmanager --list || true # List all available targets, device definitions and AVDs.
  # Update sdk tools to latest version and install/update components
  - echo yes | sdkmanager "tools"
  - echo yes | sdkmanager "platform-tools"
  - echo yes | sdkmanager "build-tools;"$ANDROID_BUILD_TOOLS_VERSION
  - echo yes | sdkmanager "platforms;android-"$ANDROID_API_LEVEL # Latest platform required by SDK tools

  - echo yes | sdkmanager "extras;android;m2repository"
  - echo yes | sdkmanager "extras;google;m2repository"
  - echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
  - echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"

  - echo yes | sdkmanager --update
  - echo yes | sdkmanager --licenses

  # Check components status
  - sdkmanager --list || true
Sean Barbeau's avatar
Sean Barbeau committed
81 82

before_script:
John David Taylor's avatar
John David Taylor committed
83 84 85 86 87
  # Create and start the emulator
  - sdkmanager "system-images;android-"$EMULATOR_API_LEVEL";google_apis;$ANDROID_ABI"
  - echo no | avdmanager -v create avd -f -n test -k "system-images;android-$EMULATOR_API_LEVEL;google_apis;$ANDROID_ABI"
  - $ANDROID_HOME/emulator/emulator -avd test -no-audio -no-window &

Sean Barbeau's avatar
Sean Barbeau committed
88 89
  - android-wait-for-emulator

John David Taylor's avatar
John David Taylor committed
90 91 92 93 94 95 96 97
  # Turn off animations
  - adb shell settings put global window_animation_scale 0 &
  - adb shell settings put global transition_animation_scale 0 &
  - adb shell settings put global animator_duration_scale 0 &

  # Wake up
  - adb shell input keyevent 82 &
  - adb shell input keyevent 1 &
Sean Barbeau's avatar
Sean Barbeau committed
98
script:
John David Taylor's avatar
John David Taylor committed
99 100 101 102 103 104 105 106 107 108
  - ./gradlew test # Local unit test
  # Temporarily disable emulator based tests until the world figures out how to make them run again
  # - ./gradlew connectedAndroidTest # Instrumented unit test
  #- ./gradlew lint #maybe at some point
  #- ./gradlew clean test build
after_script:
  - echo $ANDROID_TARGET 
  - echo $ANDROID_ABI
  - cat /home/travis/build/sky-map-team/stardroid/sdk-messaging/build/outputs/lint-results-debug.xml
  - cat /home/travis/build/sky-map-team/stardroid/sdk/build/reports/androidTests/connected/index.html