forked from appium/appium-adb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
109 lines (107 loc) · 3.83 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
language: android
jdk: oraclejdk8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
# https://docs.travis-ci.com/user/languages/android/
android:
components:
- tools
- platform-tools
# https://developer.android.com/studio/releases/build-tools
- build-tools
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
env:
global:
# used in tests
- ANDROID_AVD=test
- _FORCE_LOGS=1
- DEVICE=android
# used in Travis config
- MOCHA_TIMEOUT=900000
- RECURSIVE=
- START_EMU=1
- EMU_NAME=test
- EMU_ABI=x86_64
- EMU_TAG=default
- SDK_VERSION=28.0.3
- API_VERSION=28
- PLATFORM_VERSION=5.0.2
- CC=gcc-6 CXX=g++-6
- QEMU_AUDIO_DRV=none
matrix:
# API24@armeabi-v7a is the newest available default image
# which does not require hardware acceleration:
# https://github.com/travis-ci/travis-ci/issues/1419
- TEST=functional RECURSIVE=--recursive PLATFORM_VERSION=7.0 EMU_TARGET=android-24
- TEST=functional RECURSIVE=--recursive EMU_TARGET=android-21
- TEST=unit START_EMU=0
before_install:
- echo $ANDROID_HOME
- |
if [ ${START_EMU} = "1" ]; then
echo 'count=0' > /home/travis/.android/repositories.cfg
echo y | android update sdk --no-ui -t tools
echo y | sdkmanager "platform-tools" >/dev/null
echo y | sdkmanager tools > /dev/null
# Free up some space
for apiVersion in 18 19; do
sdkmanager --uninstall "platforms;android-${apiVersion}" > /dev/null
done
echo y | sdkmanager "build-tools;${SDK_VERSION}" >/dev/null
echo y | sdkmanager --update > /dev/null
echo y | sdkmanager "platforms;${EMU_TARGET}" > /dev/null
echo y | sdkmanager "platforms;android-${API_VERSION}" >/dev/null
echo y | sdkmanager "extras;android;m2repository" > /dev/null
echo y | sdkmanager --channel=3 "emulator" >/dev/null
export EMU_IMAGE="system-images;${EMU_TARGET};${EMU_TAG};${EMU_ABI}"
for retry in 1 2 3; do
echo yes | sdkmanager "${EMU_IMAGE}" > /dev/null && break
echo "sdkmanager was not able to download the ${EMU_IMAGE} image (retry ${retry})"
sleep 5
done
sdkmanager --list
export TOOLS=${ANDROID_HOME}/tools
export PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
echo no | avdmanager create avd -k "${EMU_IMAGE}" -n "${EMU_NAME}" -f --abi "${EMU_ABI}" --tag "${EMU_TAG}" || exit 1
emulator -avd "${EMU_NAME}" -no-accel -no-snapshot -no-window -camera-back none -camera-front none -selinux permissive -qemu -m 2048 &
fi
install:
# node stuff
- nvm install 10.15
# npm stuff
- npm install
before_script:
- |
if [ ${START_EMU} = "1" ]; then
# Fail fast if emulator process cannot start
pgrep -nf avd || exit 1
# make sure the emulator is ready
adb wait-for-device get-serialno
secondsStarted=`date +%s`
TIMEOUT=360
while [[ $(( `date +%s` - $secondsStarted )) -lt $TIMEOUT ]]; do
processList=`adb shell ps`
if [[ "$processList" =~ "com.android.systemui" ]]; then
echo "System UI process is running. Checking IME services availability"
adb shell ime list && break
fi
sleep 5
secondsElapsed=$(( `date +%s` - $secondsStarted ))
secondsLeft=$(( $TIMEOUT - $secondsElapsed ))
echo "Waiting until emulator finishes services startup; ${secondsElapsed}s elapsed; ${secondsLeft}s left"
done
bootDuration=$(( `date +%s` - $secondsStarted ))
echo "Emulator booting took ${bootDuration}s"
adb shell input keyevent 82
fi
script:
- npm run lint && npm run mocha -- -t $MOCHA_TIMEOUT -R spec $RECURSIVE build/test/$TEST -i -g @skip-ci
after_success:
- npm run coverage