uploadReport.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/usr/bin/env bash
  2. upload() {
  3. scripts/deleteOldComments.sh "$BRANCH" "$TYPE" "$PR"
  4. cd $1
  5. find . -type d -exec curl > /dev/null 2>&1 -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \;
  6. find . -type f -exec curl > /dev/null 2>&1 -u $USER:$PASS -X PUT $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
  7. echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
  8. curl_gh -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
  9. -d "{ \"body\" : \"$BRANCH_TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
  10. exit 1
  11. }
  12. #1: LOG_USERNAME
  13. #2: LOG_PASSWORD
  14. #3: DRONE_BUILD_NUMBER
  15. #4: BRANCH (stable or master)
  16. #5: TYPE (IT or Unit)
  17. #6: DRONE_PULL_REQUEST
  18. URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
  19. ID=$3
  20. USER=$1
  21. PASS=$2
  22. BRANCH=$4
  23. TYPE=$5
  24. PR=$6
  25. source scripts/lib.sh
  26. REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M)
  27. BRANCH_TYPE=$BRANCH-$TYPE
  28. set -e
  29. if [ -z $USER ] || [ -z $PASS ]; then
  30. echo "USER or PASS is empty!"
  31. exit 1
  32. fi
  33. if [ $TYPE = "IT" ]; then
  34. FOLDER=app/build/reports/androidTests/connected/flavors/gplay
  35. elif [ $TYPE = "Unit" ]; then
  36. FOLDER=app/build/reports/tests/testGplayDebugUnitTest
  37. else
  38. FOLDER=app/build/reports/shot/gplay/debug/verification
  39. fi
  40. if [ -e $FOLDER ]; then
  41. upload $FOLDER
  42. else
  43. scripts/deleteOldComments.sh "$BRANCH" "$TYPE" "$PR"
  44. echo "$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
  45. curl_gh > /dev/null 2>&1 \
  46. -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
  47. -d "{ \"body\" : \"$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
  48. if [ -e app/build/reports/androidTests/connected/flavors/gplay ] ; then
  49. TYPE="IT"
  50. BRANCH_TYPE=$BRANCH-$TYPE
  51. upload "app/build/reports/androidTests/connected/flavors/gplay"
  52. fi
  53. if [ -e app/build/reports/tests/testGplayDebugUnitTest ] ; then
  54. TYPE="Unit"
  55. BRANCH_TYPE=$BRANCH-$TYPE
  56. upload "app/build/reports/tests/testGplayDebugUnitTest"
  57. fi
  58. if [ -e app/build/reports/shot/gplay/debug/verification ] ; then
  59. TYPE="Screenshot"
  60. BRANCH_TYPE=$BRANCH-$TYPE
  61. upload "app/build/reports/shot/gplay/debug/verification"
  62. fi
  63. exit 1 # always fail
  64. fi