Skip to content

Commit 58f26fe

Browse files
authored
Rollup merge of rust-lang#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 685623d + 7064af0 commit 58f26fe

File tree

12 files changed

+168
-62
lines changed

12 files changed

+168
-62
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
@@ -137,6 +137,7 @@ impl Step for Std {
137137
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
138138
add_to_sysroot(&builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target));
139139
}
140+
drop(_guard);
140141

141142
// don't run on std twice with x.py clippy
142143
// 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
@@ -897,7 +897,9 @@ impl Step for Src {
897897

898898
/// Creates the `rust-src` installer component
899899
fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
900-
builder.update_submodule(&Path::new("src/llvm-project"));
900+
if !builder.config.dry_run() {
901+
builder.update_submodule(&Path::new("src/llvm-project"));
902+
}
901903

902904
let tarball = Tarball::new_targetless(builder, "rust-src");
903905

src/bootstrap/doc.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl Step for TheBook {
222222
let shared_assets = builder.ensure(SharedAssets { target });
223223

224224
// build the redirect pages
225-
builder.msg_doc(compiler, "book redirect pages", target);
225+
let _guard = builder.msg_doc(compiler, "book redirect pages", target);
226226
for file in t!(fs::read_dir(builder.src.join(&relative_path).join("redirects"))) {
227227
let file = t!(file);
228228
let path = file.path();
@@ -306,7 +306,7 @@ impl Step for Standalone {
306306
fn run(self, builder: &Builder<'_>) {
307307
let target = self.target;
308308
let compiler = self.compiler;
309-
builder.msg_doc(compiler, "standalone", target);
309+
let _guard = builder.msg_doc(compiler, "standalone", target);
310310
let out = builder.doc_out(target);
311311
t!(fs::create_dir_all(&out));
312312

@@ -812,8 +812,6 @@ macro_rules! tool_doc {
812812
SourceType::Submodule
813813
};
814814

815-
builder.msg_doc(compiler, stringify!($tool).to_lowercase(), target);
816-
817815
// Symlink compiler docs to the output directory of rustdoc documentation.
818816
let out_dirs = [
819817
builder.stage_out(compiler, Mode::ToolRustc).join(target.triple).join("doc"),
@@ -852,6 +850,8 @@ macro_rules! tool_doc {
852850
cargo.rustdocflag("--show-type-layout");
853851
cargo.rustdocflag("--generate-link-to-definition");
854852
cargo.rustdocflag("-Zunstable-options");
853+
854+
let _guard = builder.msg_doc(compiler, stringify!($tool).to_lowercase(), target);
855855
builder.run(&mut cargo.into());
856856
}
857857
}
@@ -1073,7 +1073,16 @@ impl Step for RustcBook {
10731073
// config.toml), then this needs to explicitly update the dylib search
10741074
// path.
10751075
builder.add_rustc_lib_path(self.compiler, &mut cmd);
1076+
let doc_generator_guard = builder.msg(
1077+
Kind::Run,
1078+
self.compiler.stage,
1079+
"lint-docs",
1080+
self.compiler.host,
1081+
self.target,
1082+
);
10761083
builder.run(&mut cmd);
1084+
drop(doc_generator_guard);
1085+
10771086
// Run rustbook/mdbook to generate the HTML pages.
10781087
builder.ensure(RustbookSrc {
10791088
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

+6
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ impl Build {
10041004
}
10051005
}
10061006

1007+
#[must_use = "Groups should not be dropped until the Step finishes running"]
10071008
fn msg_check(
10081009
&self,
10091010
what: impl Display,
@@ -1012,6 +1013,7 @@ impl Build {
10121013
self.msg(Kind::Check, self.config.stage, what, self.config.build, target)
10131014
}
10141015

1016+
#[must_use = "Groups should not be dropped until the Step finishes running"]
10151017
fn msg_doc(
10161018
&self,
10171019
compiler: Compiler,
@@ -1021,6 +1023,7 @@ impl Build {
10211023
self.msg(Kind::Doc, compiler.stage, what, compiler.host, target.into())
10221024
}
10231025

1026+
#[must_use = "Groups should not be dropped until the Step finishes running"]
10241027
fn msg_build(
10251028
&self,
10261029
compiler: Compiler,
@@ -1033,6 +1036,7 @@ impl Build {
10331036
/// Return a `Group` guard for a [`Step`] that is built for each `--stage`.
10341037
///
10351038
/// [`Step`]: crate::builder::Step
1039+
#[must_use = "Groups should not be dropped until the Step finishes running"]
10361040
fn msg(
10371041
&self,
10381042
action: impl Into<Kind>,
@@ -1059,6 +1063,7 @@ impl Build {
10591063
/// Return a `Group` guard for a [`Step`] that is only built once and isn't affected by `--stage`.
10601064
///
10611065
/// [`Step`]: crate::builder::Step
1066+
#[must_use = "Groups should not be dropped until the Step finishes running"]
10621067
fn msg_unstaged(
10631068
&self,
10641069
action: impl Into<Kind>,
@@ -1070,6 +1075,7 @@ impl Build {
10701075
self.group(&msg)
10711076
}
10721077

1078+
#[must_use = "Groups should not be dropped until the Step finishes running"]
10731079
fn msg_sysroot_tool(
10741080
&self,
10751081
action: impl Into<Kind>,

0 commit comments

Comments
 (0)