Skip to content

Commit

Permalink
fix: automatically trust config files in CI (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Mar 17, 2024
1 parent 6c7e779 commit 80b340d
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 32 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
concurrency:
group: release-plz

env:
MISE_EXPERIMENTAL: 1

jobs:
release-plz:
runs-on: ubuntu-latest
Expand All @@ -26,12 +29,7 @@ jobs:
shared-key: unit
save-if: false
- run: mkdir -p "$HOME/bin" && echo "$HOME/bin" >> "$GITHUB_PATH"
- run: |
set -euxo pipefail
cargo build --all-features
cp target/debug/mise "$HOME"/bin
mise trust --all
mise settings set experimental true
- run: cargo build --all-features && cp target/debug/mise "$HOME"/bin
- uses: actions/cache/restore@v4
with:
path: |
Expand Down
93 changes: 72 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ lto = true
base64 = "0.22.0"
calm_io = "0.1.1"
chrono = { version = "0.4.35", default-features = false, features = ["std", "clock"] }
ci_info = "0.14.14"
clap = { version = "4.5.3", features = ["env", "derive", "string"] }
clap_mangen = { version = "0.2.20", optional = true }
color-eyre = "0.6.3"
Expand Down
2 changes: 1 addition & 1 deletion src/cli/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn show_version() -> std::io::Result<()> {
}

fn show_latest() {
if *env::CI {
if ci_info::is_ci() && !cfg!(test) {
return;
}
if let Some(latest) = check_for_new_version(duration::DAILY) {
Expand Down
7 changes: 4 additions & 3 deletions src/config/config_file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ pub fn is_trusted(path: &Path) -> bool {
return true;
}
}
if !trust_path(path).exists() {
return false;
}
if settings.paranoid {
let trusted = trust_file_hash(path).unwrap_or_else(|e| {
warn!("trust_file_hash: {e}");
Expand All @@ -233,6 +230,10 @@ pub fn is_trusted(path: &Path) -> bool {
if !trusted {
return false;
}
} else if !(trust_path(path).exists() || ci_info::is_ci() && !cfg!(test)) {
// the file isn't trusted, and we're not on a CI system where we generally assume we can
// trust config files
return false;
}
cached.insert(path.to_path_buf());
true
Expand Down
1 change: 0 additions & 1 deletion src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ pub static __MISE_WATCH: Lazy<Option<HookEnvWatches>> = Lazy::new(|| match var("
.ok(),
_ => None,
});
pub static CI: Lazy<bool> = Lazy::new(|| var_is_true("CI"));
pub static LINUX_DISTRO: Lazy<Option<String>> = Lazy::new(linux_distro);
pub static PREFER_STALE: Lazy<bool> = Lazy::new(|| prefer_stale(&ARGS.read().unwrap()));
/// essentially, this is whether we show spinners or build output on runtime install
Expand Down

0 comments on commit 80b340d

Please sign in to comment.