0a6a8ea3b0
## Issue Addressed NA ## Proposed Changes This PR extends #3018 to address my review comments there and add automated integration tests with Geth (and other implementations, in the future). I've also de-duplicated the "unused port" logic by creating an `common/unused_port` crate. ## Additional Info I'm not sure if we want to merge this PR, or update #3018 and merge that. I don't mind, I'm primarily opening this PR to make sure CI works. Co-authored-by: Mark Mackey <mark@sigmaprime.io>
63 lines
1.6 KiB
Rust
63 lines
1.6 KiB
Rust
use std::env;
|
|
use std::fs;
|
|
use std::path::{Path, PathBuf};
|
|
use std::process::Command;
|
|
|
|
const GETH_BRANCH: &str = "merge-kiln";
|
|
const GETH_REPO_URL: &str = "https://github.com/MariusVanDerWijden/go-ethereum";
|
|
|
|
fn main() {
|
|
let manifest_dir: PathBuf = env::var("CARGO_MANIFEST_DIR").unwrap().into();
|
|
let execution_clients_dir = manifest_dir.join("execution_clients");
|
|
|
|
if !execution_clients_dir.exists() {
|
|
fs::create_dir(&execution_clients_dir).unwrap();
|
|
}
|
|
|
|
build_geth(&execution_clients_dir);
|
|
}
|
|
|
|
fn build_geth(execution_clients_dir: &Path) {
|
|
let repo_dir = execution_clients_dir.join("go-ethereum");
|
|
|
|
if !repo_dir.exists() {
|
|
// Clone the repo
|
|
assert!(Command::new("git")
|
|
.arg("clone")
|
|
.arg(GETH_REPO_URL)
|
|
.current_dir(&execution_clients_dir)
|
|
.output()
|
|
.expect("failed to clone geth repo")
|
|
.status
|
|
.success());
|
|
}
|
|
|
|
// Checkout the correct branch
|
|
assert!(Command::new("git")
|
|
.arg("checkout")
|
|
.arg(GETH_BRANCH)
|
|
.current_dir(&repo_dir)
|
|
.output()
|
|
.expect("failed to checkout geth branch")
|
|
.status
|
|
.success());
|
|
|
|
// Update the branch
|
|
assert!(Command::new("git")
|
|
.arg("pull")
|
|
.current_dir(&repo_dir)
|
|
.output()
|
|
.expect("failed to update geth branch")
|
|
.status
|
|
.success());
|
|
|
|
// Build geth
|
|
assert!(Command::new("make")
|
|
.arg("geth")
|
|
.current_dir(&repo_dir)
|
|
.output()
|
|
.expect("failed to make geth")
|
|
.status
|
|
.success());
|
|
}
|