forked from wbinarytree/android-architecture-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_all_ftl.sh
executable file
·44 lines (36 loc) · 1.76 KB
/
test_all_ftl.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
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status.
for line in $(find . -name 'gradlew'); do
p=$(dirname "${line}");
name="${p##*/}";
echo
echo
echo Running unit and Android tests in $name
echo "====================================================================="
pushd $p > /dev/null # Silent pushd
./gradlew :app:assembleDebug -PdisablePreDex | sed "s@^@$name @" # Prefix every line with directory
code=${PIPESTATUS[0]}
if [ "$code" -ne "0" ]; then
exit $code
fi
./gradlew :app:assembleAndroidTest -PdisablePreDex | sed "s@^@$name @" # Prefix every line with directory
./gradlew test -PdisablePreDex | sed "s@^@$name @" # Prefix every line with directory
apkfile=app/build/outputs/apk/debug/app-debug.apk
testapkfile=app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
if [ ! -f $apkfile ] || [ ! -f $testapkfile ] ; then
echo "APKs not found, probably due to project using multiple flavors. Skipping $name"
popd > /dev/null # Silent popd
continue
fi
echo "Sending APKs to Firebase..."
echo "y" | sudo /opt/google-cloud-sdk/bin/gcloud firebase test android run --app $apkfile --test $testapkfile -d Nexus5X -v 26 -l fr --results-bucket=android-architecture-components-test-results --results-dir=$CIRCLE_BUILD_NUM/$name
code=${PIPESTATUS[0]}
if [ "$code" -ne "0" ]; then
exit $code
fi
# Copy the test results to the build artifacts folder in CircleCI
sudo /opt/google-cloud-sdk/bin/gsutil -m cp -r -U `sudo /opt/google-cloud-sdk/bin/gsutil ls gs://android-architecture-components-test-results/$CIRCLE_BUILD_NUM/$name/**/test_result*.xml | tail -1` $CIRCLE_ARTIFACTS/ | true
popd > /dev/null # Silent popd
done
echo
echo "ALL TESTS PASS"