Skip to content

Commit

Permalink
Fixes #37092 - Use minitest_reporters_github in GHA
Browse files Browse the repository at this point in the history
This is a specialized reporter to provide GitHub annotations on failure.
These annotations can be seen in the changes files tab.
  • Loading branch information
ekohl authored and stejskalleos committed Feb 15, 2024
1 parent f3be1e5 commit 08097fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions bundler.d/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
gem 'minitest-reporters', '~> 1.4', :require => false
gem 'minitest-retry', '~> 0.0', :require => false
gem 'minitest-spec-rails', '~> 7.1'
gem 'minitest_reporters_github', '~> 1.0', :require => false
gem 'capybara', '~> 3.33', :require => false
gem 'show_me_the_cookies', '~> 6.0', :require => false
gem 'database_cleaner', '~> 1.3', :require => false
Expand Down
17 changes: 13 additions & 4 deletions test/test_report_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
require 'minitest/reporters'

junit_reporter = Minitest::Reporters::JUnitReporter.new('jenkins/reports/unit/')
meantime_reporter = Minitest::Reporters::MeanTimeReporter.new(previous_runs_filename: Rails.root.join('tmp', 'foreman_minitest_reporters_previous_run'),
report_filename: Rails.root.join('tmp', 'foreman_minitest_reporters_report'))
if ENV['GITHUB_ACTIONS'] == 'true'
require 'minitest_reporters_github'
reporters = [MinitestReportersGithub.new]
else
reporters = [
Minitest::Reporters::JUnitReporter.new('jenkins/reports/unit/'),
Minitest::Reporters::MeanTimeReporter.new(
previous_runs_filename: Rails.root.join('tmp', 'foreman_minitest_reporters_previous_run'),
report_filename: Rails.root.join('tmp', 'foreman_minitest_reporters_report')
),
]
end

Minitest::Reporters.use! [junit_reporter, meantime_reporter]
Minitest::Reporters.use! reporters

0 comments on commit 08097fb

Please sign in to comment.