forked from elastos/Elastos.CarrierClassic.Android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
110 lines (102 loc) · 3.51 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
language: android
matrix:
include:
- language: android
android:
components:
- tools
- platform-tools
- build-tools-26.0.1
- android-21
- sys-img-armeabi-v7a-android-21
env: ANDROID_ABI=armeabi-v7a API_LEVEL=android-21
- language: android
android:
components:
- tools
- platform-tools
- build-tools-26.0.1
- android-24
- sys-img-arm64-v8a-android-24
env: ANDROID_ABI=arm64-v8a API_LEVEL=android-24
- language: android
android:
components:
- tools
- platform-tools
- build-tools-26.0.1
- android-24
- sys-img-armeabi-v7a-android-24
env: ANDROID_ABI=armeabi-v7a API_LEVEL=android-24
before_install:
- echo no | android create avd --force -n test -t $API_LEVEL --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-window &
# Update Gradle to 4.10.1
- wget http://services.gradle.org/distributions/gradle-4.10.1-all.zip
- unzip -q gradle-4.10.1-all.zip
- export GRADLE_HOME=$PWD/gradle-4.10.1
- export PATH=$GRADLE_HOME/bin:$PATH
install:
- echo y | sdkmanager 'cmake;3.6.4111459'
- cd /tmp
- wget https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
- unzip -q android-ndk-r16b-linux-x86_64.zip
- export ANDROID_NDK_HOME=/tmp/android-ndk-r16b
- cd $TRAVIS_BUILD_DIR
- .script/download_libs.sh 1
before_script:
- export HOST_IP=`ifconfig eth0 | grep 'inet addr' | awk '{ print $2}' | awk -F"[:]" '{ print $2}'`
- echo $HOST_IP
- sed -i 's/192.168.0.107/'${HOST_IP}'/g' app/src/androidTest/java/org/elastos/carrier/robot/Robot.java
- cat app/src/androidTest/java/org/elastos/carrier/robot/Robot.java
- sed -i 's/127.0.0.1/'${HOST_IP}'/g' /tmp/carrier/etc/carrier/tests.conf
- cat /tmp/carrier/etc/carrier/tests.conf
- export LD_LIBRARY_PATH=/tmp/carrier/lib/
script:
- touch ~/.android/repositories.cfg
- gradle init
- gradle wrapper
- gradle lint
- android-wait-for-emulator
- x=1
- while [[ $x -le 3 ]]; do
ret=`gradle installDebugAndroidTest`;
echo $ret;
ret=`adb shell pm list packages -e | grep elastos`;
if [[ "$ret" != "" ]]; then
return 0;
fi;
x=$(( $x + 1 ));
done
- adb shell logcat -c
- adb shell logcat -v time | grep -E "Test|Debug|RobotConnector|Carrier" &
- /tmp/carrier/bin/elatests --robot -c /tmp/carrier/etc/carrier/tests.conf &
- adb shell am instrument -w -r -e debug false -e class 'org.elastos.carrier.RootTestsuite' org.elastos.carrier.test/android.support.test.runner.AndroidJUnitRunner | tee test.log
- tail -10 test.log
- export RUN_OK=`tail -10 test.log | grep 'OK ('`
- if [[ "$RUN_OK" == "" ]]; then
eval $(tail -10 test.log | grep "Failures" | awk -F "[,:]" '{gsub(/ /,"",$2);gsub(/[ \t\r\n]/,"",$4);print "TotalCase="$2;print "Failures="$4}');
echo "AllCase="${TotalCase}"++-------++";
echo "Fail="${Failures}"++--------++";
if [[ "${Failures}" == "" ]]; then
echo "test interrupted";
export TEST_INTERRUPT=TRUE;
return -1;
fi;
echo "--"${Failures}"--";
if [[ "${Failures}" -ge 3 ]]; then
echo "too much Failures";
return $Failures;
else
if [[ "$TotalCase" -le 3 ]]; then
echo "TestCase do not run, pls check it!";
return -1;
fi;
echo "warning! pls check the failed case!";
fi
fi
after_failure:
- if [[ "$TEST_INTERRUPT" != "" ]]; then
echo "show logcat!";
adb shell logcat -v time -d;
fi