forked from brianegan/flutter_architecture_samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
352 lines (330 loc) · 13.1 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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
language: generic
env:
global:
- FLUTTER_CHANNEL=stable
- FLUTTER_VERSION=1.12.13+hotfix.5-${FLUTTER_CHANNEL}
- API=28
- ABI=x86
- GOO=default
- 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_HOME=${HOME}/flutter
- PATH=${HOME}/.pub-cache/bin:${PATH}
- PATH=${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin:${PATH}
jobs:
include:
- stage: Static analysis, formatting, and unit tests
language: generic
dist: bionic
os: linux
env: All unit and widget tests
before_script:
- sudo apt-get install -y --no-install-recommends lib32stdc++6 libstdc++6 > /dev/null
# install pre-compiled flutter
- 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 > /dev/null && rm flutter.tar.xz
- export PATH="$PATH":"$HOME/.pub-cache/bin"
- export PATH=$PWD/flutter/bin:$PWD/flutter/bin/cache/dart-sdk/bin:$PATH
- flutter doctor -v
- pub global activate coverage
script: ./scripts/runTests.sh
after_success: bash <(curl -s https://codecov.io/bash) -f lcov.info
cache:
directories:
- $HOME/.pub-cache
- &integration-test
stage: Testing
dist: bionic
language: generic
os: linux
env: bloc_flutter_android
# Run integration tests on android
before_install: &before_install_linux
- 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
# 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"
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
# wait for emulator to finish startup
- ./scripts/android-wait-for-emulator.sh
# unlock screen
- adb shell input keyevent 82 &
script: travis_retry ./scripts/ci.sh ./bloc_flutter
cache:
directories:
- $HOME/.pub-cache
- $HOME/.gradle
# - <<: *integration-test
- stage: Testing
os: osx
# osx_image: xcode9.4
# osx_image: xcode9.2
osx_image: xcode11.3 # for firebase
env: bloc_flutter_ios
# env: vanilla_ios
# Run integration tests on ios
before_install: &before_install_osx
# - xcrun simctl list devicetypes
# - xcrun simctl list runtimes
# # create simulator
# - udid=$(xcrun simctl create "iPhone X" com.apple.CoreSimulator.SimDeviceType.iPhone-X com.apple.CoreSimulator.SimRuntime.iOS-11-2)
# # boot simulator
# - xcrun simctl boot $udid
# - xcrun simctl list
- xcrun simctl create "iPhone X" com.apple.CoreSimulator.SimDeviceType.iPhone-X com.apple.CoreSimulator.SimRuntime.iOS-13-3 | xargs xcrun simctl boot
# skip homebrew update
- export HOMEBREW_NO_AUTO_UPDATE=1
# - brew update
- brew install libimobiledevice
- brew install ideviceinstaller
- brew install ios-deploy
- sudo gem install cocoapods
# install pre-compiled flutter
- wget --quiet --output-document=flutter.zip https://storage.googleapis.com/flutter_infra/releases/${FLUTTER_CHANNEL}/macos/flutter_macos_v${FLUTTER_VERSION}.zip && unzip -qq flutter.zip > /dev/null && rm flutter.zip
- export PATH="$PATH":"$HOME/.pub-cache/bin"
- export PATH=$PWD/flutter/bin:$PWD/flutter/bin/cache/dart-sdk/bin:$PATH
- flutter doctor -v
script: travis_retry ./scripts/ci.sh ./bloc_flutter
cache:
directories:
- $HOME/.pub-cache
- <<: *integration-test
os: linux
env: built_redux_android
script: travis_retry ./scripts/ci.sh ./built_redux
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: built_redux_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./built_redux
- <<: *integration-test
os: linux
env: bloc_library_android
script: travis_retry ./scripts/ci.sh ./bloc_library
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: bloc_library_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./bloc_library
- <<: *integration-test
os: linux
env: firestore_redux_android
script: travis_retry ./scripts/ci.sh ./firestore_redux
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: firestore_redux_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./firestore_redux
- <<: *integration-test
os: linux
env: frideos_library_android
script: travis_retry ./scripts/ci.sh ./frideos_library
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: frideos_library_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./frideos_library
- <<: *integration-test
os: linux
env: inherited_widget_android
script: travis_retry ./scripts/ci.sh ./inherited_widget
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: inherited_widget_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./inherited_widget
- <<: *integration-test
os: linux
env: mvc_android
script: travis_retry ./scripts/ci.sh ./mvc
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: mvc_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./mvc
- <<: *integration-test
os: linux
env: mvi_flutter_android
script: travis_retry ./scripts/ci.sh ./mvi_flutter
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: mvi_flutter_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./mvi_flutter
- <<: *integration-test
os: linux
env: mvu_android
script: travis_retry ./scripts/ci.sh ./mvu
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: mvu_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./mvu
- <<: *integration-test
os: linux
env: redux_android
script: travis_retry ./scripts/ci.sh ./redux
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: redux_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./redux
- <<: *integration-test
os: linux
env: change_notifier_provider_android
script: travis_retry ./scripts/ci.sh ./change_notifier_provider
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: change_notifier_provider_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./change_notifier_provider
- <<: *integration-test
os: linux
env: scoped_model_android
script: travis_retry ./scripts/ci.sh ./scoped_model
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: scoped_model_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./scoped_model
- <<: *integration-test
os: linux
env: simple_bloc_flutter_android
script: travis_retry ./scripts/ci.sh ./simple_bloc_flutter
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: simple_bloc_flutter_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./simple_bloc_flutter
- <<: *integration-test
os: linux
env: vanilla_android
script: travis_retry ./scripts/ci.sh ./vanilla
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: vanilla_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./vanilla
- <<: *integration-test
os: linux
env: mobx_android
script: travis_retry ./scripts/ci.sh ./mobx
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: mobx_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./mobx
- <<: *integration-test
os: linux
env: states_rebuilder_android
script: travis_retry ./scripts/ci.sh ./states_rebuilder
- <<: *integration-test
os: osx
osx_image: xcode11.3
env: states_rebuilder_ios
before_install: *before_install_osx
script: travis_retry ./scripts/ci.sh ./states_rebuilder
allow_failures:
# - env:
# - bloc_flutter_ios
# - built_redux_android
# - firestore_redux_android
# - firestore_redux_ios
# - mvu_android
# - mvu_ios