2021-01-06 11:39:46 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-05-31 11:07:03 +03:00
|
|
|
DRONE_PULL_REQUEST=$1
|
|
|
|
LOG_USERNAME=$2
|
|
|
|
LOG_PASSWORD=$3
|
|
|
|
DRONE_BUILD_NUMBER=$4
|
2021-06-11 16:49:34 +03:00
|
|
|
|
2022-06-08 16:40:37 +03:00
|
|
|
function upload_logcat() {
|
2022-07-18 13:01:40 +03:00
|
|
|
log_filename="${DRONE_PULL_REQUEST}_logcat.txt.xz"
|
2022-06-08 16:40:37 +03:00
|
|
|
log_file="app/build/${log_filename}"
|
|
|
|
upload_path="https://nextcloud.kaminsky.me/remote.php/webdav/android-logcat/$log_filename"
|
2022-07-18 13:01:40 +03:00
|
|
|
xz logcat.txt
|
|
|
|
mv logcat.txt.xz "$log_file"
|
2022-06-08 16:40:37 +03:00
|
|
|
curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "$upload_path" --upload-file "$log_file"
|
2022-07-18 13:01:40 +03:00
|
|
|
echo >&2 "Uploaded logcat to https://www.kaminsky.me/nc-dev/android-logcat/$log_filename"
|
2022-06-08 16:40:37 +03:00
|
|
|
}
|
|
|
|
|
2022-05-31 11:07:03 +03:00
|
|
|
scripts/deleteOldComments.sh "master" "IT" "$DRONE_PULL_REQUEST"
|
2021-07-16 12:05:18 +03:00
|
|
|
|
2022-04-26 17:17:37 +03:00
|
|
|
./gradlew assembleGplayDebugAndroidTest
|
2021-06-11 16:49:34 +03:00
|
|
|
|
|
|
|
scripts/wait_for_emulator.sh
|
|
|
|
|
|
|
|
./gradlew installGplayDebugAndroidTest
|
|
|
|
scripts/wait_for_server.sh "server"
|
2022-07-18 13:01:40 +03:00
|
|
|
|
|
|
|
# clear logcat and start saving it to file
|
2022-06-08 16:40:37 +03:00
|
|
|
adb logcat -c
|
2022-07-18 13:01:40 +03:00
|
|
|
adb logcat > logcat.txt &
|
|
|
|
LOGCAT_PID=$!
|
2023-06-07 13:40:40 +03:00
|
|
|
./gradlew createGplayDebugCoverageReport \
|
|
|
|
-Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest \
|
|
|
|
-Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED"
|
|
|
|
|
2022-04-26 16:34:20 +03:00
|
|
|
stat=$?
|
2022-07-18 13:01:40 +03:00
|
|
|
# stop saving logcat
|
|
|
|
kill $LOGCAT_PID
|
2021-06-11 16:49:34 +03:00
|
|
|
|
2021-07-07 10:11:21 +03:00
|
|
|
if [ ! $stat -eq 0 ]; then
|
2022-06-08 16:40:37 +03:00
|
|
|
upload_logcat
|
2022-05-31 11:07:03 +03:00
|
|
|
bash scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$DRONE_BUILD_NUMBER" "master" "IT" "$DRONE_PULL_REQUEST"
|
2021-06-11 16:49:34 +03:00
|
|
|
fi
|
|
|
|
|
2021-10-01 13:47:44 +03:00
|
|
|
curl -Os https://uploader.codecov.io/latest/linux/codecov
|
|
|
|
chmod +x codecov
|
2022-04-27 11:19:23 +03:00
|
|
|
./codecov -t fc506ba4-33c3-43e4-a760-aada38c24fd5 -F integration
|
2021-01-06 11:39:46 +03:00
|
|
|
|
2021-07-07 10:11:21 +03:00
|
|
|
echo "Exit with: " $stat
|
|
|
|
exit $stat
|