-
Notifications
You must be signed in to change notification settings - Fork 7
/
.travis.yml
318 lines (272 loc) · 13.9 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# 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)
jobs:
- API=29 ABI=x86_64 GOO=google_apis_playstore
- API=29 ABI=x86 GOO=google_apis_playstore
- API=29 ABI=x86_64 GOO=google_apis
- API=29 ABI=x86 GOO=google_apis
- API=29 ABI=x86_64 GOO=default
- API=29 ABI=x86 GOO=default
- API=28 ABI=x86_64 GOO=google_apis_playstore
- API=28 ABI=x86 GOO=google_apis_playstore
- API=28 ABI=x86_64 GOO=google_apis
- API=28 ABI=x86 GOO=google_apis
- API=28 ABI=x86_64 GOO=default
- API=28 ABI=x86 GOO=default
- API=27 ABI=x86 GOO=google_apis_playstore
- API=27 ABI=x86 GOO=google_apis
- API=27 ABI=x86_64 GOO=default
- API=27 ABI=x86 GOO=default
- API=26 ABI=x86 GOO=google_apis_playstore
- API=26 ABI=x86_64 GOO=google_apis
- API=26 ABI=x86 GOO=google_apis
- API=26 ABI=x86_64 GOO=default
- API=26 ABI=x86 GOO=default
- API=25 ABI=x86 GOO=google_apis_playstore
- API=25 ABI=x86_64 GOO=google_apis
- API=25 ABI=x86 GOO=google_apis
- API=25 ABI=x86_64 GOO=default
- API=25 ABI=x86 GOO=default
- API=25 ABI=armeabi-v7a GOO=google_apis
- API=25 ABI=arm64-v8a GOO=google_apis
- API=24 ABI=x86_64 GOO=google_apis
- API=24 ABI=x86 GOO=google_apis
- API=24 ABI=armeabi-v7a GOO=google_apis
- API=24 ABI=arm64-v8a GOO=google_apis
- API=24 ABI=x86_64 GOO=default
- API=24 ABI=x86 GOO=default
- API=24 ABI=armeabi-v7a GOO=default
- API=24 ABI=arm64-v8a GOO=default
- API=23 ABI=x86_64 GOO=google_apis
- API=23 ABI=x86 GOO=google_apis
- API=23 ABI=armeabi-v7a GOO=google_apis
- API=23 ABI=x86_64 GOO=default
- API=23 ABI=x86 GOO=default
- API=23 ABI=armeabi-v7a GOO=default
- API=22 ABI=x86_64 GOO=google_apis
- API=22 ABI=x86 GOO=google_apis
- API=22 ABI=armeabi-v7a GOO=google_apis
- API=22 ABI=x86_64 GOO=default
- API=22 ABI=x86 GOO=default
- API=22 ABI=armeabi-v7a GOO=default
- API=21 ABI=x86_64 GOO=google_apis
- API=21 ABI=x86 GOO=google_apis
- API=21 ABI=armeabi-v7a GOO=google_apis
- API=21 ABI=x86_64 GOO=default
- API=21 ABI=x86 GOO=default
- API=21 ABI=armeabi-v7a GOO=default
# API=20 -- not released
- API=19 ABI=x86 GOO=google_apis
- API=19 ABI=x86 GOO=default
- API=19 ABI=armeabi-v7a GOO=google_apis
- API=19 ABI=armeabi-v7a GOO=default
- API=18 ABI=x86 GOO=google_apis
- API=18 ABI=x86 GOO=default
- API=18 ABI=armeabi-v7a GOO=google_apis
- API=18 ABI=armeabi-v7a GOO=default
- API=17 ABI=x86 GOO=google_apis
- API=17 ABI=x86 GOO=default
- API=17 ABI=armeabi-v7a GOO=google_apis
- API=17 ABI=armeabi-v7a GOO=default
- API=16 ABI=x86 GOO=google_apis
- API=16 ABI=x86 GOO=default
- API=16 ABI=armeabi-v7a GOO=google_apis
- API=16 ABI=armeabi-v7a GOO=default
# API=15 -- not supported by flutter
# API=14 -- not released
# API=13 -- not released
# API=12 -- not released
# API=11 -- not released
# API=10 -- not supported by flutter
jobs:
fast_finish: true
# jobs that are flakey or fail consistently
allow_failures:
- env: API=29 ABI=x86_64 GOO=google_apis_playstore # flutter driver: "No devices found."
- env: API=29 ABI=x86 GOO=google_apis_playstore # flutter doctor: device offline
- env: API=29 ABI=x86_64 GOO=google_apis # flutter drive: "Bad state: No element"
- env: API=29 ABI=x86 GOO=google_apis # DriverError: Failed to fulfill GetHealth due to remote error
- env: API=29 ABI=x86_64 GOO=default # hangs while resolving gradle dependencies, etc...
- env: API=29 ABI=x86 GOO=default # hangs while resolving dependencies
- env: API=28 ABI=x86_64 GOO=google_apis_playstore # flutter driver hangs
- env: API=28 ABI=x86 GOO=google_apis_playstore # flutter driver hangs
- env: API=28 ABI=x86 GOO=google_apis # DriverError: Failed to fulfill GetHealth due to remote error
- env: API=26 ABI=x86 GOO=google_apis_playstore # hangs after installing apk
- env: API=26 ABI=x86 GOO=google_apis # hangs during assembleDebug and resolving dependencies
- env: API=26 ABI=x86 GOO=default # emulator hangs
- env: API=25 ABI=x86 GOO=google_apis_playstore # hangs after installing apk
- env: API=25 ABI=armeabi-v7a GOO=google_apis # flutter drive reports "apk: Can't find service: package"
- env: API=25 ABI=arm64-v8a GOO=google_apis # Timeout (600 seconds) reached; failed to start emulator
- env: API=24 ABI=x86 GOO=google_apis # flutter driver hangs after resolving gradle dependencies
- env: API=24 ABI=armeabi-v7a GOO=google_apis # hangs during Installing build/app/outputs/apk/app.apk...
- env: API=24 ABI=arm64-v8a GOO=google_apis # Timeout (600 seconds) reached; failed to start emulator
- env: API=24 ABI=armeabi-v7a GOO=default # hangs after installing apk
- env: API=24 ABI=arm64-v8a GOO=default # Timeout (600 seconds) reached; failed to start emulator
- env: API=23 ABI=armeabi-v7a GOO=google_apis # hangs during Installing build/app/outputs/apk/app.apk...
- env: API=23 ABI=armeabi-v7a GOO=default # hangs after installing apk
- env: API=22 ABI=x86_64 GOO=google_apis # hangs during gradle assemble
- env: API=22 ABI=armeabi-v7a GOO=google_apis # hangs after installing apk
- env: API=22 ABI=x86_64 GOO=default # flutter drive hangs during installation of apk
- env: API=21 ABI=armeabi-v7a GOO=google_apis # Timeout (600 seconds) reached; failed to start emulator
- env: API=21 ABI=armeabi-v7a GOO=default # hangs before test starts
- env: API=19 ABI=armeabi-v7a GOO=google_apis # hangs after installing apk
- env: API=19 ABI=armeabi-v7a GOO=default # hangs on Installing build/app/outputs/apk/app.apk...
- env: API=18 ABI=x86 GOO=google_apis # hangs during test
- env: API=18 ABI=x86 GOO=default # hangs during flutter doctor
- env: API=18 ABI=armeabi-v7a GOO=google_apis # flutter driver: incorrect success after installing apk
- env: API=17 ABI=x86 GOO=google_apis # FlutterDriver: It is taking an unusually long time to connect to the VM...
- env: API=17 ABI=x86 GOO=default # FlutterDriver: It is taking an unusually long time to connect to the VM...
- env: API=16 ABI=x86 GOO=google_apis # FlutterDriver: It is taking an unusually long time to connect to the VM...
- env: API=16 ABI=x86 GOO=default # FlutterDriver: It is taking an unusually long time to connect to the VM...
- env: API=16 ABI=armeabi-v7a GOO=google_apis # hangs after installing apk
- env: API=16 ABI=armeabi-v7a GOO=default # hangs after installing apk
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_COMMAND="emulator-headless"
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} &"
# install flutter (while emulator is starting)
- sudo apt-get install -y --no-install-recommends lib32stdc++6 libstdc++6 > /dev/null
- wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/${FLUTTER_CHANNEL}/linux/flutter_linux_v${FLUTTER_VERSION}.tar.xz
- tar xf flutter.tar.xz -C $(dirname ${FLUTTER_HOME})
- rm flutter.tar.xz
# Switch back to our target JDK version to build and run tests
- JDK="${TARGET_JDK}"
- source ~/.install-jdk-travis.sh
- flutter doctor -v
before_script:
# wait for emulator to finish startup
- ./script/android-wait-for-emulator.sh
# unlock screen
- adb shell input keyevent 82 &
script:
- cd flutter_app
- flutter pub get
# run test with retries
- flutter driver lib/main.dart || flutter driver lib/main.dart || flutter driver lib/main.dart
#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/