forked from martykan/forecastie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
151 lines (129 loc) · 7.28 KB
/
circle.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
machine:
timezone:
Europe/Vienna
environment:
ZEMU_: "appemu23"
EMU_: "appemu21"
XEMU_: "appemu10"
Zsdpath: "/sdcard"
sdpath: "/storage/sdcard"
Xsdpath: "/mnt/sdcard"
ANDROID_HOME: /usr/local/android-sdk-linux
ANDROID_SDK: /usr/local/android-sdk-linux/
_SDK_: /usr/local/android-sdk-linux/
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1000m -XX:+HeapDumpOnOutOfMemoryError"'
GRADLE_HOME: ~/g/gradle-2.14.1
PATH: ~/g/gradle-2.14.1/bin:$PATH
CLASS_P: cz.martykan.forecastie
START_INTENT_P: .activities.MainActivity
dependencies:
cache_directories:
- ~/.android
- ~/.gradle
override:
- android list sdk --all | grep -i tools
- android list sdk --all --extended
pre:
- sudo apt-get update > /dev/null 2> /dev/null
- sudo apt-get install xvfb > /dev/null 2> /dev/null
- sudo apt-get install xdotool > /dev/null 2> /dev/null
- sudo apt-get install telnet > /dev/null 2> /dev/null
- sudo apt-get install x11-utils > /dev/null 2> /dev/null
- sudo apt-get install xvkbd > /dev/null 2> /dev/null
- sudo apt-get install qrencode > /dev/null 2> /dev/null
- gradle -v
- cd ~ ; wget https://services.gradle.org/distributions/gradle-2.14.1-bin.zip
- mkdir ~/g ; cd ~/g ; unzip ~/gradle-2.14.1-bin.zip
- gradle -v
- echo y | android update sdk --no-ui --all --filter "tools"
- echo y | android update sdk --no-ui --all --filter build-tools-23.0.0 > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter build-tools-23.0.1 > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter build-tools-23.0.2 > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter build-tools-23.0.3 > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter android-23 > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter platform-tools > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter extra-android-m2repository > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter extra-google-m2repository > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter extra-android-support > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter platform-tools-preview > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter sys-img-armeabi-v7a-android-23 > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter sys-img-armeabi-v7a-addon-google_apis-google-23 > /dev/null 2> /dev/null
- echo y | android update sdk --no-ui --all --filter addon-google_apis-google-23 > /dev/null 2> /dev/null
- pwd ; ls -al
- git submodule init
- git submodule update
# - gradle build --stacktrace --info
- ./gradlew build --stacktrace --info --parallel
- find . -name '*.apk' ; exit 0
# --- save lint output ---
- find . -name 'lint-results*.xml' ; exit 0
- find . -name 'lint-results*.html' ; exit 0
- cp /home/ubuntu/forecastie/app/build/outputs/lint-results-debug.html $CIRCLE_ARTIFACTS/ ; exit 0
- cp /home/ubuntu/forecastie/app/build/outputs/lint-results-debug.xml $CIRCLE_ARTIFACTS/ ; exit 0
# --- save lint output ---
# --- find test results ---
- ls -al app/build/test-results/debug/ ; exit 0
- mkdir -p $CIRCLE_ARTIFACTS/tests/ ; exit 0
- cp -v app/build/test-results/debug/* $CIRCLE_ARTIFACTS/tests/ ; exit 0
# --- find test results ---
- mkdir -p app/build/outputs/apk/
- cp -v `find ./build/outputs/apk/ -name '*.apk' 2> /dev/null | tail -1 2> /dev/null` app/build/outputs/apk/app-debug-unaligned.apk ; exit 0
- zip -d app/build/outputs/apk/app-debug-unaligned.apk META-INF/\* ; exit 0 # remove signature (only if it's unsigned) !!
- cp -av app/build/outputs/apk/app-debug-unaligned.apk ~/app.apk ;
cd ~/ ;
echo xxxxxxrm -f ~/.android/debug.keystore ;
ls -al ~/.android/debug.keystore ;
if [ ! -f ~/.android/debug.keystore ]; then echo "*** generating new signer key ***" ;
echo "*** generating new signer key ***";
echo "*** generating new signer key ***";
keytool -genkey -v -keystore ~/.android/debug.keystore -storepass android -keyalg RSA -keysize 2048 -validity 10000 -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US" ;
fi ;
ls -al ~/ ;
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -keypass android -sigalg SHA1withRSA -digestalg SHA1 -sigfile CERT -signedjar app-signed.apk app.apk androiddebugkey ;
ls -al ~/ ;
$_SDK_/build-tools/23.0.1/zipalign -v 4 app-signed.apk app-signed-aligned.apk ;
ls -al ~/ ;
pwd ;
ls -al ;
cp -av app-signed-aligned.apk $CIRCLE_ARTIFACTS/${CIRCLE_PROJECT_REPONAME}_circleci_$CIRCLE_SHA1.apk || exit 1
- qrencode -o $CIRCLE_ARTIFACTS/QR_apk.png 'https://circle-artifacts.com/gh/'${CIRCLE_PROJECT_USERNAME}'/'${CIRCLE_PROJECT_REPONAME}'/'${CIRCLE_BUILD_NUM}'/artifacts/'${CIRCLE_NODE_INDEX}'/tmp/'`basename $CIRCLE_ARTIFACTS`'/'"${CIRCLE_PROJECT_REPONAME}_circleci_$CIRCLE_SHA1.apk" ; exit 0
- qrencode -o $CIRCLE_ARTIFACTS/QR_artifacts.png 'https://circle-artifacts.com/gh/'${CIRCLE_PROJECT_USERNAME}'/'${CIRCLE_PROJECT_REPONAME}'/'${CIRCLE_BUILD_NUM}'#artifacts' ; exit 0
test:
pre:
- mksdcard -l e 180M sdcard.img
- echo 'mtools_skip_check=1' > ~/.mtoolsrc
- android list targets
#
- if [ "$EMU_" == "appemu23" ]; then echo "no" | android create avd -n appemu23 -f -t android-23 --abi default/armeabi-v7a --skin "WXGA720" ; fi
- if [ "$EMU_" == "appemu23" ]; then cat ~/.android/avd/appemu23.avd/config.ini ; fi
#
- if [ "$EMU_" == "appemu21" ]; then echo "no" | android create avd -n appemu21 -f -t android-21 --abi default/armeabi-v7a --skin "WXGA720" ; fi
- if [ "$EMU_" == "appemu21" ]; then cat ~/.android/avd/appemu21.avd/config.ini ; fi
#
- if [ "$EMU_" == "appemu10" ]; then echo "no" | android create avd -n appemu10 -f -t android-10 --abi default/armeabi --skin "WQVGA432" ; fi
- if [ "$EMU_" == "appemu10" ]; then cat ~/.android/avd/appemu10.avd/config.ini ; fi
#
- echo "$EMU_"
- echo "$sdpath"
override:
- emulator -avd "$EMU_" -sdcard sdcard.img -no-audio:
background: true
parallel: true
- circle-android wait-for-boot
- sleep 210 # let the emulator settle down first
- adb shell input keyevent 82
- sleep 10
- import -window root $CIRCLE_ARTIFACTS/capture_emulator_running.png
- fb-adb shell "cat /proc/meminfo" ; exit 0
- adb shell ls -al / ; exit 0
- adb shell ls -al /storage/ ; exit 0
- adb shell ls -al /sdcard/ ; exit 0
- adb install ~/app-signed-aligned.apk
- adb logcat -v time > $CIRCLE_ARTIFACTS/adb_out.txt 2>&1 :
background: true
- sleep 60 # let the emulator settle down first
- fb-adb shell am start -n $CLASS_P/$START_INTENT_P
- sleep 210 # let the app startup
- died_count=`cat $CIRCLE_ARTIFACTS/adb_out.txt|grep 'Process. '"$CLASS_P"', PID.'|wc -l|tr -d ' '` ; if [ $died_count -gt 0 ]; then echo "app crashed"; exit 1; fi
- import -window root $CIRCLE_ARTIFACTS/capture_app_running.png # get proof that the app is running
- adb shell screencap -p | sed 's/\r$//' > $CIRCLE_ARTIFACTS/capture_app_running_2.png