forked from googlemaps/android-maps-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
119 lines (106 loc) · 5.89 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
sudo: true
language: bash
# ignored on non-linux platforms, but bionic is required for nested virtualization
dist: bionic
stages:
- install
- test
- cache
env:
global:
- BUILD_TOOLS=29.0.2
- COMPILE_SDK_VERSION=29
- ABI=x86_64
- ADB_INSTALL_TIMEOUT=8
- ANDROID_HOME=${HOME}/android-sdk
- ANDROID_TOOLS_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip"
- EMU_FLAVOR=default # use google_apis flavor if no default flavor emulator
- GRAVIS="https://raw.githubusercontent.com/DanySK/Gravis-CI/master/"
- JDK="1.8"
- TOOLS=${ANDROID_HOME}/tools
# PATH order is incredibly important. e.g. the 'emulator' script exists in more than one place!
- PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
- secure: SFTu/DgXWRSiMxv7JMRdI6ZiOX3jcfY/49GxJWEvygCTWHOxn97iPrOXJUmXV/wnGtUeQpVk1oXVTLx/swrAIrT0C40dxVUi7qE/7wf+kd4RJVaX31KfXhJNt/4L5t4EeBz9cdLBuq1AmhHspWlThOsbtnaL2Y+6UJo5y7FnZFs=
- secure: ZDWMOQXwo0HIl06SkV24+I51UjpXDbXJz00BEJINUMiibCSmRQrhfT1gTQE5/2tC/TV+Q2A39d9kEmjdvSIL3CFMOCCF+ulWNTGWbxWNZSO/wcOWEPRxZ5OMfwS7R8V6nNxe9r0noSVcB4ECQHWF7aXzmDD6fSiWthNltfZtp/g=
- secure: Z8ZElXll1fYMvuxMFH5t7SXj2j7duNHsAcEI2lsCC/Ou69M/iGI0txz/Fq3cuvSi2+IMgs8tZw/xH/GVo0IZw8bGoZZiCs5oIfjnlHSGpgM9FMBGf/cBD5zGW+ynnT2GnW7xRwRR5r4QrB5JrwMlsn+1IFCEm6JluKMHkdNbJ94=
- secure: Kw1NwOVOUr6pjxXzSZ0U5Pei86wmbmWrfjiDQKalmMIh0dDi8Qz0OgsQcZPe7+elbJQVO4lx+9OErhNfjPUlGarh/lv2hMQ9sP0kLqWXIxBObipr3Se7jNSdqfflAqfBGVyNC4cJ5j+spNPxc6egHtOdt5tXDlaNmdSElFtzWK4=
matrix:
# - API=15 ABI=x86 EMU_CHANNEL="--channel=4" # ERROR: failed to start emulator
# - API=16 ABI=x86 AUDIO=-no-audio # ERROR: fails with com.android.ddmlib.InstallException: Unknown failure: Error: Unknown option: -d
- API=17 ABI=x86 # Works
- API=18 ABI=x86 # Works
- API=19 ABI=x86 # Works
# API 20 was Android Wear only
- API=21 ABI=x86_64 # Works
- API=22 ABI=x86_64 # Works
- API=23 ABI=x86_64 # Works
- API=24 ABI=x86_64 # Works
- API=25 ABI=x86_64 # Works
- API=26 ABI=x86_64 # Works
- API=27 ABI=x86_64 # Works
- API=28 ABI=x86_64 # Works
- API=29 ABI=x86_64 # Works
before_install:
# This section may run on all platforms, and may run for unit tests or for coverage finalization
# It should not make assumptions about os platform or desired tool installation
# Set up JDK 8 for Android SDK - Java is universally needed: codacy, unit tests, emulators
- curl "${GRAVIS}.install-jdk-travis.sh" --output ~/.install-jdk-travis.sh
- export TARGET_JDK="${JDK}"
- JDK="1.8"
- source ~/.install-jdk-travis.sh
# Set up Android SDK - this is needed everywhere but coverage finalization
- wget -q "${ANDROID_TOOLS_URL}" -O android-sdk-tools.zip
- unzip -q android-sdk-tools.zip -d ${ANDROID_HOME}
- rm android-sdk-tools.zip
- mkdir ~/.android # avoid harmless sdkmanager warning
- echo 'count=0' > ~/.android/repositories.cfg # avoid harmless sdkmanager warning
- yes | sdkmanager --licenses >/dev/null # accept all sdkmanager warnings
- echo y | sdkmanager --no_https "platform-tools" >/dev/null
- echo y | sdkmanager --no_https "tools" >/dev/null # A second time per Travis docs, gets latest versions
- echo y | sdkmanager --no_https "build-tools;$BUILD_TOOLS" >/dev/null # Implicit gradle dependency - gradle drives changes
- echo y | sdkmanager --no_https "platforms;android-$COMPILE_SDK_VERSION" >/dev/null # We need the API of the current compileSdkVersion from gradle.properties
install:
# In our setup, install only runs on matrix entries we want full emulator tests on
# That only happens currently on linux, so this section can assume linux + emulator is desired
# Download required emulator tools
- echo y | sdkmanager --no_https "platforms;android-$API" >/dev/null # We need the API of the emulator we will run
- echo y | sdkmanager --no_https "emulator" >/dev/null
- echo y | sdkmanager --no_https "system-images;android-$API;$EMU_FLAVOR;$ABI" >/dev/null # install our emulator
# Set up KVM on linux for hardware acceleration. Manually here so it only happens for emulator tests, takes ~30s
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends install bridge-utils libpulse0 libvirt-bin qemu-kvm virtinst ubuntu-vm-builder
- sudo adduser $USER libvirt
- sudo adduser $USER kvm
# Create an Android emulator
- echo no | avdmanager create avd --force -n test -k "system-images;android-$API;$EMU_FLAVOR;$ABI" -c 10M
- |
EMU_PARAMS="-verbose -no-snapshot -no-window -gpu swiftshader_indirect -camera-back none -camera-front none -selinux permissive -qemu -m 2048"
EMU_COMMAND="emulator"
# This double "sudo" monstrosity is used to have Travis execute the
# emulator with its new group permissions and help preserve the rule
# of least privilege.
sudo -E sudo -u $USER -E bash -c "${ANDROID_HOME}/emulator/${EMU_COMMAND} -avd test ${AUDIO} ${EMU_PARAMS} &"
# Wait for emulator to be ready
- ./tools/android-wait-for-emulator.sh
- adb shell input keyevent 82 &
# Switch back to our target JDK version to build and run tests
- JDK="${TARGET_JDK}"
- source ~/.install-jdk-travis.sh
script:
- if [ "$API" != "NONE" ]; then ./gradlew test check connectedCheck -x lint --stacktrace; fi
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- curl "${GRAVIS}.clean_gradle_cache.sh" --output ~/.clean_gradle_cache.sh
- bash ~/.clean_gradle_cache.sh > /dev/null
deploy:
provider: script
script:
- openssl aes-256-cbc -K $encrypted_fa6e05112033_key -iv $encrypted_fa6e05112033_iv
-in .travis.gpg.enc -out .travis.gpg -d && ./gradlew publish -PsonatypeUsername=${SONATYPE_USERNAME}
-PsonatypePassword=${SONATYPE_PASSWORD} -Psigning.keyId=${GPG_KEY_ID} -Psigning.password=${GPG_KEY_PASSPHRASE}
-Psigning.secretKeyRingFile=../.travis.gpg
on:
tags: true
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/