forked from sky-map-team/stardroid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
170 lines (150 loc) · 6.71 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# This file was largely copied from
# https://github.com/mmcc007/test_emulators
# Run android emulator on accelerated intel CPU
# or on emulated ARM CPU.
# Includes test.
# +-----------+--------------------+--------------------+
# | API Level | Code Name | Android OS version |
# +-----------+--------------------+--------------------+
# | 29 | 10 | 10 |
# | 28 | Pie | 9 |
# | 27 | Oreo | 8.1 |
# | 26 | Oreo | (dropped ARM) 8.0 |
# | 25 | Nougat | 7.1 |
# | 24 | Nougat | 7.0 |
# | 23 | Marshmallow | 6.0 |
# | 22 | Lollipop | 5.1 |
# | 21 | Lollipop | 5.0 |
# | 20 | Not released | |
# | 19 | Kitkat | 4.4 |
# | 18 | Jellybean | 4.3 |
# | 17 | Jellybean | 4.2 |
# | 16 | Jellybean | 4.1 |
# | 15 | Ice Cream Sandwich | 4.0 |
# | 14 | Not Released | |
# | 13 | Not Released | |
# | 12 | Not Released | |
# | 11 | Not Released | |
# | 10 | Gingerbread | 2.3 |
# +-----------+--------------------+--------------------+
# "https://en.wikipedia.org/wiki/Android_(operating_system)#Platform_information"
# Note: Flutter supports down to API 16
language: generic
dist: bionic
# specify global envs and jobs
env:
global:
- ANDROID_TOOLS=4333796 # android-28
- ANDROID_HOME=${HOME}/android-sdk
- GRAVIS="https://raw.githubusercontent.com/DanySK/Gravis-CI/master/"
- JDK="1.8" # the JDK used for running tests
- 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}
- FLUTTER_CHANNEL=stable
- FLUTTER_VERSION=1.9.1+hotfix.6-${FLUTTER_CHANNEL}
- FLUTTER_HOME=${HOME}/flutter
- PATH=${HOME}/.pub-cache/bin:${PATH}
- PATH=${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin:${PATH}
# matrix of APIxABIxGOO
# (see "sdkmanager --list --verbose| grep ^system-images" for full list)
# See https://github.com/mmcc007/test_emulators for many more options.
jobs:
- API=29 ABI=x86_64 GOO=google_apis_playstore
before_install:
- java -version
# Set up KVM
- sudo apt-get -y --no-install-recommends install bridge-utils libpulse0 libvirt-bin qemu-kvm virtinst ubuntu-vm-builder > /dev/null
# add travis user to groups
- sudo adduser $USER libvirt
- sudo adduser $USER kvm
# Set up JDK 8 for Android SDK
- curl "${GRAVIS}.install-jdk-travis.sh" --output ~/.install-jdk-travis.sh
- export TARGET_JDK="${JDK}"
- JDK="1.8" # used when running sdkmanager
- source ~/.install-jdk-travis.sh
# Set up Android SDK
- wget -q "https://dl.google.com/android/repository/sdk-tools-linux-$ANDROID_TOOLS.zip" -O android-sdk-tools.zip
- unzip -q android-sdk-tools.zip -d ${ANDROID_HOME}
- rm android-sdk-tools.zip
# Avoid harmless sdkmanager warning
- mkdir ~/.android
- echo 'count=0' > ~/.android/repositories.cfg
# Accept licenses before installing components, no need to echo y for each component
- yes | sdkmanager --licenses >/dev/null
install:
# Download SDK tools
- sdkmanager "platform-tools" >/dev/null
- sdkmanager "tools" >/dev/null # A second time per Travis docs, gets latest versions
- sdkmanager "build-tools;28.0.3" >/dev/null # Implicit gradle dependency - gradle drives changes
- sdkmanager "platforms;android-$API" >/dev/null # We need the API of the emulator we will run
- sdkmanager "platforms;android-28" >/dev/null # We need the API of the current compileSdkVersion from gradle.properties -
- sdkmanager "emulator" >/dev/null
- |
if [[ $ABI =~ "arm" ]]; then
# Download a pinned version of the emulator since default version can cause issues
${ANDROID_HOME}/emulator/emulator -version
emulator_version=5264690 # 29.2.1.0 (build_id 5889189) ==> 28.0.23.0 (build_id 5264690)
# sudo apt-get install -y libunwind8 libc++1
curl -fo emulator.zip "https://dl.google.com/android/repository/emulator-linux-$emulator_version.zip"
rm -rf "${ANDROID_HOME}/emulator"
unzip -q emulator.zip -d "${ANDROID_HOME}"
rm -f emulator.zip
# install build tools and platforms for arm (to allow emulator to run)
sdkmanager "build-tools;25.0.2" "platforms;android-25" > /dev/null
fi
- ${ANDROID_HOME}/emulator/emulator -version
- sdkmanager "extras;android;m2repository" >/dev/null
- sdkmanager "system-images;android-$API;$GOO;$ABI" >/dev/null # install system images for emulator
# Create an Android emulator
# - echo no | avdmanager --verbose create avd --force -n test -k "system-images;android-$API;$GOO;$ABI" -c 10M
- echo no | avdmanager --verbose create avd --force -n test -k "system-images;android-$API;$GOO;$ABI"
# - EMU_PARAMS="
# -verbose
# -no-snapshot
# -no-window
# -no-audio
# -no-boot-anim
# -camera-back none
# -camera-front none
# -selinux permissive
# -qemu -m 2048"
- EMU_PARAMS="
-avd test
-verbose
-no-window
-no-audio
"
- EMU_COMMAND="emulator"
- |
if [[ $ABI =~ "x86" ]]; then
EMU_PARAMS="${EMU_PARAMS} -no-window"
else
# emulate graphics if running on ARM
EMU_PARAMS="${EMU_PARAMS} -gpu swiftshader"
fi
# 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} ${EMU_PARAMS} &"
# Switch back to our target JDK version to build and run tests
- JDK="${TARGET_JDK}"
- source ~/.install-jdk-travis.sh
before_script:
# wait for emulator to finish startup
- tools/android-wait-for-emulator
# unlock screen
- adb shell input keyevent 82 &
script:
- ./gradlew assembleFdroidDebug
- ./gradlew testFdroidDebugUnitTest
- ./gradlew app:connectedFdroidDebugAndroidTest
#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
#
#cache:
# directories:
# - $HOME/.gradle/caches/
# - $HOME/.gradle/wrapper/