Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Improve danger message #1339

Merged
merged 1 commit into from Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 10 additions & 15 deletions Dangerfile
Expand Up @@ -7,20 +7,14 @@ require 'logger'
def run_pmdtester
Dir.chdir('..') do
argv = ['-r', './pmd', '-b', "#{ENV['TRAVIS_BRANCH']}", '-p', 'FETCH_HEAD', '-m', 'online', '-a']
Process.fork do
begin
runner = PmdTester::Runner.new(argv)
introduce_new_pmd_errors = runner.run
warn("The PR may introduce new PMD errors!") if introduce_new_pmd_errors
rescue StandardError => e
warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.")
@logger.error "Running pmdtester failed: #{e.inspect}"
exit 1
end
end
Process.wait

upload_report if $?.success?
begin
runner = PmdTester::Runner.new(argv)
@new_errors, @removed_errors, @new_violations, @removed_violations = runner.run
upload_report
rescue StandardError => e
warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.")
@logger.error "Running pmdtester failed: #{e.inspect}"
end
end
end

Expand All @@ -38,7 +32,8 @@ def upload_report
@logger.info "Successfully uploaded #{tar_filename} to chunk.io"

# set value of sticky to true and the message is kept after new commits are submited to the PR
message("Please check the [regression diff report](#{report_url.chomp}/diff/index.html) to make sure that everything is expected", sticky: true)
message("This changeset introduce #{@new_violations} new violations and #{@new_errors} new errors,\n" +
"removes #{@removed_violations} violations and #{@removed_errors} errors. [Full report](#{report_url.chomp}/diff/index.html)", sticky: true)
else
@logger.error "Error while uploading #{tar_filename} to chunk.io: #{report_url}"
warn("Uploading the diff report failed, this message is mainly used to remind the maintainers of PMD.")
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org/'

gem 'pmdtester', '~> 1.0.0.pre.beta3'
gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, we should go back to a fixed version. But let's use the snapshot version for a while and test it that way.

gem 'danger', '~> 5.6', '>= 5.6'

# This group is only needed for rendering release notes
Expand Down