2018-03-02 14:08:09 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-03-29 18:56:51 +03:00
|
|
|
# SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
# SPDX-FileCopyrightText: 2018-2022 Tobias Kaminsky <tobias@kaminsky.me>
|
2024-03-29 21:22:56 +03:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
2024-03-29 18:56:51 +03:00
|
|
|
|
2020-02-13 11:33:58 +03:00
|
|
|
upload() {
|
2022-05-31 11:07:03 +03:00
|
|
|
scripts/deleteOldComments.sh "$BRANCH" "$TYPE" "$PR"
|
2020-06-26 13:42:11 +03:00
|
|
|
|
2020-02-13 11:33:58 +03:00
|
|
|
cd $1
|
|
|
|
|
2021-03-18 15:28:05 +03:00
|
|
|
find . -type d -exec curl > /dev/null 2>&1 -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \;
|
|
|
|
find . -type f -exec curl > /dev/null 2>&1 -u $USER:$PASS -X PUT $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
|
2020-02-13 11:33:58 +03:00
|
|
|
|
|
|
|
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
|
|
|
|
|
2021-09-03 13:48:30 +03:00
|
|
|
curl_gh -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
2020-06-17 10:56:12 +03:00
|
|
|
-d "{ \"body\" : \"$BRANCH_TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
|
2020-02-13 11:33:58 +03:00
|
|
|
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2019-02-07 09:28:28 +03:00
|
|
|
#1: LOG_USERNAME
|
|
|
|
#2: LOG_PASSWORD
|
|
|
|
#3: DRONE_BUILD_NUMBER
|
2020-06-26 11:54:25 +03:00
|
|
|
#4: BRANCH (stable or master)
|
|
|
|
#5: TYPE (IT or Unit)
|
|
|
|
#6: DRONE_PULL_REQUEST
|
2019-02-07 09:28:28 +03:00
|
|
|
|
2018-11-01 12:59:08 +03:00
|
|
|
URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
|
2018-03-02 14:08:09 +03:00
|
|
|
ID=$3
|
|
|
|
USER=$1
|
|
|
|
PASS=$2
|
2020-06-10 07:56:17 +03:00
|
|
|
BRANCH=$4
|
|
|
|
TYPE=$5
|
|
|
|
PR=$6
|
2022-05-31 11:07:03 +03:00
|
|
|
|
|
|
|
source scripts/lib.sh
|
2021-09-06 12:29:03 +03:00
|
|
|
|
2020-09-25 12:53:09 +03:00
|
|
|
REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M)
|
2020-06-17 10:56:12 +03:00
|
|
|
BRANCH_TYPE=$BRANCH-$TYPE
|
2018-03-02 14:08:09 +03:00
|
|
|
|
2019-06-06 00:54:07 +03:00
|
|
|
set -e
|
|
|
|
|
2021-02-25 17:32:52 +03:00
|
|
|
if [ -z $USER ] || [ -z $PASS ]; then
|
|
|
|
echo "USER or PASS is empty!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-03-02 14:08:09 +03:00
|
|
|
if [ $TYPE = "IT" ]; then
|
2022-02-04 12:58:19 +03:00
|
|
|
FOLDER=app/build/reports/androidTests/connected/flavors/gplay
|
2019-12-10 17:26:31 +03:00
|
|
|
elif [ $TYPE = "Unit" ]; then
|
2022-02-04 12:58:19 +03:00
|
|
|
FOLDER=app/build/reports/tests/testGplayDebugUnitTest
|
2019-12-10 17:26:31 +03:00
|
|
|
else
|
2022-02-04 12:58:19 +03:00
|
|
|
FOLDER=app/build/reports/shot/gplay/debug/verification
|
2018-03-02 14:08:09 +03:00
|
|
|
fi
|
|
|
|
|
2020-02-13 11:33:58 +03:00
|
|
|
if [ -e $FOLDER ]; then
|
|
|
|
upload $FOLDER
|
|
|
|
else
|
2022-06-02 11:05:26 +03:00
|
|
|
scripts/deleteOldComments.sh "$BRANCH" "$TYPE" "$PR"
|
2020-06-17 10:56:12 +03:00
|
|
|
echo "$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
|
2018-03-02 14:08:09 +03:00
|
|
|
|
2021-09-03 13:48:30 +03:00
|
|
|
curl_gh > /dev/null 2>&1 \
|
2020-02-13 11:33:58 +03:00
|
|
|
-X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
2020-06-17 10:56:12 +03:00
|
|
|
-d "{ \"body\" : \"$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
|
2019-02-07 09:28:28 +03:00
|
|
|
|
2022-02-04 12:58:19 +03:00
|
|
|
if [ -e app/build/reports/androidTests/connected/flavors/gplay ] ; then
|
2020-02-13 11:33:58 +03:00
|
|
|
TYPE="IT"
|
2020-06-17 10:56:12 +03:00
|
|
|
BRANCH_TYPE=$BRANCH-$TYPE
|
2022-02-04 12:58:19 +03:00
|
|
|
upload "app/build/reports/androidTests/connected/flavors/gplay"
|
2020-02-13 11:33:58 +03:00
|
|
|
fi
|
2020-02-05 13:35:02 +03:00
|
|
|
|
2022-02-04 12:58:19 +03:00
|
|
|
if [ -e app/build/reports/tests/testGplayDebugUnitTest ] ; then
|
2020-02-13 11:33:58 +03:00
|
|
|
TYPE="Unit"
|
2020-06-17 10:56:12 +03:00
|
|
|
BRANCH_TYPE=$BRANCH-$TYPE
|
2022-02-04 12:58:19 +03:00
|
|
|
upload "app/build/reports/tests/testGplayDebugUnitTest"
|
2020-02-13 11:33:58 +03:00
|
|
|
fi
|
2020-02-05 13:35:02 +03:00
|
|
|
|
2022-02-04 12:58:19 +03:00
|
|
|
if [ -e app/build/reports/shot/gplay/debug/verification ] ; then
|
2020-02-13 11:33:58 +03:00
|
|
|
TYPE="Screenshot"
|
2020-06-17 10:56:12 +03:00
|
|
|
BRANCH_TYPE=$BRANCH-$TYPE
|
2022-02-04 12:58:19 +03:00
|
|
|
upload "app/build/reports/shot/gplay/debug/verification"
|
2020-02-13 11:33:58 +03:00
|
|
|
fi
|
2020-09-10 13:32:34 +03:00
|
|
|
|
|
|
|
exit 1 # always fail
|
2020-02-13 11:33:58 +03:00
|
|
|
fi
|