Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/talk-android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobiasKaminsky <tobias@kaminsky.me>2018-09-07 14:11:47 +0300
committertobiasKaminsky <tobias@kaminsky.me>2018-09-07 15:32:51 +0300
commit22142f191510ee02fb981c95b251a69c52e68be9 (patch)
tree5418ccce523631104ee0126d158be4afbcad7b77 /scripts
parent3c3769432b0ea6fb9769f0f721ff80fe5081c279 (diff)
Findbugs, lint
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/analysis/analysis-wrapper.sh80
-rwxr-xr-xscripts/analysis/getBranchName.sh (renamed from scripts/lint/getBranchName.sh)0
-rw-r--r--scripts/analysis/lint-results.txt2
-rw-r--r--scripts/analysis/lint-up.rb (renamed from scripts/lint/lint-up.rb)4
-rw-r--r--scripts/lint/lint-results.txt2
-rwxr-xr-xscripts/lint/lint-up-wrapper.sh36
6 files changed, 84 insertions, 40 deletions
diff --git a/scripts/analysis/analysis-wrapper.sh b/scripts/analysis/analysis-wrapper.sh
new file mode 100755
index 000000000..bf2b6b324
--- /dev/null
+++ b/scripts/analysis/analysis-wrapper.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+
+#1: GIT_USERNAME
+#2: GIT_TOKEN
+#3: BRANCH
+#4: LOG_USERNAME
+#5: LOG_PASSWORD
+#6: DRONE_BUILD_NUMBER
+#7: PULL_REQUEST_NUMBER
+
+echo "1: " $1
+echo "2: " $2
+echo "3: " $3
+echo "4: " $4
+echo "5: " $5
+echo "6: " $6
+echo "7: " $7
+
+exit 1
+
+ruby scripts/analysis/lint-up.rb $1 $2 $3
+lintValue=$?
+
+
+
+./gradlew assemble app:findbugs
+
+# exit codes:
+# 0: count was reduced
+# 1: count was increased
+# 2: count stayed the same
+
+echo "Branch: $3"
+
+if [ $3 = "master" ]; then
+ echo "New findbugs result for master at: https://www.kaminsky.me/nc-dev/talk-findbugs/master.html"
+ curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/master.html --upload-file build/reports/findbugs/findbugs.html
+
+ summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s'/Summary/FindBugs (master)/' | tr "\"" "\'" | tr -d "\r\n")
+ curl -u $4:$5 -X PUT -d "$summary" https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/findbugs.html
+
+ if [ $lintValue -ne 1 ]; then
+ echo "New lint result for master at: https://www.kaminsky.me/nc-dev/talk-lint/master.html"
+ curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-droneLogs/master.html --upload-file build/reports/lint/lint.html
+ exit 0
+ fi
+else
+ if [ -e $6 ]; then
+ 6="master-"$(date +%F)
+ fi
+ echo "New lint results at https://www.kaminsky.me/nc-dev/talk-lint/$6.html"
+ curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-droneLogs/$6.html --upload-file build/reports/lint/lint.html
+
+ echo "New findbugs results at https://www.kaminsky.me/nc-dev/talk-findbugs/$6.html"
+ curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/$6.html --upload-file build/reports/findbugs/findbugs.html
+
+ # delete all old comments
+ oldComments=$(curl 2>/dev/null -u $1:$2 -X GET https://api.github.com/repos/nextcloud/talk-android/issues/$7/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) ' | grep true | tr -d "\"" | cut -f1 -d"|")
+
+ echo $oldComments | while read comment ; do
+ curl 2>/dev/null -u $1:$2 -X DELETE https://api.github.com/repos/nextcloud/talk-android/issues/comments/$comment
+ done
+
+ # add comment with results
+ lintResultNew=$(grep "Lint Report.* [0-9]* warnings" build/reports/lint/lint.html | cut -f2 -d':' |cut -f1 -d'<')
+ lintErrorNew=$(echo $lintResultNew | grep "[0-9]* error" -o | cut -f1 -d" ")
+ lintWarningNew=$(echo $lintResultNew | grep "[0-9]* warning" -o | cut -f1 -d" ")
+ lintErrorOld=$(grep "[0-9]* error" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
+ lintWarningOld=$(grep "[0-9]* warning" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
+ lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td><a href='https://www.kaminsky.me/nc-dev/client-lint/master.html'>Master</a></td><td><a href='https://www.kaminsky.me/nc-dev/client-lint/"$6".html'>PR</a></td></tr><tr class='tablerow1'><td>Warnings</td><td>"$lintWarningOld"</td><td>"$lintWarningNew"</td></tr><tr class='tablerow0'><td>Errors</td><td>"$lintErrorOld"</td><td>"$lintErrorNew"</td></tr></table>"
+ findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/client-findbugs/$6.html\">FindBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
+ findbugsResultOld=$(curl 2>/dev/null https://nextcloud.kaminsky.me/index.php/s/YCD729NgcMAYkJT/download | tr "\"" "\'" | tr -d "\r\n" | sed s'#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/client-findbugs/master.html">FindBugs</a>#'| tr "\"" "\'" | tr -d "\n")
+ curl -u $1:$2 -X POST https://api.github.com/repos/nextcloud/talk-android/issues/$7/comments -d "{ \"body\" : \"$lintResult $findbugsResultNew $findbugsResultOld \" }"
+
+ if [ $lintValue -eq 2 ]; then
+ exit 0
+ else
+ exit $lintValue
+ fi
+fi
diff --git a/scripts/lint/getBranchName.sh b/scripts/analysis/getBranchName.sh
index 7b91215c5..7b91215c5 100755
--- a/scripts/lint/getBranchName.sh
+++ b/scripts/analysis/getBranchName.sh
diff --git a/scripts/analysis/lint-results.txt b/scripts/analysis/lint-results.txt
new file mode 100644
index 000000000..9a13c695d
--- /dev/null
+++ b/scripts/analysis/lint-results.txt
@@ -0,0 +1,2 @@
+DO NOT TOUCH; GENERATED BY DRONE
+ <span class="mdl-layout-title">Lint Report: 91 warnings</span>
diff --git a/scripts/lint/lint-up.rb b/scripts/analysis/lint-up.rb
index 1d02185be..ad8c8b81c 100644
--- a/scripts/lint/lint-up.rb
+++ b/scripts/analysis/lint-up.rb
@@ -21,7 +21,7 @@ TRAVIS_GIT_USERNAME = String.new("Drone CI server")
LINT_REPORT_FILE = String.new("app/build/reports/lint/lint.html")
# File name and relative path of previous results of this script.
-PREVIOUS_LINT_RESULTS_FILE=String.new("scripts/lint/lint-results.txt")
+PREVIOUS_LINT_RESULTS_FILE=String.new("scripts/analysis/lint-results.txt")
# Flag to evaluate warnings. true = check warnings; false = ignore warnings
CHECK_WARNINGS = true
@@ -56,7 +56,7 @@ end
# run Lint
puts "running Lint..."
-system './gradlew clean assembleGplay lint'
+system './gradlew clean assemble lint'
# confirm that Lint ran w/out error
result = $?.to_i
diff --git a/scripts/lint/lint-results.txt b/scripts/lint/lint-results.txt
deleted file mode 100644
index 24702d5bc..000000000
--- a/scripts/lint/lint-results.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-DO NOT TOUCH; GENERATED BY DRONE
- <span class="mdl-layout-title">Lint Report: 88 warnings</span>
diff --git a/scripts/lint/lint-up-wrapper.sh b/scripts/lint/lint-up-wrapper.sh
deleted file mode 100755
index b4efc0687..000000000
--- a/scripts/lint/lint-up-wrapper.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-#1: GIT_USERNAME
-#2: GIT_TOKEN
-#3: BRANCH
-#4: LOG_USERNAME
-#5: LOG_PASSWORD
-#6: DRONE_BUILD_NUMBER
-
-ruby scripts/lint/lint-up.rb $1 $2 $3
-returnValue=$?
-
-# exit codes:
-# 0: count was reduced
-# 1: count was increased
-# 2: count stayed the same
-
-echo "Branch: $3"
-
-if [ $3 = "master" -a $returnValue -ne 1 ]; then
- echo "New master at: https://nextcloud.kaminsky.me/index.php/s/fyxdQjc7LCiy57C"
- curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-droneLogs/master.html --upload-file app/build/reports/lint/lint.html
- exit 0
-else
- if [ -e $6 ]; then
- 6="master-"$(date +%F)
- fi
- echo "New results at https://nextcloud.kaminsky.me/index.php/s/fyxdQjc7LCiy57C ->" $6.html
- curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-droneLogs/$6.html --upload-file app/build/reports/lint/lint.html
-
- if [ $returnValue -eq 2 ]; then
- exit 0
- else
- exit $returnValue
- fi
-fi