mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Merge pull request #1175 from bf4/quiet_success_messages
Disable coverage/warnings output when passing in dev
This commit is contained in:
commit
bac43af0e6
33
.simplecov
33
.simplecov
@ -49,21 +49,32 @@ Coverage.start
|
|||||||
|
|
||||||
## ADD SOME CUSTOM REPORTING AT EXIT
|
## ADD SOME CUSTOM REPORTING AT EXIT
|
||||||
SimpleCov.at_exit do
|
SimpleCov.at_exit do
|
||||||
|
next if $! and not ($!.kind_of? SystemExit and $!.success?)
|
||||||
|
|
||||||
header = "#{'*' * 20} SimpleCov Results #{'*' * 20}"
|
header = "#{'*' * 20} SimpleCov Results #{'*' * 20}"
|
||||||
@output.puts
|
results = SimpleCov.result.format!.join("\n")
|
||||||
@output.puts header
|
exit_message = <<-EOF
|
||||||
@output.puts SimpleCov.result.format!
|
|
||||||
|
#{header}
|
||||||
|
{{RESULTS}}
|
||||||
|
{{FAILURE_MESSAGE}}
|
||||||
|
|
||||||
|
#{'*' * header.size}
|
||||||
|
EOF
|
||||||
percent = Float(SimpleCov.result.covered_percent)
|
percent = Float(SimpleCov.result.covered_percent)
|
||||||
if percent < @minimum_coverage
|
if percent < @minimum_coverage
|
||||||
@output.puts "Spec coverage was not high enough: "\
|
failure_message = <<-EOF
|
||||||
"#{percent.round(2)} is < #{@minimum_coverage}%\n"
|
Spec coverage was not high enough: #{percent.round(2)}% is < #{@minimum_coverage}%
|
||||||
exit 1 if @generate_report
|
EOF
|
||||||
else
|
exit_message.sub!('{{RESULTS}}', results).sub!('{{FAILURE_MESSAGE}}', failure_message)
|
||||||
@output.puts "Nice job! Spec coverage (#{percent.round(2)}) "\
|
@output.puts exit_message
|
||||||
"is still at or above #{@minimum_coverage}%\n"
|
abort(failure_message) if @generate_report
|
||||||
|
elsif @running_ci
|
||||||
|
exit_message.sub!('{{RESULTS}}', results).sub!('{{FAILURE_MESSAGE}}', <<-EOF)
|
||||||
|
Nice job! Spec coverage (#{percent.round(2)}%) is still at or above #{@minimum_coverage}%
|
||||||
|
EOF
|
||||||
|
@output.puts exit_message
|
||||||
end
|
end
|
||||||
@output.puts
|
|
||||||
@output.puts '*' * header.size
|
|
||||||
end
|
end
|
||||||
|
|
||||||
## CAPTURE CONFIG IN CLOSURE 'AppCoverage.start'
|
## CAPTURE CONFIG IN CLOSURE 'AppCoverage.start'
|
||||||
|
|||||||
@ -10,15 +10,14 @@ rvm:
|
|||||||
- 2.0.0
|
- 2.0.0
|
||||||
- 2.1
|
- 2.1
|
||||||
- 2.2
|
- 2.2
|
||||||
- jruby-19mode
|
|
||||||
- rbx-2
|
|
||||||
- ruby-head
|
- ruby-head
|
||||||
|
- rbx-2
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- bundle install --retry=3
|
- bundle install --retry=3
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- bundle exec rake
|
- env CAPTURE_STDERR=false bundle exec rake
|
||||||
- bundle exec rake rubocop
|
- bundle exec rake rubocop
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@ -28,6 +27,9 @@ env:
|
|||||||
- "RAILS_VERSION=master"
|
- "RAILS_VERSION=master"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
include:
|
||||||
|
- rvm: jruby-19mode
|
||||||
|
env: JRUBY_OPTS='--server -Xcompile.invokedynamic=false -Xcli.debug=true --debug'
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- rvm: ruby-head
|
- rvm: ruby-head
|
||||||
- env: "RAILS_VERSION=master"
|
- env: "RAILS_VERSION=master"
|
||||||
|
|||||||
@ -26,38 +26,44 @@ class CaptureWarnings
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/AbcSize
|
|
||||||
def after_tests(lines)
|
def after_tests(lines)
|
||||||
app_warnings, other_warnings = lines.partition do |line|
|
app_warnings, other_warnings = lines.partition do |line|
|
||||||
line.include?(app_root) && !line.include?(bundle_dir)
|
line.include?(app_root) && !line.include?(bundle_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
header = "#{'-' * 22} app warnings: #{'-' * 22}"
|
|
||||||
output.puts
|
|
||||||
output.puts header
|
|
||||||
|
|
||||||
if app_warnings.any?
|
if app_warnings.any?
|
||||||
output.puts app_warnings.join("\n")
|
warnings_message = app_warnings.join("\n")
|
||||||
|
print_warnings = true
|
||||||
else
|
else
|
||||||
output.puts 'None. Yay!'
|
warnings_message = 'None. Yay!'
|
||||||
|
ENV['FULL_BUILD'] ||= ENV['CI']
|
||||||
|
running_ci = ENV['FULL_BUILD'] =~ /\Atrue\z/i
|
||||||
|
print_warnings = running_ci
|
||||||
end
|
end
|
||||||
|
|
||||||
if other_warnings.any?
|
if other_warnings.any?
|
||||||
File.write(File.join(output_dir, 'warnings.txt'), other_warnings.join("\n") << "\n")
|
File.write(File.join(output_dir, 'warnings.txt'), other_warnings.join("\n") << "\n")
|
||||||
output.puts
|
warnings_message << "\nNon-app warnings written to tmp/warnings.txt"
|
||||||
output.puts 'Non-app warnings written to tmp/warnings.txt'
|
print_warnings = true
|
||||||
output.puts
|
|
||||||
end
|
end
|
||||||
|
|
||||||
output.puts
|
header = "#{'-' * 22} app warnings: #{'-' * 22}"
|
||||||
output.puts '-' * header.size
|
message = <<-EOF.strip_heredoc
|
||||||
|
|
||||||
|
#{header}
|
||||||
|
|
||||||
|
#{warnings_message}
|
||||||
|
|
||||||
|
#{'-' * header.size}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
output.puts(message) if print_warnings
|
||||||
|
|
||||||
# fail the build...
|
# fail the build...
|
||||||
if fail_on_warnings && app_warnings.any?
|
if fail_on_warnings && app_warnings.any?
|
||||||
abort "Failing build due to app warnings: #{app_warnings.inspect}"
|
abort "Failing build due to app warnings: #{app_warnings.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/AbcSize
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user