Skip to content

Commit 4d6e426

Browse files
committed
Auto merge of #113514 - jyn514:more-gha-groups, r=oli-obk
Add even more GHA log groups This also adds a dynamic check that we don't emit nested groups, since GHA currently doesn't support them. r? `@oli-obk`
2 parents ad96323 + 3a0caed commit 4d6e426

File tree

13 files changed

+184
-65
lines changed

13 files changed

+184
-65
lines changed

src/bootstrap/bootstrap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _download(path, url, probably_big, verbose, exception):
9797
print("downloading {}".format(url), file=sys.stderr)
9898

9999
try:
100-
if probably_big or verbose:
100+
if (probably_big or verbose) and "GITHUB_ACTIONS" not in os.environ:
101101
option = "-#"
102102
else:
103103
option = "-s"

src/bootstrap/check.rs

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ impl Step for Std {
135135
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
136136
add_to_sysroot(&builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target));
137137
}
138+
drop(_guard);
138139

139140
// don't run on std twice with x.py clippy
140141
// don't check test dependencies if we haven't built libtest

src/bootstrap/configure.py

+4
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@ def quit_if_file_exists(file):
550550
# If 'config.toml' already exists, exit the script at this point
551551
quit_if_file_exists('config.toml')
552552

553+
if "GITHUB_ACTIONS" in os.environ:
554+
print("::group::Configure the build")
553555
p("processing command line")
554556
# Parse all known arguments into a configuration structure that reflects the
555557
# TOML we're going to write out
@@ -572,3 +574,5 @@ def quit_if_file_exists(file):
572574

573575
p("")
574576
p("run `python {}/x.py --help`".format(rust_dir))
577+
if "GITHUB_ACTIONS" in os.environ:
578+
print("::endgroup::")

