Browse Source

Show failing test url as comment in github

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 6 years ago
parent
commit
93f52c463d
3 changed files with 15 additions and 4 deletions
  1. 3 3
      .drone.yml
  2. 1 1
      scripts/analysis/analysis-wrapper.sh
  3. 11 0
      scripts/uploadReport.sh

+ 3 - 3
.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

+ 1 - 1
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

+ 11 - 0
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