Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ impl Config {

// CI should always run stage 2 builds, unless it specifically states otherwise
#[cfg(not(test))]
if flags.stage.is_none() && crate::CiEnv::current() != crate::CiEnv::None {
if flags.stage.is_none() && crate::CiEnv::is_rust_lang_ci() {
match config.cmd {
Subcommand::Test { .. }
| Subcommand::Doc { .. }
Expand Down
15 changes: 15 additions & 0 deletions src/bootstrap/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,21 @@ impl CiEnv {
Self::current() != CiEnv::None
}

pub fn is_rust_lang_ci() -> bool {
if let Ok(rust_lang_ci) = env::var("RUST_LANG_CI") {
match rust_lang_ci.as_str() {
"1" | "true" | "yes" | "on" => true,
"0" | "false" | "no" | "off" => false,
other => {
// Let's make sure typos don't go unnoticed
panic!("Unrecognized option '{}' set in RUST_LANG_CI", other)
}
}
} else {
Self::is_ci()
}
}

/// If in a CI environment, forces the command to run with colors.
pub fn force_coloring_in_ci(self, cmd: &mut Command) {
if self != CiEnv::None {
Expand Down