diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-07 18:32:24 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-07 18:32:24 +0900 |
commit | 6e60fc29453603270ebdf79f4b37ec6544a602cc (patch) | |
tree | 9792295c75e0291c21e0fd5707d3fc3772d48aac | |
parent | ac7986f46a1fc5686b006625a16a9ff62579efe7 (diff) | |
download | ruby-6e60fc29453603270ebdf79f4b37ec6544a602cc.tar.gz |
Group commands on GitHub Actions
-rw-r--r-- | common.mk | 22 | ||||
-rw-r--r-- | defs/gmake.mk | 5 | ||||
-rw-r--r-- | template/Makefile.in | 3 | ||||
-rw-r--r-- | tool/test-bundled-gems.rb | 6 | ||||
-rw-r--r-- | win32/Makefile.sub | 8 |
5 files changed, 43 insertions, 1 deletions
@@ -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 = diff --git a/defs/gmake.mk b/defs/gmake.mk index 8e90ee8802..37924b3b71 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -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 diff --git a/template/Makefile.in b/template/Makefile.in index 60a068dadf..866fff192f 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -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@ diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb index 53c88c196e..d4c45332ab 100644 --- a/tool/test-bundled-gems.rb +++ b/tool/test-bundled-gems.rb @@ -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? diff --git a/win32/Makefile.sub b/win32/Makefile.sub index a1242363f7..6234bfb4b3 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -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 |