Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions scripts/runCombinedTest.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
#!/bin/bash
set -euo pipefail

# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2021-2023 Tobias Kaminsky <tobias@kaminsky.me>
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only

DRONE_PULL_REQUEST=$1
LOG_USERNAME=$2
LOG_PASSWORD=$3
DRONE_BUILD_NUMBER=$4
DRONE_PULL_REQUEST="$1"
LOG_USERNAME="$2"
LOG_PASSWORD="$3"
DRONE_BUILD_NUMBER="$4"

function upload_logcat() {
log_filename="${DRONE_PULL_REQUEST}_logcat.txt.xz"
log_file="app/build/${log_filename}"
upload_path="https://nextcloud.kaminsky.me/remote.php/webdav/android-logcat/$log_filename"

xz logcat.txt
mv logcat.txt.xz "$log_file"

curl -u "${LOG_USERNAME}:${LOG_PASSWORD}" -X PUT "$upload_path" --upload-file "$log_file"
echo >&2 "Uploaded logcat to https://www.kaminsky.me/nc-dev/android-logcat/$log_filename"
}

scripts/deleteOldComments.sh "master" "IT" "$DRONE_PULL_REQUEST"

./gradlew assembleGplayDebugAndroidTest

scripts/wait_for_emulator.sh || exit 1

./gradlew installGplayDebugAndroidTest
Expand All @@ -32,22 +34,26 @@ scripts/wait_for_server.sh "server" || exit 1
adb logcat -c
adb logcat > logcat.txt &
LOGCAT_PID=$!

./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"
-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"

stat=$?
# stop saving logcat
kill $LOGCAT_PID

if [ ! $stat -eq 0 ]; then
# safely stop logcat
wait "$LOGCAT_PID" 2>/dev/null || true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long does this wait?
adb logcat will run as long as the emulator runs, which we never stop

kill "$LOGCAT_PID" 2>/dev/null || true

if [ "$stat" -ne 0 ]; then
upload_logcat
bash scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$DRONE_BUILD_NUMBER" "master" "IT" "$DRONE_PULL_REQUEST"
fi

curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t fc506ba4-33c3-43e4-a760-aada38c24fd5 -F integration
./codecov -t "$CODECOV_TOKEN" -F integration

echo "Exit with: " $stat
exit $stat
echo "Exit with: $stat"
exit "$stat"
Loading