Skip to content

Commit

Permalink
fix: bad release.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-monninger committed Jan 25, 2024
1 parent 1df181e commit 5570c1a
Show file tree
Hide file tree
Showing 25 changed files with 465 additions and 31 deletions.
46 changes: 30 additions & 16 deletions movement-sdk/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 movement-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ tar = "0.4.35"
zip = "0.6"
zip-extensions = "0.6"
flate2 = "1.0.19"
which = "6.0"

base64 = "0.13.0"
bcs = { git = "https://github.com/aptos-labs/bcs.git", rev = "d31fab9d81748e2594be5cd5cdf845786a30562d" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use util::{
checker::Checker,
artifact::Artifact,
util::util::patterns::constructor::ConstructorOperations
};
Expand Down Expand Up @@ -45,7 +46,10 @@ impl ConstructorOperations for Constructor {
#[cfg(target_os = "windows")]
let avalanche = Artifact::unsupported("avalanche".to_string());

avalanche
avalanche.with_checker(
Checker::command_exists("avalanche".to_string())
)

}

fn default_with_version(_ : &util::util::util::Version) -> Self::Artifact {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use util::{
checker::Checker,
artifact::Artifact,
util::util::patterns::constructor::ConstructorOperations
};
Expand Down Expand Up @@ -41,6 +42,8 @@ impl ConstructorOperations for Constructor {
vec![
git::Constructor::default().into(),
].into_iter().collect()
).with_checker(
Checker::command_exists("avalanchego".to_string())
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use util::{
checker::Checker,
artifact::Artifact,
util::util::patterns::constructor::ConstructorOperations
};
Expand All @@ -22,6 +23,8 @@ impl ConstructorOperations for Constructor {
source "$HOME/.cargo/env"
cargo --version
"#.to_string(),
).with_checker(
Checker::command_exists("cargo".to_string())
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use util::{
checker::Checker,
artifact::Artifact,
util::util::patterns::constructor::ConstructorOperations
};
Expand Down Expand Up @@ -35,10 +36,12 @@ impl ConstructorOperations for Constructor {
].into_iter().collect()
);

#[cfg(target_os = "windows")]
#[cfg(not(target_os = "macos"))]
let avalanche = Artifact::unsupported("brew".to_string());

avalanche
avalanche.with_checker(
Checker::command_exists("brew".to_string())
)
}

fn default_with_version(_ : &util::util::util::Version) -> Self::Artifact {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use util::{
checker::Checker,
artifact::Artifact,
util::util::patterns::constructor::ConstructorOperations
};
Expand All @@ -16,8 +17,9 @@ impl ConstructorOperations for Constructor {

fn default() -> Self::Artifact {

#[cfg(target_os = "macos")]
Artifact::noop("curl".to_string()) // Should already be installed on macOS
Artifact::noop("curl".to_string()).with_checker(
Checker::command_exists("curl".to_string())
) // Should already be installed on macOS

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use util::{
checker::Checker,
artifact::Artifact,
util::util::patterns::constructor::ConstructorOperations
};
Expand Down Expand Up @@ -31,7 +32,9 @@ impl ConstructorOperations for Constructor {

// todo: update for windows

git
git.with_checker(
Checker::command_exists("git".to_string())
)

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod curl;
pub mod brew;
pub mod git;
pub mod git;
pub mod node;
95 changes: 95 additions & 0 deletions movement-sdk/artifacts/src/known_artifacts/third_party/sys/node.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
use util::{
checker::Checker,
artifact::Artifact,
util::util::patterns::constructor::ConstructorOperations,
};

#[derive(Debug, Clone)]
pub struct Config;

#[derive(Debug, Clone)]
pub struct Constructor;

impl ConstructorOperations for Constructor {
type Artifact = Artifact;
type Config = Config;

fn default() -> Self::Artifact {
#[cfg(target_os = "macos")]
let node_artifact = Artifact::self_contained_script(
"node".to_string(),
r#"
brew install node@18
brew link --force --overwrite node@18
# Verify installation
node --version
"#
.to_string(),
);

#[cfg(target_os = "linux")]
let node_artifact = Artifact::self_contained_script(
"node".to_string(),
r#"
sudo apt-get update
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify installation
node --version
"#
.to_string(),
);

// Placeholder for Windows, adjust as necessary for your application
#[cfg(target_os = "windows")]
let node_artifact = Artifact::unsupported("node".to_string());

node_artifact.with_checker(
Checker::command_exists("node".to_string())
)

}


fn default_with_version(_: &util::util::util::Version) -> Self::Artifact {
Self::default()
}

fn from_config(_: &util::util::util::Version, _: &Self::Config) -> Self::Artifact {
Self::default()
}
}

#[cfg(test)]
pub mod test {
use super::*;
use util::movement_dir::MovementDir;

#[tokio::test]
async fn test_node_installation() -> Result<(), anyhow::Error> {
let temp_home = tempfile::tempdir()?;
let dir = temp_home.path().to_path_buf();
let movement_dir = MovementDir::new(&dir);
let artifact = Constructor::default();

test_helpers::clean_path(vec![
"/usr/bin".to_string(), "/bin".to_string(),
"/opt/homebrew/bin".to_string(), "/usr/local/bin".to_string(),
])?;
std::env::set_var("HOME", temp_home.path());

artifact.install(&movement_dir).await?;

let exists = match std::process::Command::new("node").arg("--version").output() {
Ok(output) => output.status.success(),
Err(_) => false,
};

assert!(exists);

Ok(())
}
}
14 changes: 11 additions & 3 deletions movement-sdk/clis/movement/src/ctl/start/m1/m1.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
use clap::Subcommand;
use util::cli::Command;
use super::testnet::Testnet;
use super::{
testnet::Testnet,
mevm::Mevm,
proxy::Proxy
};

#[derive(Subcommand, Debug)]
#[clap(
rename_all = "kebab-case",
about = "Start an M1 service"
)]
pub enum M1 {
Testnet(Testnet)
Testnet(Testnet),
Mevm(Mevm),
Proxy(Proxy)
}

#[async_trait::async_trait]
Expand All @@ -21,7 +27,9 @@ impl Command<String> for M1 {
async fn execute(self) -> Result<String, anyhow::Error> {

match self {
M1::Testnet(testnet) => testnet.execute().await?
M1::Testnet(testnet) => testnet.execute().await?,
M1::Mevm(mevm) => mevm.execute().await?,
M1::Proxy(proxy) => proxy.execute().await?
};

Ok("SUCCESS".to_string())
Expand Down
Loading

0 comments on commit 5570c1a

Please sign in to comment.