-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
201 lines (181 loc) · 8.33 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
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: flutter_app_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 .
cache:
directories:
- $HOME/.pub-cache
- $HOME/.gradle
# - <<: *integration-test
- stage: Testing
os: osx
# osx_image: xcode9.4
# osx_image: xcode9.2
osx_image: xcode11.2 # for firebase
env: flutter_app_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 list
- xcrun simctl create "iPhone 11 Pro" com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-13-2 | 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 .
cache:
directories:
- $HOME/.pub-cache
# allow_failures:
# - env:
# - flutter_ios
# - built_redux_android
# - firestore_redux_android
# - firestore_redux_ios
# - mvu_android
# - mvu_ios