src/bootstrap/dist.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,9 @@ impl Step for Src {
902902

903903
/// Creates the `rust-src` installer component
904904
fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
905-
builder.update_submodule(&Path::new("src/llvm-project"));
905+
if !builder.config.dry_run() {
906+
builder.update_submodule(&Path::new("src/llvm-project"));
907+
}
906908

907909
let tarball = Tarball::new_targetless(builder, "rust-src");
908910

src/bootstrap/doc.rs

+20-8
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,11 @@ impl Step for TheBook {
220220
// build the version info page and CSS
221221
let shared_assets = builder.ensure(SharedAssets { target });
222222

223+
// build the command first so we don't nest GHA groups
224+
builder.rustdoc_cmd(compiler);
225+
223226
// build the redirect pages
224-
builder.msg_doc(compiler, "book redirect pages", target);
227+
let _guard = builder.msg_doc(compiler, "book redirect pages", target);
225228
for file in t!(fs::read_dir(builder.src.join(&relative_path).join("redirects"))) {
226229
let file = t!(file);
227230
let path = file.path();
@@ -305,7 +308,7 @@ impl Step for Standalone {
305308
fn run(self, builder: &Builder<'_>) {
306309
let target = self.target;
307310
let compiler = self.compiler;
308-
builder.msg_doc(compiler, "standalone", target);
311+
let _guard = builder.msg_doc(compiler, "standalone", target);
309312
let out = builder.doc_out(target);
310313
t!(fs::create_dir_all(&out));
311314

@@ -563,10 +566,6 @@ fn doc_std(
563566

564567
let compiler = builder.compiler(stage, builder.config.build);
565568

566-
let description =
567-
format!("library{} in {} format", crate_description(&requested_crates), format.as_str());
568-
let _guard = builder.msg_doc(compiler, &description, target);
569-
570569
let target_doc_dir_name = if format == DocumentationFormat::JSON { "json-doc" } else { "doc" };
571570
let target_dir =
572571
builder.stage_out(compiler, Mode::Std).join(target.triple).join(target_doc_dir_name);
@@ -603,6 +602,10 @@ fn doc_std(
603602
cargo.arg("-p").arg(krate);
604603
}
605604

605+
let description =
606+
format!("library{} in {} format", crate_description(&requested_crates), format.as_str());
607+
let _guard = builder.msg_doc(compiler, &description, target);
608+
606609
builder.run(&mut cargo.into());
607610
builder.cp_r(&out_dir, &out);
608611
}
@@ -799,8 +802,6 @@ macro_rules! tool_doc {
799802
SourceType::Submodule
800803
};
801804

802-
builder.msg_doc(compiler, stringify!($tool).to_lowercase(), target);
803-
804805
// Symlink compiler docs to the output directory of rustdoc documentation.
805806
let out_dirs = [
806807
builder.stage_out(compiler, Mode::ToolRustc).join(target.triple).join("doc"),
@@ -839,6 +840,8 @@ macro_rules! tool_doc {
839840
cargo.rustdocflag("--show-type-layout");
840841
cargo.rustdocflag("--generate-link-to-definition");
841842
cargo.rustdocflag("-Zunstable-options");
843+
844+
let _guard = builder.msg_doc(compiler, stringify!($tool).to_lowercase(), target);
842845
builder.run(&mut cargo.into());
843846
}
844847
}
@@ -1060,7 +1063,16 @@ impl Step for RustcBook {
10601063
// config.toml), then this needs to explicitly update the dylib search
10611064
// path.
10621065
builder.add_rustc_lib_path(self.compiler, &mut cmd);
1066+
let doc_generator_guard = builder.msg(
1067+
Kind::Run,
1068+
self.compiler.stage,
1069+
"lint-docs",
1070+
self.compiler.host,
1071+
self.target,
1072+
);
10631073
builder.run(&mut cmd);
1074+
drop(doc_generator_guard);
1075+
10641076
// Run rustbook/mdbook to generate the HTML pages.
10651077
builder.ensure(RustbookSrc {
10661078
target: self.target,

src/bootstrap/download.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77
process::{Command, Stdio},
88
};
99

10-
use build_helper::util::try_run;
10+
use build_helper::{ci::CiEnv, util::try_run};
1111
use once_cell::sync::OnceCell;
1212
use xz2::bufread::XzDecoder;
1313

@@ -213,7 +213,6 @@ impl Config {
213213
// Try curl. If that fails and we are on windows, fallback to PowerShell.
214214
let mut curl = Command::new("curl");
215215
curl.args(&[
216-
"-#",
217216
"-y",
218217
"30",
219218
"-Y",
@@ -224,6 +223,12 @@ impl Config {
224223
"3",
225224
"-SRf",
226225
]);
226+
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.
227+
if CiEnv::is_ci() {
228+
curl.arg("-s");
229+
} else {
230+
curl.arg("--progress-bar");
231+
}
227232
curl.arg(url);
228233
let f = File::create(tempfile).unwrap();
229234
curl.stdout(Stdio::from(f));

src/bootstrap/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,8 @@ impl Build {
999999
}
10001000
}
10011001

1002+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1003+
#[track_caller]
10021004
fn msg_check(
10031005
&self,
10041006
what: impl Display,
@@ -1007,6 +1009,8 @@ impl Build {
10071009
self.msg(Kind::Check, self.config.stage, what, self.config.build, target)
10081010
}
10091011

1012+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1013+
#[track_caller]
10101014
fn msg_doc(
10111015
&self,
10121016
compiler: Compiler,
@@ -1016,6 +1020,8 @@ impl Build {
10161020
self.msg(Kind::Doc, compiler.stage, what, compiler.host, target.into())
10171021
}
10181022

1023+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1024+
#[track_caller]
10191025
fn msg_build(
10201026
&self,
10211027
compiler: Compiler,
@@ -1028,6 +1034,8 @@ impl Build {
10281034
/// Return a `Group` guard for a [`Step`] that is built for each `--stage`.
10291035
///
10301036
/// [`Step`]: crate::builder::Step
1037+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1038+
#[track_caller]
10311039
fn msg(
10321040
&self,
10331041
action: impl Into<Kind>,
@@ -1054,6 +1062,8 @@ impl Build {
10541062
/// Return a `Group` guard for a [`Step`] that is only built once and isn't affected by `--stage`.
10551063
///
10561064
/// [`Step`]: crate::builder::Step
1065+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1066+
#[track_caller]
10571067
fn msg_unstaged(
10581068
&self,
10591069
action: impl Into<Kind>,
@@ -1065,6 +1075,8 @@ impl Build {
10651075
self.group(&msg)
10661076
}
10671077

1078+
#[must_use = "Groups should not be dropped until the Step finishes running"]
1079+
#[track_caller]
10681080
fn msg_sysroot_tool(
10691081
&self,
10701082
action: impl Into<Kind>,
@@ -1083,6 +1095,7 @@ impl Build {
10831095
self.group(&msg)
10841096
}
10851097

1098+
#[track_caller]
10861099
fn group(&self, msg: &str) -> Option<gha::Group> {
10871100
match self.config.dry_run {
10881101
DryRun::SelfCheck => None,

0 commit comments

Comments
 (0)