Use GHA log grouping
This commit is contained in:
parent
8b9187dfec
commit
34d63e4c1d
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
use super::path::{Dirs, RelPath};
|
use super::path::{Dirs, RelPath};
|
||||||
use super::rustc_info::get_file_name;
|
use super::rustc_info::get_file_name;
|
||||||
use super::utils::{is_ci, is_ci_opt, maybe_incremental, CargoProject, Compiler};
|
use super::utils::{is_ci, is_ci_opt, maybe_incremental, CargoProject, Compiler, LogGroup};
|
||||||
|
|
||||||
pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
|
pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
|
||||||
|
|
||||||
@ -13,6 +13,8 @@ pub(crate) fn build_backend(
|
|||||||
bootstrap_host_compiler: &Compiler,
|
bootstrap_host_compiler: &Compiler,
|
||||||
use_unstable_features: bool,
|
use_unstable_features: bool,
|
||||||
) -> PathBuf {
|
) -> PathBuf {
|
||||||
|
let _group = LogGroup::guard("Build backend");
|
||||||
|
|
||||||
let mut cmd = CG_CLIF.build(&bootstrap_host_compiler, dirs);
|
let mut cmd = CG_CLIF.build(&bootstrap_host_compiler, dirs);
|
||||||
maybe_incremental(&mut cmd);
|
maybe_incremental(&mut cmd);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
use super::rustc_info::get_file_name;
|
use super::rustc_info::get_file_name;
|
||||||
use super::utils::{
|
use super::utils::{
|
||||||
maybe_incremental, remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler,
|
maybe_incremental, remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler,
|
||||||
|
LogGroup,
|
||||||
};
|
};
|
||||||
use super::{CodegenBackend, SysrootKind};
|
use super::{CodegenBackend, SysrootKind};
|
||||||
|
|
||||||
@ -22,6 +23,8 @@ pub(crate) fn build_sysroot(
|
|||||||
rustup_toolchain_name: Option<&str>,
|
rustup_toolchain_name: Option<&str>,
|
||||||
target_triple: String,
|
target_triple: String,
|
||||||
) -> Compiler {
|
) -> Compiler {
|
||||||
|
let _guard = LogGroup::guard("Build sysroot");
|
||||||
|
|
||||||
eprintln!("[BUILD] sysroot {:?}", sysroot_kind);
|
eprintln!("[BUILD] sysroot {:?}", sysroot_kind);
|
||||||
|
|
||||||
DIST_DIR.ensure_fresh(dirs);
|
DIST_DIR.ensure_fresh(dirs);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use super::path::{Dirs, RelPath};
|
use super::path::{Dirs, RelPath};
|
||||||
use super::prepare::{apply_patches, GitRepo};
|
use super::prepare::{apply_patches, GitRepo};
|
||||||
use super::rustc_info::get_default_sysroot;
|
use super::rustc_info::get_default_sysroot;
|
||||||
use super::utils::{spawn_and_wait, spawn_and_wait_with_input, CargoProject, Compiler};
|
use super::utils::{spawn_and_wait, spawn_and_wait_with_input, CargoProject, Compiler, LogGroup};
|
||||||
use super::{CodegenBackend, SysrootKind};
|
use super::{CodegenBackend, SysrootKind};
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
@ -386,15 +386,17 @@ fn run_testsuite(&self, tests: &[TestCase]) {
|
|||||||
let tag = tag.to_uppercase();
|
let tag = tag.to_uppercase();
|
||||||
let is_jit_test = tag == "JIT";
|
let is_jit_test = tag == "JIT";
|
||||||
|
|
||||||
if !config::get_bool(config)
|
let _guard = if !config::get_bool(config)
|
||||||
|| (is_jit_test && !self.jit_supported)
|
|| (is_jit_test && !self.jit_supported)
|
||||||
|| self.skip_tests.contains(&config)
|
|| self.skip_tests.contains(&config)
|
||||||
{
|
{
|
||||||
eprintln!("[{tag}] {testname} (skipped)");
|
eprintln!("[{tag}] {testname} (skipped)");
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
let guard = LogGroup::guard(&format!("[{tag}] {testname}"));
|
||||||
eprintln!("[{tag}] {testname}");
|
eprintln!("[{tag}] {testname}");
|
||||||
}
|
guard
|
||||||
|
};
|
||||||
|
|
||||||
match *cmd {
|
match *cmd {
|
||||||
TestCaseCmd::Custom { func } => func(self),
|
TestCaseCmd::Custom { func } => func(self),
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{self, Command, Stdio};
|
use std::process::{self, Command, Stdio};
|
||||||
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
use super::path::{Dirs, RelPath};
|
use super::path::{Dirs, RelPath};
|
||||||
|
|
||||||
@ -259,6 +260,33 @@ pub(crate) fn is_ci_opt() -> bool {
|
|||||||
env::var("CI_OPT").is_ok()
|
env::var("CI_OPT").is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static IN_GROUP: AtomicBool = AtomicBool::new(false);
|
||||||
|
pub(crate) struct LogGroup {
|
||||||
|
is_gha: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LogGroup {
|
||||||
|
pub(crate) fn guard(name: &str) -> LogGroup {
|
||||||
|
let is_gha = env::var("GITHUB_ACTIONS").is_ok();
|
||||||
|
|
||||||
|
assert!(!IN_GROUP.swap(true, Ordering::SeqCst));
|
||||||
|
if is_gha {
|
||||||
|
eprintln!("::group::{name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
LogGroup { is_gha }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for LogGroup {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if self.is_gha {
|
||||||
|
eprintln!("::endgroup::");
|
||||||
|
}
|
||||||
|
IN_GROUP.store(false, Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn maybe_incremental(cmd: &mut Command) {
|
pub(crate) fn maybe_incremental(cmd: &mut Command) {
|
||||||
if is_ci() || std::env::var("CARGO_BUILD_INCREMENTAL").map_or(false, |val| val == "false") {
|
if is_ci() || std::env::var("CARGO_BUILD_INCREMENTAL").map_or(false, |val| val == "false") {
|
||||||
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
|
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
|
||||||
|
Loading…
Reference in New Issue
Block a user