uploadReport.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env bash
  2. #1: LOG_USERNAME
  3. #2: LOG_PASSWORD
  4. #3: DRONE_BUILD_NUMBER
  5. #4: TYPE (IT or Unit)
  6. #5: DRONE_PULL_REQUEST
  7. #6: GIT_USERNAME
  8. #7: GIT_TOKEN
  9. URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
  10. ID=$3
  11. USER=$1
  12. PASS=$2
  13. TYPE=$4
  14. REMOTE_FOLDER=$ID-$TYPE
  15. set -e
  16. if [ $TYPE = "IT" ]; then
  17. FOLDER=build/reports/androidTests/connected/flavors/GPLAY
  18. elif [ $TYPE = "Unit" ]; then
  19. FOLDER=build/reports/tests/testGplayDebugUnitTest
  20. else
  21. FOLDER=build/reports/shot/verification/
  22. fi
  23. if [ ! -e $FOLDER ]; then
  24. echo "$TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
  25. curl -u $6:$7 \
  26. -X POST https://api.github.com/repos/nextcloud/android/issues/$5/comments \
  27. -d "{ \"body\" : \"$TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
  28. exit 1
  29. fi
  30. cd $FOLDER
  31. find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \;
  32. find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
  33. echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
  34. curl -u $6:$7 -X POST https://api.github.com/repos/nextcloud/android/issues/$5/comments \
  35. -d "{ \"body\" : \"$TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
  36. exit 1