diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 6195c3b96b..8e081d5f41 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -33,14 +33,6 @@ jobs: - run: | cargo build --all-features echo "$PWD/target/debug" >> "$GITHUB_PATH" - - name: cache mise - uses: actions/cache@v4 - with: - key: mise-tools-ubuntu-latest-${{ hashFiles('.mise.lock') }} - restore-keys: mise-tools-ubuntu-latest - path: | - ~/.local/share/mise/installs - ~/.local/share/mise/plugins - run: mise install - run: npm install - run: mise run render diff --git a/.github/workflows/release-fig.yml b/.github/workflows/release-fig.yml index b2310e78ca..11e3cff892 100644 --- a/.github/workflows/release-fig.yml +++ b/.github/workflows/release-fig.yml @@ -1,3 +1,4 @@ +name: release-fig on: push: tags: @@ -19,13 +20,6 @@ jobs: - run: mkdir -p "$HOME/bin" && echo "$HOME/bin" >> "$GITHUB_PATH" - run: npm i - run: cargo build --all-features && cp target/debug/mise "$HOME"/bin - - uses: actions/cache/restore@v4 - with: - path: | - ~/.local/share/mise/installs - ~/.local/share/mise/plugins - key: mise-tools-ubuntu-latest-${{ hashFiles('.mise.lock') }} - restore-keys: mise-tools-ubuntu-latest - run: mise install - run: mise run render:fig - name: Create Autocomplete PR ## Create the autocomplete PR using this action diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml index 9d24995da2..9ea998f985 100644 --- a/.github/workflows/release-plz.yml +++ b/.github/workflows/release-plz.yml @@ -40,13 +40,6 @@ jobs: - run: mkdir -p "$HOME/bin" && echo "$HOME/bin" >> "$GITHUB_PATH" - run: npm i - run: cargo build --all-features && cp target/debug/mise "$HOME"/bin - - uses: actions/cache/restore@v4 - with: - path: | - ~/.local/share/mise/installs - ~/.local/share/mise/plugins - key: mise-tools-ubuntu-latest-${{ hashFiles('.mise.lock') }} - restore-keys: mise-tools-ubuntu-latest - run: mise install - run: mise run release-plz env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 989bc1c240..2bc4b1d73f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,7 @@ on: pull_request: branches: ["main"] workflow_dispatch: + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -47,14 +48,6 @@ jobs: cargo build --all-features echo "$PWD/target/debug" >> "$GITHUB_PATH" - run: npm i - - name: cache mise - uses: actions/cache@v4 - with: - key: mise-tools-${{ matrix.os }}-${{ hashFiles('.mise.lock') }} - restore-keys: mise-tools-${{ matrix.os }} - path: | - ~/.local/share/mise/installs - ~/.local/share/mise/plugins - run: mise install - run: mise x -- cargo nextest run --all-features - run: cargo deny check @@ -79,14 +72,6 @@ jobs: - run: | cargo build --all-features echo "$PWD/target/debug" >> "$GITHUB_PATH" - - name: cache mise - uses: actions/cache@v4 - with: - key: mise-tools-ubuntu-latest-${{ hashFiles('.mise.lock') }} - restore-keys: mise-tools-ubuntu-latest - path: | - ~/.local/share/mise/installs - ~/.local/share/mise/plugins - run: mise install - run: mise run test:shuffle @@ -197,3 +182,15 @@ jobs: retry_wait_seconds: 30 max_attempts: 2 command: pwsh e2e-win\run.ps1 + hyperfine: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - run: curl https://mise.run | sh + - run: cargo build --release + - run: echo "$PWD/target/release" >> "$GITHUB_PATH" + - run: mise i + - run: mise x hyperfine -- hyperfine --warmup 10 --min-runs 200 "$HOME/.local/bin/mise env" "target/release/mise env" + - run: mise x hyperfine -- hyperfine --warmup 10 --min-runs 200 "$HOME/.local/bin/mise ls" "target/release/mise ls" diff --git a/.mise.local.toml b/.mise.local.toml deleted file mode 100644 index 4ad283a0eb..0000000000 --- a/.mise.local.toml +++ /dev/null @@ -1,13 +0,0 @@ -#:schema ./schema/mise.json - -tasks.a1 = ["echo a1 1>&2 && sleep 1.5"] -tasks.a2 = "echo a2 && sleep 1.0" -tasks.b1 = { run = "echo b1 && sleep 1.0", depends = ["a1", "a2"], hide = true } -tasks.c1 = { run = "echo c1 && sleep 0.5 && echo", depends = ["b1"], hide = true } -#tasks.filetask = "echo local" - -[env] -FOO=".mise.local.toml" - -[tasks."test:shuffle"] -run = "cargo +nightly test --all-features -- -Z unstable-options --shuffle" diff --git a/.mise.toml b/mise.toml similarity index 97% rename from .mise.toml rename to mise.toml index ef0802bd72..a6ccc9f62c 100644 --- a/.mise.toml +++ b/mise.toml @@ -10,7 +10,6 @@ THIS_PROJECT = "{{config_root}}-{{cwd}}" [tools] #node = 'lts' -python = { version = "latest" } shellcheck = "0.10" shfmt = "3" jq = "latest" @@ -134,3 +133,6 @@ run = "mise tasks run -- docker:cargo run --" [tasks."docker:e2e"] description = "run e2e tests inside of development docker container" run = "mise tasks run docker:mise run test:e2e" + +[tasks."test:shuffle"] +run = "cargo +nightly test --all-features -- -Z unstable-options --shuffle" diff --git a/src/backend/cargo.rs b/src/backend/cargo.rs index bb69e31d8e..83566f2467 100644 --- a/src/backend/cargo.rs +++ b/src/backend/cargo.rs @@ -10,12 +10,12 @@ use crate::backend::Backend; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; -use crate::config::{Config, Settings, SETTINGS}; +use crate::config::{Config, SETTINGS}; use crate::env::GITHUB_TOKEN; use crate::file; use crate::http::HTTP_FETCH; use crate::install_context::InstallContext; -use crate::toolset::{ToolRequest, ToolVersion}; +use crate::toolset::ToolRequest; #[derive(Debug)] pub struct CargoBackend { @@ -82,7 +82,7 @@ impl Backend for CargoBackend { ))?; } cmd - } else if self.is_binstall_enabled(&ctx.tv) { + } else if self.is_binstall_enabled(ctx) { let mut cmd = CmdLineRunner::new("cargo-binstall").arg("-y"); if let Some(token) = &*GITHUB_TOKEN { cmd = cmd.env("GITHUB_TOKEN", token) @@ -127,12 +127,18 @@ impl CargoBackend { } } - fn is_binstall_enabled(&self, tv: &ToolVersion) -> bool { - let settings = Settings::get(); - if !settings.cargo.binstall || file::which_non_pristine("cargo-binstall").is_none() { + fn is_binstall_enabled(&self, ctx: &InstallContext) -> bool { + if !SETTINGS.cargo.binstall { return false; } - let opts = tv.request.options(); + if file::which_non_pristine("cargo-binstall").is_none() + && !self + .dependency_toolset() + .is_ok_and(|ts| ts.which("cargo-binstall").is_some()) + { + return false; + } + let opts = ctx.tv.request.options(); if opts.contains_key("features") || opts.contains_key("default-features") { info!("not using cargo-binstall because features are specified"); return false; diff --git a/src/eager.rs b/src/eager.rs index e997bc8927..1e2e03bfca 100644 --- a/src/eager.rs +++ b/src/eager.rs @@ -1,5 +1,7 @@ +use crate::backend; use crate::cli::version::VERSION; use crate::plugins::VERSION_REGEX; +use crate::toolset::install_state; use once_cell::sync::Lazy; use std::path::PathBuf; use std::sync::Mutex; @@ -13,9 +15,9 @@ pub fn early_init() { rayon::spawn(|| { let _ = &*VERSION; }); - // rayon::spawn(|| { - // let _ = install_state::list_backends(); - // }); + rayon::spawn(|| { + let _ = install_state::init(); + }); } pub static CONFIG_FILES: Lazy>> = Lazy::new(|| Mutex::new(Vec::new())); @@ -23,7 +25,7 @@ pub static CONFIG_FILES: Lazy>> = Lazy::new(|| Mutex::new(Vec /// run after SETTING has been loaded pub fn post_settings() { time!("post_settings"); - // rayon::spawn(|| { - // let _ = load_tools(); - // }); + rayon::spawn(|| { + backend::load_tools(); + }); } diff --git a/src/toolset/install_state.rs b/src/toolset/install_state.rs index 3eb4c7e223..825185b2c8 100644 --- a/src/toolset/install_state.rs +++ b/src/toolset/install_state.rs @@ -25,6 +25,12 @@ pub struct InstallStateTool { static INSTALL_STATE_PLUGINS: Mutex> = Mutex::new(None); static INSTALL_STATE_TOOLS: Mutex> = Mutex::new(None); +pub fn init() -> Result<()> { + drop(init_plugins()?); + drop(init_tools()?); + Ok(()) +} + fn init_plugins() -> Result>>> { let mut mu = INSTALL_STATE_PLUGINS.lock().unwrap(); if mu.is_some() { diff --git a/tasks.md b/tasks.md index 1ba43fe48d..002413f8c3 100644 --- a/tasks.md +++ b/tasks.md @@ -1,28 +1,8 @@ -## `a1` - -- **Usage**: `a1` - -## `a2` - -- **Usage**: `a2` - -## `b1` - -- Depends: a1, a2 - -- **Usage**: `b1` - ## `build` - **Usage**: `build` - **Aliases**: `b` -## `c1` - -- Depends: b1 - -- **Usage**: `c1` - ## `ci` - Depends: format, build, test