ci(lesavka): reuse process contract server build

This commit is contained in:
Brad Stein 2026-05-18 13:33:10 -03:00
parent 72adce5322
commit 147845d079

View File

@ -12,6 +12,7 @@ use std::io::Read;
use std::net::TcpListener;
use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::sync::OnceLock;
use std::time::{Duration, Instant};
fn cargo_binary(name: &str) -> Option<PathBuf> {
@ -45,6 +46,9 @@ fn build_current_binary(name: &str) -> Option<PathBuf> {
if name != "lesavka-server" {
return None;
}
static SERVER_BINARY: OnceLock<Option<PathBuf>> = OnceLock::new();
SERVER_BINARY
.get_or_init(|| {
let cargo = option_env!("CARGO").unwrap_or("cargo");
let target_dir = workspace_root().join("target/process-contract-debug");
let _ = fs::remove_dir_all(&target_dir);
@ -70,6 +74,8 @@ fn build_current_binary(name: &str) -> Option<PathBuf> {
.success()
.then(|| target_dir.join("debug").join(name))
.filter(|path| path.exists() && path.is_file())
})
.clone()
}
fn find_binary(name: &str) -> Option<PathBuf> {