uploadReport.sh 1001 B

1234567891011121314151617181920212223242526272829303132333435
  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. FOLDER=$ID-$TYPE
  15. set -e
  16. if [ $TYPE = "IT" ]; then
  17. cd build/reports/androidTests/connected/flavors/GPLAY
  18. elif [ $TYPE = "Unit" ]; then
  19. cd build/reports/tests/testGplayDebugUnitTest
  20. else
  21. cd build/reports/shot/verification/
  22. fi
  23. find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$FOLDER/$(echo {} | sed s#\./##) \;
  24. find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
  25. echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$FOLDER"
  26. curl -u $6:$7 -X POST https://api.github.com/repos/nextcloud/android/issues/$5/comments -d "{ \"body\" : \"$TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$FOLDER \" }"
  27. exit 1