diff options
Diffstat (limited to 'scripts/analysis/lint-up.rb')
-rw-r--r-- | scripts/analysis/lint-up.rb | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/scripts/analysis/lint-up.rb b/scripts/analysis/lint-up.rb index 44eb132d8..c9d486413 100644 --- a/scripts/analysis/lint-up.rb +++ b/scripts/analysis/lint-up.rb @@ -1,14 +1,14 @@ ## Script from https://github.com/tir38/android-lint-entropy-reducer at 07.05.2017 # adapts to drone, use git username / token as parameter +# TODO cleanup this script, it has a lot of unused stuff + + Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8 puts "=================== starting Android Lint Entropy Reducer ====================" -# get args -git_user, git_token, git_branch = ARGV - # ======================== SETUP ============================ # User name for git commits made by this script. @@ -39,7 +39,7 @@ require 'open3' begin gem "xml-simple" rescue LoadError - system("gem install xml-simple") + system("gem install --user-install xml-simple") Gem.clear_paths end @@ -56,12 +56,12 @@ end # run Lint puts "running Lint..." -system './gradlew --console=plain lintGplayDebug' +system './gradlew clean lintGplayDebug 1>/dev/null' # confirm that Lint ran w/out error result = $?.to_i if result != 0 - puts "FAIL: failed to run ./gradlew --console=plain lintGplayDebug" + puts "FAIL: failed to run ./gradlew clean lintGplayDebug" exit 1 end @@ -169,31 +169,18 @@ end # write new results to file (will overwrite existing, or create new) File.write(previous_lint_report, "DO NOT TOUCH; GENERATED BY DRONE\n" + error_warning_string) -# push changes to github (if this script is run locally, we don't want to overwrite git username and email, so save temporarily) -previous_git_username, _ = Open3.capture2('git config user.name') -previous_git_username = previous_git_username.strip - -previous_git_email, _ = Open3.capture3('git config user.email') -previous_git_email = previous_git_email.strip - # update git user name and email for this script -system ("git config --local user.name '" + git_user + "'") -system ("git config --local user.email '.'") # set email blank -system ("git remote rm origin") -system ("git remote add origin https://" + git_user + ":" + git_token + "@github.com/nextcloud/talk-android") +system ("git config --local user.name 'github-actions'") +system ("git config --local user.email 'github-actions@github.com'") # add previous Lint result file to git system ('git add ' + PREVIOUS_LINT_RESULTS_FILE) -# commit changes; Add "skip ci" so that we don't accidentally trigger another Drone build -system({"GIT_COMMITTER_EMAIL" => "drone@nextcloud.com", "GIT_AUTHOR_EMAIL" => "drone@nextcloud.com"}, 'git commit -sm "Drone: update Lint results to reflect reduced error/warning count [skip ci]"') +# commit changes +system('git commit -sm "Analysis: update lint results to reflect reduced error/warning count"') # push to origin -system ('git push origin HEAD:' + git_branch) - -# restore previous git user name and email -system("git config --local user.name '#{previous_git_username}'") -system("git config --local user.email '#{previous_git_email}'") +system ('git push') puts "SUCCESS: count was reduced" exit 0 # success |