mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
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.
This commit is contained in:
parent
3b55d2385a
commit
d3cdf27184
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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"
|
||||
|
@ -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::"
|
||||
|
@ -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!"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user