1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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

@ -760,35 +760,49 @@ $(arch)-fake.rb: $(srcdir)/template/fake.rb.in $(tooldir)/generic_erb.rb version
btest: $(TEST_RUNNABLE)-btest
no-btest: PHONY
yes-btest: fake miniruby$(EXEEXT) PHONY
$(ACTIONS_GROUP)
$(Q)$(exec) $(BOOTSTRAPRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(BTESTRUBY) $(RUN_OPTS)" $(OPTS) $(TESTOPTS) $(BTESTS)
$(ACTIONS_ENDGROUP)
btest-ruby: $(TEST_RUNNABLE)-btest-ruby
no-btest-ruby: PHONY
yes-btest-ruby: prog PHONY
$(ACTIONS_GROUP)
$(Q)$(exec) $(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) -I$(srcdir)/lib $(RUN_OPTS)" -q $(OPTS) $(TESTOPTS) $(BTESTS)
$(ACTIONS_ENDGROUP)
rtest: fake miniruby$(EXEEXT) PHONY
$(ACTIONS_GROUP)
$(Q)$(exec) $(BOOTSTRAPRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(BTESTRUBY) $(RUN_OPTS)" --sets=ractor -v
$(ACTIONS_ENDGROUP)
test-basic: $(TEST_RUNNABLE)-test-basic
no-test-basic: PHONY
yes-test-basic: prog PHONY
$(ACTIONS_GROUP)
$(Q)$(exec) $(RUNRUBY) "$(srcdir)/basictest/runner.rb" --run-opt=$(RUN_OPTS) $(OPTS) $(TESTOPTS)
$(ACTIONS_ENDGROUP)
test-knownbugs: test-knownbug
test-knownbug: $(TEST_RUNNABLE)-test-knownbug
no-test-knownbug: PHONY
yes-test-knownbug: prog PHONY
$(ACTIONS_GROUP)
-$(exec) $(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) $(RUN_OPTS)" $(OPTS) $(TESTOPTS) $(srcdir)/KNOWNBUGS.rb
$(ACTIONS_ENDGROUP)
test-testframework: $(TEST_RUNNABLE)-test-testframework
yes-test-testframework: prog PHONY
$(ACTIONS_GROUP)
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" $(TESTOPTS) testunit minitest
$(ACTIONS_ENDGROUP)
no-test-testframework: PHONY
test-tool: $(TEST_RUNNABLE)-test-tool
yes-test-tool: prog PHONY
$(ACTIONS_GROUP)
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" $(TESTOPTS)
$(ACTIONS_ENDGROUP)
no-test-tool: PHONY
test-sample: test-basic # backward compatibility for mswin-build
@ -799,7 +813,9 @@ test: test-short
# for example, make test-all TESTOPTS="-j2 -v -n test-name -- test-file-name"
test-all: $(TEST_RUNNABLE)-test-all
yes-test-all: programs PHONY
$(ACTIONS_GROUP)
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" $(TEST_EXCLUDES) $(TESTOPTS) $(TESTS)
$(ACTIONS_ENDGROUP)
TESTS_BUILD = mkmf
no-test-all: PHONY
$(gnumake_recursive)$(MINIRUBY) -I"$(srcdir)/lib" "$(TESTSDIR)/runner.rb" $(TESTOPTS) $(TESTS_BUILD)
@ -839,8 +855,10 @@ test-spec-precheck: programs
test-spec: $(TEST_RUNNABLE)-test-spec
yes-test-spec: test-spec-precheck
$(ACTIONS_GROUP)
$(gnumake_recursive)$(Q) \
$(RUNRUBY) -r./$(arch)-fake $(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec -I$(srcdir)/tool/lib $(MSPECOPT) $(SPECOPTS)
$(ACTIONS_ENDGROUP)
no-test-spec:
RUNNABLE = $(LIBRUBY_RELATIVE:no=un)-runnable
@ -1352,8 +1370,10 @@ test-bundled-gems-prepare: test-bundled-gems-precheck test-bundled-gems-fetch
test-bundled-gems-prepare: $(TEST_RUNNABLE)-test-bundled-gems-prepare
no-test-bundled-gems-prepare: no-test-bundled-gems-precheck
yes-test-bundled-gems-prepare: yes-test-bundled-gems-precheck
$(ACTIONS_GROUP)
$(XRUBY) -C "$(srcdir)" bin/gem install --no-document \
--install-dir .bundle --conservative "bundler" "minitest:~> 5" "test-unit" "rake" "hoe" "yard" "pry" "packnga" "rexml" "json-schema" "rbs"
$(ACTIONS_ENDGROUP)
PREPARE_BUNDLED_GEMS = test-bundled-gems-prepare
test-bundled-gems: $(TEST_RUNNABLE)-test-bundled-gems
@ -1373,8 +1393,10 @@ yes-test-bundler-precheck: main
no-test-bundler-prepare: no-test-bundler-precheck
yes-test-bundler-prepare: yes-test-bundler-precheck
$(ACTIONS_GROUP)
$(XRUBY) -C "$(srcdir)" bin/gem install --no-document \
--install-dir .bundle --conservative "rspec:~> 3.8" "rake:~> 13.0" "parallel_tests:~> 2.29"
$(ACTIONS_ENDGROUP)
RSPECOPTS =
BUNDLER_SPECS =

View file

@ -6,6 +6,11 @@ override mflags := $(filter-out -j%,$(MFLAGS))
MSPECOPT += $(if $(filter -j%,$(MFLAGS)),-j)
nproc = $(subst -j,,$(filter -j%,$(MFLAGS)))
ifeq ($(GITHUB_ACTIONS),true)
override ACTIONS_GROUP = @echo "\#\#[group]$(@:yes-=)"
override ACTIONS_ENDGROUP = @echo "\#\#[endgroup]"
endif
ifneq ($(filter %darwin%,$(arch)),)
INSTRUBY_ENV += SDKROOT=/
endif

View file

@ -256,6 +256,9 @@ MESSAGE_END = ; do echo "$$line"; done
ECHO_BEGIN = @sep=''; for word in
ECHO_END = ; do echo @ECHO_N@ "$$sep'$$word'@ECHO_C@"; sep=' '; done; echo
ACTIONS_GROUP = @$(NULLCMD) $(empty)
ACTIONS_ENDGROUP = @$(NULLCMD)
DESTDIR = @DESTDIR@
configure_args = @configure_args@

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?

View file

@ -526,6 +526,14 @@ GOLF_PRELUDE_C = golf_prelude.c
!endif
RBCONFIG = ./.rbconfig.time
!if "$(GITHUB_ACTIONS)" == "true"
ACTIONS_GROUP = @echo ^#^#[group]$(@:yes-=)
ACTIONS_ENDGROUP = @echo ^#^#[endgroup]
!else
ACTIONS_GROUP = @:: $(empty)
ACTIONS_ENDGROUP = @::
!endif
!include $(srcdir)/common.mk
!ifdef SCRIPTPROGRAMS