diff --git a/dev/run-tests.py b/dev/run-tests.py index 065a27c0e853b..8e29f89c3a0d0 100755 --- a/dev/run-tests.py +++ b/dev/run-tests.py @@ -653,6 +653,9 @@ def main(): # If we're running the tests in Github Actions, attempt to detect and test # only the affected modules. if test_env == "github_actions": + # Set the log level of sbt as ERROR to make the output more readable. + if build_tool == "sbt": + extra_profiles.append("--error") if os.environ["GITHUB_BASE_REF"] != "": # Pull requests changed_files = identify_changed_files_from_git_commits( diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala index d19b514d662fa..198405a1d29ca 100644 --- a/project/SparkBuild.scala +++ b/project/SparkBuild.scala @@ -1027,6 +1027,13 @@ object TestSettings { }.getOrElse(Nil): _*), // Show full stack trace and duration in test cases. testOptions in Test += Tests.Argument("-oDF"), + // Show only the failed test cases with full stack traces in github action to make the log more + // readable. + // Check https://www.scalatest.org/user_guide/using_the_runner for the details of options . + testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, + sys.env.get("GITHUB_ACTIONS").map { _ => + Seq("-eNCXEHLOPQMDF") + }.getOrElse(Nil): _*), testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-v", "-a"), // Required to detect Junit tests for each project, see also https://github.com/sbt/junit-interface/issues/35 crossPaths := false,