From 93f52c463ded24a2e86946df192858a589a37d78 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 7 Feb 2019 07:28:28 +0100 Subject: [PATCH] Show failing test url as comment in github Signed-off-by: tobiasKaminsky --- .drone.yml | 6 +++--- scripts/analysis/analysis-wrapper.sh | 2 +- scripts/uploadReport.sh | 11 +++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index dfb031099f..d8490c32ac 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,13 +15,13 @@ pipeline: - emulator -avd android-27 -no-window -no-audio & - ./wait_for_emulator.sh - ./gradlew assembleGplayDebug - - ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" + - ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN - ./gradlew installGplayDebugAndroidTest - - ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" + - ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN - ./gradlew combinedTestReport - curl -o codecov.sh https://codecov.io/bash - bash ./codecov.sh -t fc506ba4-33c3-43e4-a760-aada38c24fd5 - secrets: [ LOG_USERNAME, LOG_PASSWORD ] + secrets: [ LOG_USERNAME, LOG_PASSWORD, GIT_USERNAME, GIT_TOKEN ] when: matrix: FLAVOR: Gplay diff --git a/scripts/analysis/analysis-wrapper.sh b/scripts/analysis/analysis-wrapper.sh index 456e974021..be22f6ebfc 100755 --- a/scripts/analysis/analysis-wrapper.sh +++ b/scripts/analysis/analysis-wrapper.sh @@ -74,7 +74,7 @@ else fi # add comment with results - lintResultNew=$(grep "Lint Report.* [0-9]* warnings" build/reports/lint/lint.html | cut -f2 -d':' |cut -f1 -d'<') + lintResultNew=$(grep "Lint Report.* [0-9]* warning" build/reports/lint/lint.html | cut -f2 -d':' |cut -f1 -d'<') lintErrorNew=$(echo $lintResultNew | grep "[0-9]* error" -o | cut -f1 -d" ") if ( [ -z $lintErrorNew ] ); then diff --git a/scripts/uploadReport.sh b/scripts/uploadReport.sh index 70509c6fa4..88b84961c1 100755 --- a/scripts/uploadReport.sh +++ b/scripts/uploadReport.sh @@ -1,5 +1,13 @@ #!/usr/bin/env bash +#1: LOG_USERNAME +#2: LOG_PASSWORD +#3: DRONE_BUILD_NUMBER +#4: TYPE (IT or Unit) +#5: DRONE_PULL_REQUEST +#6: GIT_USERNAME +#7: GIT_TOKEN + URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests ID=$3 USER=$1 @@ -16,4 +24,7 @@ find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$ID/$(echo {} | sed s#\./ find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$ID/$(echo {} | sed s#\./##) --upload-file {} \; echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$ID" + +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/$ID \" }" + exit 1