-
Notifications
You must be signed in to change notification settings - Fork 6
/
tests.sh
executable file
·48 lines (37 loc) · 1.23 KB
/
tests.sh
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
#!/bin/bash
BUILD_STATUS=0
start_emulator && wait_emulator
# Clean gradle tasks cache from old builds
./gradlew clean --daemon -PdisablePreDex --stacktrace
./gradlew check --daemon -PdisablePreDex --stacktrace
UNIT_STATUS=$?
./gradlew assembleDebugAndroidTest --daemon -PdisablePreDex --stacktrace
unlock_emulator
# Capture logs from emulator
adb logcat -c
adb logcat > logcat.log &
LOGCAT_PID=$!
# Running integration tests
./gradlew connectedCheck -i --daemon -PdisablePreDex --stacktrace
INTEGRATION_STATUS=$?
kill $LOGCAT_PID
# Uploading artifacts to github pages
git remote add upstream "https://[email protected]/Catbag/redux-android-sample.git"
git config --global user.name "Drone CI"
git config --global user.email "[email protected]"
mv app/build/reports /tmp/
mv logcat.log /tmp/
git fetch upstream gh-pages
git checkout upstream/gh-pages -m
rm -Rf app/build/reports logcat.log
mv /tmp/reports app/build/
mv /tmp/logcat.log .
git add app/build/reports/ -f
git add logcat.log -f
git commit -am "Publish results from test #$DRONE_BUILD_NUMBER"
git checkout -b gh-pages
git push -f upstream gh-pages
# Computing build status
BUILD_STATUS=$((UNIT_STATUS + INTEGRATION_STATUS))
# Returning build status
exit $BUILD_STATUS