forked from dropbox/dropbox-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease-check
executable file
·87 lines (68 loc) · 2.19 KB
/
release-check
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
#!/usr/bin/env bash
die() {
echo >&2 "error: release checks failed"
exit 1
}
# Exit immediately on any error.
set -euf
trap die SIGTERM
DIR=`dirname $(dirname "${BASH_SOURCE[0]}")`
run() {
echo "================================================================================"
echo " CMD: $@"
echo " OUTPUT:"
$@ || die
echo "================================================================================"
}
gradle() {
(cd "${DIR}" && run ./gradlew -c standalone-settings.gradle "$@")
}
examples_gradle() {
(cd "${DIR}/examples" && run ./gradlew "$@")
}
android_gradle() {
(cd "${DIR}/examples/android" && run ./gradlew "$@")
}
run_example() {
(cd "${DIR}/examples" && run ./run --fail-on-error "$@")
}
if [ $# -ne 1 ] ; then
script=`basename "${0}"`
echo >&2 "usage: $script production-user-auth.json"
exit 1
fi
AUTH_FILE="${1}"
if [ ! -f "${AUTH_FILE}" ] ; then
echo >&2 "error: no such file: ${AUTH_FILE}"
exit 1
fi
tempfile=$(mktemp -t `basename "${BASH_SOURCE[0]}"`.XXXXXXXXXX)
function cleanup() {
[ ! -e "${tempfile}" ] || rm -f "${tempfile}"
}
trap cleanup EXIT
echo "Running release checks..."
echo ""
echo "A series of tests will be performed to verify package is ready for release."
echo "These tests may take a while to complete."
echo ""
gradle clean
gradle check
# prepare examples to be run
gradle install
examples_gradle clean
examples_gradle classes
# run examples
DATE=$(date -u '+%Y%m%d%H%M%S')
run_example account-info "${AUTH_FILE}"
cat /dev/urandom | head -c 1024 > "${tempfile}"
run_example upload-file "${AUTH_FILE}" "${tempfile}" /test/dropbox-sdk-java/${DATE}/examples/upload-file/small-1KiB.dat
cat /dev/urandom | head -c $(( 32 << 20 )) > "${tempfile}"
run_example upload-file "${AUTH_FILE}" "${tempfile}" /test/dropbox-sdk-java/${DATE}/examples/upload-file/large-32MiB.dat
# build android
android_gradle clean
android_gradle assemble
# Run integration tests against major HTTP requestor implementations
for requestor in "StandardHttpRequestor" "OkHttpRequestor" "OkHttp3Requestor" ; do
gradle -Pcom.dropbox.test.httpRequestor="${requestor}" -Pcom.dropbox.test.authInfoFile="${AUTH_FILE}" integrationTest proguardTest
done