This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a5f50300466 [SPARK-55721][INFRA] Group sbt build messages in github 
actions
3a5f50300466 is described below

commit 3a5f50300466a578006511c093d603d95c80357c
Author: Tian Gao <[email protected]>
AuthorDate: Tue Mar 3 09:25:09 2026 +0900

    [SPARK-55721][INFRA] Group sbt build messages in github actions
    
    ### What changes were proposed in this pull request?
    
    In github actions, group the sbt build output so it is collapsable.
    
    ### Why are the changes needed?
    
    This PR is made in favor of #54052. The sbt build outputs thousands of 
lines that many people do not care. It lags the webpage and made it difficult 
for people to find the part they are interested in.
    
    However, some people are interested in the message so it might not be the 
best solution to completely make `sbt build` quiet.
    
    By making it collapsable, I think everyone gets what they want.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Check the result of the CI of this PR to see the difference.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #54524 from gaogaotiantian/group-sbt-build-message.
    
    Authored-by: Tian Gao <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 dev/run-tests.py | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/dev/run-tests.py b/dev/run-tests.py
index 3401a56d5d6c..0b7a90694385 100755
--- a/dev/run-tests.py
+++ b/dev/run-tests.py
@@ -23,6 +23,7 @@ import os
 import re
 import sys
 import subprocess
+from contextlib import contextmanager
 
 from sparktestsupport import SPARK_HOME, USER_HOME, ERROR_CODES
 from sparktestsupport.shellutils import exit_from_command_with_retcode, 
run_cmd, rm_r, which
@@ -78,6 +79,18 @@ def set_title_and_block(title, err_block):
     print(line_str)
 
 
+@contextmanager
+def group_in_github_actions(title):
+    if "GITHUB_ACTIONS" in os.environ:
+        print(f"::group::{title}", flush=True)
+        try:
+            yield
+        finally:
+            print("::endgroup::", flush=True)
+    else:
+        yield
+
+
 def run_apache_rat_checks():
     set_title_and_block("Running Apache RAT checks", "BLOCK_RAT")
     run_cmd([os.path.join(SPARK_HOME, "dev", "check-license")])
@@ -166,6 +179,7 @@ def exec_sbt(sbt_args=()):
     for line in iter(sbt_proc.stdout.readline, b""):
         if not sbt_output_filter.match(line):
             print(line.decode("utf-8"), end="")
+    print()  # print a new line because the code above does not guarantee a 
new line
     retcode = sbt_proc.wait()
 
     if retcode != 0:
@@ -255,7 +269,8 @@ def build_spark_sbt(extra_profiles):
 
     print("[info] Building Spark using SBT with these arguments: ", " 
".join(profiles_and_goals))
 
-    exec_sbt(profiles_and_goals)
+    with group_in_github_actions("sbt build spark"):
+        exec_sbt(profiles_and_goals)
 
 
 def build_spark_unidoc_sbt(extra_profiles):
@@ -282,7 +297,9 @@ def build_spark_assembly_sbt(extra_profiles, 
checkstyle=False):
         "[info] Building Spark assembly using SBT with these arguments: ",
         " ".join(profiles_and_goals),
     )
-    exec_sbt(profiles_and_goals)
+
+    with group_in_github_actions("sbt build spark assembly"):
+        exec_sbt(profiles_and_goals)
 
     if checkstyle:
         run_java_style_checks(build_profiles)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to