Group commands on GitHub Actions

This commit is contained in:
Nobuyoshi Nakada 2021-08-07 18:32:24 +09:00
parent ac7986f46a
commit 6e60fc2945
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
5 changed files with 43 additions and 1 deletions

View file

@ -1,6 +1,8 @@
require 'rbconfig'
require 'timeout'
github_actions = ENV["GITHUB_ACTIONS"] == "true"
allowed_failures = ENV['TEST_BUNDLED_GEMS_ALLOW_FAILURES'] || ''
allowed_failures = allowed_failures.split(',').reject(&:empty?)
@ -13,7 +15,7 @@ File.foreach("#{gem_dir}/bundled_gems") do |line|
next if /^\s*(?:#|$)/ =~ line
gem = line.split.first
next if ARGV.any? {|pat| !File.fnmatch?(pat, gem)}
puts "\nTesting the #{gem} gem"
puts "#{github_actions ? "##[group]" : "\n"}Testing the #{gem} gem"
test_command = "#{ruby} -C #{gem_dir}/src/#{gem} -Ilib #{rake} test"
first_timeout = 600 # 10min
@ -33,6 +35,7 @@ File.foreach("#{gem_dir}/bundled_gems") do |line|
test_command << " 'TESTOPTS=-e /test_stub_value_block_args_5__break_if_not_passed|test_no_method_error_on_unexpected_methods/'"
end
print "[command]" if github_actions
puts test_command
pid = Process.spawn(test_command, "#{/mingw|mswin/ =~ RUBY_PLATFORM ? 'new_' : ''}pgroup": true)
{nil => first_timeout, INT: 30, TERM: 10, KILL: nil}.each do |sig, sec|
@ -55,6 +58,7 @@ File.foreach("#{gem_dir}/bundled_gems") do |line|
exit_code = $?.exitstatus
end
end
print "##[endgroup]\n" if github_actions
end
puts "Failed gems: #{failed.join(', ')}" unless failed.empty?