diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index daf8bfed99e..8fbde877775 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -79,7 +79,7 @@ jobs: if: ${{ runner.os == 'Linux' }} with: auto-install: true - proto-version: '0.25.2' # Keep in sync + proto-version: '0.25.3' # Keep in sync - uses: mozilla-actions/sccache-action@v0.0.3 - name: Checking coverage status id: coverage diff --git a/.yarn/versions/e8273a99.yml b/.yarn/versions/e8273a99.yml new file mode 100644 index 00000000000..1f2a5d9c201 --- /dev/null +++ b/.yarn/versions/e8273a99.yml @@ -0,0 +1,9 @@ +releases: + "@moonrepo/cli": patch + "@moonrepo/core-linux-arm64-gnu": patch + "@moonrepo/core-linux-arm64-musl": patch + "@moonrepo/core-linux-x64-gnu": patch + "@moonrepo/core-linux-x64-musl": patch + "@moonrepo/core-macos-arm64": patch + "@moonrepo/core-macos-x64": patch + "@moonrepo/core-windows-x64-msvc": patch diff --git a/Cargo.lock b/Cargo.lock index 146d0d94e3c..002e3f1fcfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1755,9 +1755,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -1770,9 +1770,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -1780,15 +1780,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -1797,9 +1797,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-lite" @@ -1818,9 +1818,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -1829,21 +1829,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -3015,6 +3015,7 @@ dependencies = [ "moon_workspace", "num_cpus", "proto_core", + "proto_installer", "rustc-hash", "serde", "starbase_styles", @@ -4676,6 +4677,21 @@ dependencies = [ "warpgate", ] +[[package]] +name = "proto_installer" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0386a25706c0f2c3a8facf44c5615c7d15b1fa2effb29be6752aa651227e4f19" +dependencies = [ + "futures", + "miette", + "reqwest", + "starbase_archive", + "starbase_styles", + "starbase_utils", + "thiserror", +] + [[package]] name = "proto_pdk_api" version = "0.11.2" diff --git a/crates/core/action-pipeline/Cargo.toml b/crates/core/action-pipeline/Cargo.toml index 9c16ae003a2..0998a99bd20 100644 --- a/crates/core/action-pipeline/Cargo.toml +++ b/crates/core/action-pipeline/Cargo.toml @@ -31,6 +31,7 @@ console = { workspace = true } miette = { workspace = true } num_cpus = "1.16.0" proto_core = { workspace = true } +proto_installer = "0.1.0" rustc-hash = { workspace = true } serde = { workspace = true } starbase_styles = { workspace = true } diff --git a/crates/core/action-pipeline/src/actions/sync_workspace.rs b/crates/core/action-pipeline/src/actions/sync_workspace.rs index e6f2a20258a..6b7d3071adf 100644 --- a/crates/core/action-pipeline/src/actions/sync_workspace.rs +++ b/crates/core/action-pipeline/src/actions/sync_workspace.rs @@ -4,14 +4,13 @@ use moon_action_context::ActionContext; use moon_actions::{sync_codeowners, sync_vcs_hooks}; use moon_common::consts::PROTO_CLI_VERSION; use moon_logger::debug; -use moon_process::Command; use moon_project_graph::ProjectGraph; use moon_terminal::{print_checkpoint, Checkpoint}; use moon_utils::is_test_env; use moon_workspace::Workspace; -use proto_core::{download_from_url_to_file, is_offline, ProtoError}; +use proto_core::{is_offline, ProtoError}; +use proto_installer::{determine_triple, download_release, unpack_release}; use starbase_styles::color; -use starbase_utils::fs; use std::env; use std::sync::Arc; use tokio::sync::RwLock; @@ -95,41 +94,21 @@ async fn install_proto(workspace: &Workspace) -> miette::Result<()> { return Err(ProtoError::InternetConnectionRequired.into()); } - let script_name = if cfg!(windows) { - "proto.ps1" - } else { - "proto.sh" - }; - let script_path = workspace.proto_env.temp_dir.join(script_name); - let script_url = format!("https://moonrepo.dev/install/{script_name}"); - - // Download the install script - debug!("Downloading from {}", script_url); - - download_from_url_to_file( - &script_url, - &script_path, - workspace.proto_env.get_plugin_loader()?.get_client()?, - ) - .await?; + let target_triple = determine_triple()?; - fs::update_perms(&script_path, None)?; + debug!("Downloading proto archive ({})", target_triple); - // Install using the official script - debug!("Executing install script {}", script_path.display()); + let result = download_release( + &target_triple, + PROTO_CLI_VERSION, + &workspace.proto_env.temp_dir, + |_, _| {}, + ) + .await?; - let mut cmd = Command::new(script_path); - let mut cmd = cmd - .arg(PROTO_CLI_VERSION) - .env("PROTO_INSTALL_DIR", &install_dir) - .env("PROTO_DEBUG", "true") - .create_async(); + debug!("Unpacking archive and installing proto"); - if env::var("MOON_DEBUG_PROTO_INSTALL").is_ok() { - cmd.exec_stream_output().await?; - } else { - cmd.exec_capture_output().await?; - } + unpack_release(result, &install_dir, &workspace.proto_env.tools_dir)?; debug!("Successfully installed proto!"); diff --git a/nextgen/common/src/consts.rs b/nextgen/common/src/consts.rs index 1b48734a2c8..55f4ca79982 100644 --- a/nextgen/common/src/consts.rs +++ b/nextgen/common/src/consts.rs @@ -16,4 +16,4 @@ pub const CONFIG_PROJECT_FILENAME: &str = "moon.yml"; pub const CONFIG_TEMPLATE_FILENAME: &str = "template.yml"; -pub const PROTO_CLI_VERSION: &str = "0.25.2"; +pub const PROTO_CLI_VERSION: &str = "0.25.3"; diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 000e92f711c..d6aaf2fcdf4 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -10,6 +10,18 @@ - More accurately monitors signals (ctrl+c) and shutdowns. - Tasks can now be configured with a timeout. +## Unreleased + +#### 🚀 Updates + +- Updated the proto installation step to download, unpack, and install using Rust, instead of + relying on our Bash/PowerShell scripts. This should remove the requirement that openssl, tar, and + other environment tools must exist. + +#### ⚙️ Internal + +- Updated proto to v0.25.3. + ## 1.18.3 #### 🐞 Fixes diff --git a/website/docs/proto/commands/list-remote.mdx b/website/docs/proto/commands/list-remote.mdx index 1280141fd8b..985545af6d0 100644 --- a/website/docs/proto/commands/list-remote.mdx +++ b/website/docs/proto/commands/list-remote.mdx @@ -31,3 +31,7 @@ $ proto list-remote node ### Arguments - `` - Type of tool. + +### Options + +- `--aliases` - Include aliases in the list. diff --git a/website/docs/proto/commands/list.mdx b/website/docs/proto/commands/list.mdx index 9eefa2f251f..61488a4321e 100644 --- a/website/docs/proto/commands/list.mdx +++ b/website/docs/proto/commands/list.mdx @@ -15,3 +15,7 @@ $ proto list node ### Arguments - `` - Type of tool. + +### Options + +- `--aliases` - Include aliases in the list. diff --git a/website/docs/proto/commands/outdated.mdx b/website/docs/proto/commands/outdated.mdx index cda1018ca1c..ea3b15e933e 100644 --- a/website/docs/proto/commands/outdated.mdx +++ b/website/docs/proto/commands/outdated.mdx @@ -22,6 +22,9 @@ node - current version 20.7.0 (via 20.7.0), latest version 20.8.0, update availa ### Options - `--json` - Print the list in JSON format. +- `--include-global` - Include versions from the global `~/.proto/.prototools` file. - `--latest` - Check for the latest available version, ignoring any version requirements, ranges, or constraints. +- `--only-local` - Only check versions from the local `.prototools` file, instead of aggregating + parents. - `--update` - Update the local `.prototools` file with newer versions if available.