just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ci: make sure tests fail in CI if `gpg` or `taplo` binaries are not found

Fixes #5696

+15
+3
cli/tests/test_config_schema.rs
··· 1 1 use std::process::Command; 2 2 use std::process::Stdio; 3 3 4 + use testutils::ensure_running_outside_ci; 5 + 4 6 fn taplo_check_config(file: &str) { 5 7 if Command::new("taplo") 6 8 .arg("--version") ··· 8 10 .status() 9 11 .is_err() 10 12 { 13 + ensure_running_outside_ci("`taplo` must be in the PATH"); 11 14 eprintln!("Skipping test because taplo is not installed on the system"); 12 15 return; 13 16 }
+2
lib/tests/test_gpg.rs
··· 12 12 use jj_lib::signing::SigStatus; 13 13 use jj_lib::signing::SignError; 14 14 use jj_lib::signing::SigningBackend as _; 15 + use testutils::ensure_running_outside_ci; 15 16 16 17 static PRIVATE_KEY: &str = r#"-----BEGIN PGP PRIVATE KEY BLOCK----- 17 18 ··· 81 82 macro_rules! gpg_guard { 82 83 () => { 83 84 if Command::new("gpg").arg("--version").status().is_err() { 85 + ensure_running_outside_ci("`gpg` must be in the PATH"); 84 86 eprintln!("Skipping test because gpg is not installed on the system"); 85 87 return; 86 88 }
+10
lib/testutils/src/lib.rs
··· 135 135 UserSettings::from_config(base_user_config()).unwrap() 136 136 } 137 137 138 + /// Panic if `CI` environment variable is set to a non-empty value 139 + /// 140 + /// Most CI environments set this variable automatically. See e.g. 141 + /// <https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables> 142 + #[track_caller] 143 + pub fn ensure_running_outside_ci(reason: &str) { 144 + let running_in_ci = std::env::var("CI").is_ok_and(|value| !value.is_empty()); 145 + assert!(!running_in_ci, "Running in CI, {reason}."); 146 + } 147 + 138 148 #[derive(Debug)] 139 149 pub struct TestEnvironment { 140 150 temp_dir: TempDir,