about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/bootstrap/doc.rs9
-rw-r--r--src/bootstrap/test.rs51
-rwxr-xr-xsrc/ci/docker/run.sh4
-rwxr-xr-xsrc/ci/run.sh8
-rw-r--r--src/tools/build_helper/src/ci.rs13
5 files changed, 67 insertions, 18 deletions
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index 0fd6b46d562..d20bfab4131 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -1060,7 +1060,16 @@ impl Step for RustcBook {
         // config.toml), then this needs to explicitly update the dylib search
         // path.
         builder.add_rustc_lib_path(self.compiler, &mut cmd);
+        let doc_generator_guard = builder.msg(
+            Kind::Run,
+            self.compiler.stage,
+            "lint-docs",
+            self.compiler.host,
+            self.target,
+        );
         builder.run(&mut cmd);
+        drop(doc_generator_guard);
+
         // Run rustbook/mdbook to generate the HTML pages.
         builder.ensure(RustbookSrc {
             target: self.target,
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 284efff348d..7704015fbf8 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -117,12 +117,7 @@ impl Step for CrateBootstrap {
             SourceType::InTree,
             &[],
         );
-        builder.info(&format!(
-            "{} {} stage0 ({})",
-            builder.kind.description(),
-            path,
-            bootstrap_host,
-        ));
+        let _group = builder.msg(Kind::Test, compiler.stage, path, compiler.host, bootstrap_host);
         let crate_name = path.rsplit_once('/').unwrap().1;
         run_cargo_test(cargo, &[], &[], crate_name, compiler, bootstrap_host, builder);
     }
@@ -163,6 +158,15 @@ You can skip linkcheck with --exclude src/tools/linkchecker"
         // Test the linkchecker itself.
         let bootstrap_host = builder.config.build;
         let compiler = builder.compiler(0, bootstrap_host);
+
+        let self_test_group = builder.msg(
+            Kind::Test,
+            compiler.stage,
+            "linkchecker self tests",
+            bootstrap_host,
+            bootstrap_host,
+        );
+
         let cargo = tool::prepare_tool_cargo(
             builder,
             compiler,
@@ -174,6 +178,7 @@ You can skip linkcheck with --exclude src/tools/linkchecker"
             &[],
         );
         run_cargo_test(cargo, &[], &[], "linkchecker", compiler, bootstrap_host, builder);
+        drop(self_test_group);
 
         if builder.doc_tests == DocTests::No {
             return;
@@ -182,12 +187,14 @@ You can skip linkcheck with --exclude src/tools/linkchecker"
         // Build all the default documentation.
         builder.default_doc(&[]);
 
+        // Build the linkchecker before calling `msg`, since GHA doesn't support nested groups.
+        let mut linkchecker = builder.tool_cmd(Tool::Linkchecker);
+
         // Run the linkchecker.
+        let _guard =
+            builder.msg(Kind::Test, compiler.stage, "Linkcheck", bootstrap_host, bootstrap_host);
         let _time = util::timeit(&builder);
-        try_run(
-            builder,
-            builder.tool_cmd(Tool::Linkchecker).arg(builder.out.join(host.triple).join("doc")),
-        );
+        try_run(builder, linkchecker.arg(builder.out.join(host.triple).join("doc")));
     }
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -2669,6 +2676,10 @@ impl Step for Bootstrap {
 
     /// Tests the build system itself.
     fn run(self, builder: &Builder<'_>) {
+        let host = builder.config.build;
+        let compiler = builder.compiler(0, host);
+        let _guard = builder.msg(Kind::Test, 0, "bootstrap", host, host);
+
         let mut check_bootstrap = Command::new(&builder.python());
         check_bootstrap
             .args(["-m", "unittest", "bootstrap_test.py"])
@@ -2679,8 +2690,6 @@ impl Step for Bootstrap {
         // Use `python -m unittest` manually if you want to pass arguments.
         try_run(builder, &mut check_bootstrap);
 
-        let host = builder.config.build;
-        let compiler = builder.compiler(0, host);
         let mut cmd = Command::new(&builder.initial_cargo);
         cmd.arg("test")
             .current_dir(builder.src.join("src/bootstrap"))
@@ -2748,7 +2757,13 @@ impl Step for TierCheck {
             cargo.arg("--verbose");
         }
 
-        builder.info("platform support check");
+        let _guard = builder.msg(
+            Kind::Test,
+            self.compiler.stage,
+            "platform support check",
+            self.compiler.host,
+            self.compiler.host,
+        );
         try_run(builder, &mut cargo.into());
     }
 }
@@ -2796,8 +2811,6 @@ impl Step for RustInstaller {
 
     /// Ensure the version placeholder replacement tool builds
     fn run(self, builder: &Builder<'_>) {
-        builder.info("test rust-installer");
-
         let bootstrap_host = builder.config.build;
         let compiler = builder.compiler(0, bootstrap_host);
         let cargo = tool::prepare_tool_cargo(
@@ -2810,6 +2823,14 @@ impl Step for RustInstaller {
             SourceType::InTree,
             &[],
         );
+
+        let _guard = builder.msg(
+            Kind::Test,
+            compiler.stage,
+            "rust-installer",
+            bootstrap_host,
+            bootstrap_host,
+        );
         run_cargo_test(cargo, &[], &[], "installer", compiler, bootstrap_host, builder);
 
         // We currently don't support running the test.sh script outside linux(?) environments.
diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh
index 4b218d57727..da9d68672c4 100755
--- a/src/ci/docker/run.sh
+++ b/src/ci/docker/run.sh
@@ -79,7 +79,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
       loaded_images=$(/usr/bin/timeout -k 720 600 docker load -i /tmp/rustci_docker_cache \
         | sed 's/.* sha/sha/')
       set -e
-      echo "Downloaded containers:\n$loaded_images"
+      printf "Downloaded containers:\n$loaded_images\n"
     fi
 
     dockerfile="$docker_dir/$image/Dockerfile"
@@ -89,12 +89,14 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
     else
         context="$script_dir"
     fi
+    echo "::group::Building docker image for $image"
     retry docker \
       build \
       --rm \
       -t rust-ci \
       -f "$dockerfile" \
       "$context"
+    echo "::endgroup::"
 
     if [ "$CI" != "" ]; then
       s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
diff --git a/src/ci/run.sh b/src/ci/run.sh
index 48fb40d6a6d..da1960fc057 100755
--- a/src/ci/run.sh
+++ b/src/ci/run.sh
@@ -154,13 +154,13 @@ fi
 # check for clock drifts. An HTTP URL is used instead of HTTPS since on Azure
 # Pipelines it happened that the certificates were marked as expired.
 datecheck() {
-  echo "== clock drift check =="
+  echo "::group::Clock drift check"
   echo -n "  local time: "
   date
   echo -n "  network time: "
   curl -fs --head http://ci-caches.rust-lang.org | grep ^Date: \
       | sed 's/Date: //g' || true
-  echo "== end clock drift check =="
+  echo "::endgroup::"
 }
 datecheck
 trap datecheck EXIT
@@ -177,6 +177,7 @@ retry make prepare
 
 # Display the CPU and memory information. This helps us know why the CI timing
 # is fluctuating.
+echo "::group::Display CPU and Memory information"
 if isMacOS; then
     system_profiler SPHardwareDataType || true
     sysctl hw || true
@@ -186,6 +187,7 @@ else
     cat /proc/meminfo || true
     ncpus=$(grep processor /proc/cpuinfo | wc -l)
 fi
+echo "::endgroup::"
 
 if [ ! -z "$SCRIPT" ]; then
   echo "Executing ${SCRIPT}"
@@ -218,4 +220,6 @@ if [ "$RUN_CHECK_WITH_PARALLEL_QUERIES" != "" ]; then
   CARGO_INCREMENTAL=0 ../x check
 fi
 
+echo "::group::sccache stats"
 sccache --show-stats || true
+echo "::endgroup::"
diff --git a/src/tools/build_helper/src/ci.rs b/src/tools/build_helper/src/ci.rs
index 893195b69c2..08bc861fd21 100644
--- a/src/tools/build_helper/src/ci.rs
+++ b/src/tools/build_helper/src/ci.rs
@@ -36,6 +36,10 @@ impl CiEnv {
 }
 
 pub mod gha {
+    use std::sync::atomic::{AtomicBool, Ordering};
+
+    static GROUP_ACTIVE: AtomicBool = AtomicBool::new(false);
+
     /// All github actions log messages from this call to the Drop of the return value
     /// will be grouped and hidden by default in logs. Note that nesting these does
     /// not really work.
@@ -45,6 +49,11 @@ pub mod gha {
         } else {
             eprintln!("{name}")
         }
+        // https://github.com/actions/toolkit/issues/1001
+        assert!(
+            !GROUP_ACTIVE.swap(true, Ordering::Relaxed),
+            "nested groups are not supported by GHA!"
+        );
         Group(())
     }
 
@@ -57,6 +66,10 @@ pub mod gha {
             if std::env::var_os("GITHUB_ACTIONS").is_some() {
                 eprintln!("::endgroup::");
             }
+            assert!(
+                GROUP_ACTIVE.swap(false, Ordering::Relaxed),
+                "group dropped but no group active!"
+            );
         }
     }
 }