Skip to content

Commit

Permalink
Rollup merge of rust-lang#113514 - jyn514:more-gha-groups, r=oli-obk
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
matthiaskrgr authored Jul 10, 2023
2 parents abecbe0 + 7064af0 commit a3029e2
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _download(path, url, probably_big, verbose, exception):
print("downloading {}".format(url), file=sys.stderr)

try:
if probably_big or verbose:
if (probably_big or verbose) and "GITHUB_ACTIONS" not in os.environ:
option = "-#"
else:
option = "-s"
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl Step for Std {
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
add_to_sysroot(&builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target));
}
drop(_guard);

// don't run on std twice with x.py clippy
// don't check test dependencies if we haven't built libtest
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ def quit_if_file_exists(file):
# If 'config.toml' already exists, exit the script at this point
quit_if_file_exists('config.toml')

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

p("")
p("run `python {}/x.py --help`".format(rust_dir))
if "GITHUB_ACTIONS" in os.environ:
print("::endgroup::")
4 changes: 3 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,9 @@ impl Step for Src {

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

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

Expand Down
17 changes: 13 additions & 4 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl Step for TheBook {
let shared_assets = builder.ensure(SharedAssets { target });

// build the redirect pages
builder.msg_doc(compiler, "book redirect pages", target);
let _guard = builder.msg_doc(compiler, "book redirect pages", target);
for file in t!(fs::read_dir(builder.src.join(&relative_path).join("redirects"))) {
let file = t!(file);
let path = file.path();
Expand Down Expand Up @@ -306,7 +306,7 @@ impl Step for Standalone {
fn run(self, builder: &Builder<'_>) {
let target = self.target;
let compiler = self.compiler;
builder.msg_doc(compiler, "standalone", target);
let _guard = builder.msg_doc(compiler, "standalone", target);
let out = builder.doc_out(target);
t!(fs::create_dir_all(&out));

Expand Down Expand Up @@ -812,8 +812,6 @@ macro_rules! tool_doc {
SourceType::Submodule
};

builder.msg_doc(compiler, stringify!($tool).to_lowercase(), target);

// Symlink compiler docs to the output directory of rustdoc documentation.
let out_dirs = [
builder.stage_out(compiler, Mode::ToolRustc).join(target.triple).join("doc"),
Expand Down Expand Up @@ -852,6 +850,8 @@ macro_rules! tool_doc {
cargo.rustdocflag("--show-type-layout");
cargo.rustdocflag("--generate-link-to-definition");
cargo.rustdocflag("-Zunstable-options");

let _guard = builder.msg_doc(compiler, stringify!($tool).to_lowercase(), target);
builder.run(&mut cargo.into());
}
}
Expand Down Expand Up @@ -1073,7 +1073,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,
Expand Down
9 changes: 7 additions & 2 deletions src/bootstrap/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
process::{Command, Stdio},
};

use build_helper::util::try_run;
use build_helper::{ci::CiEnv, util::try_run};
use once_cell::sync::OnceCell;
use xz2::bufread::XzDecoder;

Expand Down Expand Up @@ -213,7 +213,6 @@ impl Config {
// Try curl. If that fails and we are on windows, fallback to PowerShell.
let mut curl = Command::new("curl");
curl.args(&[
"-#",
"-y",
"30",
"-Y",
Expand All @@ -224,6 +223,12 @@ impl Config {
"3",
"-SRf",
]);
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.
if CiEnv::is_ci() {
curl.arg("-s");
} else {
curl.arg("--progress-bar");
}
curl.arg(url);
let f = File::create(tempfile).unwrap();
curl.stdout(Stdio::from(f));
Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ impl Build {
}
}

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

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

#[must_use = "Groups should not be dropped until the Step finishes running"]
fn msg_build(
&self,
compiler: Compiler,
Expand All @@ -1033,6 +1036,7 @@ impl Build {
/// Return a `Group` guard for a [`Step`] that is built for each `--stage`.
///
/// [`Step`]: crate::builder::Step
#[must_use = "Groups should not be dropped until the Step finishes running"]
fn msg(
&self,
action: impl Into<Kind>,
Expand All @@ -1059,6 +1063,7 @@ impl Build {
/// Return a `Group` guard for a [`Step`] that is only built once and isn't affected by `--stage`.
///
/// [`Step`]: crate::builder::Step
#[must_use = "Groups should not be dropped until the Step finishes running"]
fn msg_unstaged(
&self,
action: impl Into<Kind>,
Expand All @@ -1070,6 +1075,7 @@ impl Build {
self.group(&msg)
}

#[must_use = "Groups should not be dropped until the Step finishes running"]
fn msg_sysroot_tool(
&self,
action: impl Into<Kind>,
Expand Down
Loading

0 comments on commit a3029e2

Please sign in to comment.