#!/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