diff --git a/Cargo.lock b/Cargo.lock index 38182d4f..1acbbe09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -250,7 +250,7 @@ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "codspeed-runner" -version = "3.2.2" +version = "3.3.0-beta.5" dependencies = [ "anyhow", "async-compression", diff --git a/Cargo.toml b/Cargo.toml index 3c85f326..c4b0c9ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "codspeed-runner" -version = "3.2.2" +version = "3.3.0-beta.5" edition = "2021" repository = "https://github.com/CodSpeedHQ/runner" publish = false diff --git a/src/main.rs b/src/main.rs index 5ffebb02..35753fa3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ mod request_client; mod run; use console::style; +use lazy_static::lazy_static; use local_logger::clean_logger; use prelude::*; @@ -16,7 +17,14 @@ use log::log_enabled; pub const VERSION: &str = env!("CARGO_PKG_VERSION"); pub const MONGODB_TRACER_VERSION: &str = "cs-mongo-tracer-v0.2.0"; -pub const VALGRIND_CODSPEED_VERSION: &str = "3.21.0-0codspeed3"; +pub const VALGRIND_CODSPEED_VERSION: &str = "3.24.0-0codspeed"; +const VALGRIND_CODSPEED_VERSION_DEB_POST_REV: u32 = 1; +lazy_static! { + pub static ref VALGRIND_CODSPEED_DEB_VERSION: String = format!( + "{}{}", + VALGRIND_CODSPEED_VERSION, VALGRIND_CODSPEED_VERSION_DEB_POST_REV + ); +} #[tokio::main(flavor = "current_thread")] async fn main() { diff --git a/src/run/check_system.rs b/src/run/check_system.rs index 4c7dfc29..71f60ec9 100644 --- a/src/run/check_system.rs +++ b/src/run/check_system.rs @@ -98,12 +98,12 @@ impl SystemInfo { lazy_static! { static ref SUPPORTED_SYSTEMS: HashSet<(&'static str, &'static str, &'static str)> = { HashSet::from([ - ("ubuntu", "20.04", "x86_64"), ("ubuntu", "22.04", "x86_64"), ("ubuntu", "24.04", "x86_64"), ("ubuntu", "22.04", "aarch64"), - ("debian", "11", "x86_64"), + ("ubuntu", "24.04", "aarch64"), ("debian", "12", "x86_64"), + ("debian", "12", "aarch64"), ]) }; } diff --git a/src/run/runner/valgrind/setup.rs b/src/run/runner/valgrind/setup.rs index 801459bb..9c26adfa 100644 --- a/src/run/runner/valgrind/setup.rs +++ b/src/run/runner/valgrind/setup.rs @@ -6,8 +6,11 @@ use std::{ use url::Url; use super::helpers::download_file::download_file; -use crate::run::{check_system::SystemInfo, config::Config}; use crate::{prelude::*, MONGODB_TRACER_VERSION, VALGRIND_CODSPEED_VERSION}; +use crate::{ + run::{check_system::SystemInfo, config::Config}, + VALGRIND_CODSPEED_DEB_VERSION, +}; /// Run a command with sudo if available fn run_with_sudo(command_args: &[&str]) -> Result<()> { @@ -44,18 +47,18 @@ fn get_codspeed_valgrind_filename(system_info: &SystemInfo) -> Result { system_info.os_version.as_str(), system_info.arch.as_str(), ) { - ("ubuntu", "20.04", "x86_64") | ("debian", "11", "x86_64") | ("debian", "12", "x86_64") => { - ("20.04", "amd64") - } - ("ubuntu", "22.04", "x86_64") => ("22.04", "amd64"), + ("ubuntu", "22.04", "x86_64") | ("debian", "12", "x86_64") => ("22.04", "amd64"), ("ubuntu", "24.04", "x86_64") => ("24.04", "amd64"), - ("ubuntu", "22.04", "aarch64") => ("22.04", "arm64"), + ("ubuntu", "22.04", "aarch64") | ("debian", "12", "aarch64") => ("22.04", "arm64"), + ("ubuntu", "24.04", "aarch64") => ("24.04", "arm64"), _ => bail!("Unsupported system"), }; Ok(format!( "valgrind_{}_ubuntu-{}_{}.deb", - VALGRIND_CODSPEED_VERSION, version, architecture + VALGRIND_CODSPEED_DEB_VERSION.as_str(), + version, + architecture )) } @@ -74,8 +77,7 @@ fn is_valgrind_installed() -> bool { } let version = String::from_utf8_lossy(&version_output.stdout); - // TODO: use only VALGRIND_CODSPEED_VERSION here, the other value is when valgrind has been built locally - version.contains("valgrind-3.21.0.codspeed") || version.contains(VALGRIND_CODSPEED_VERSION) + version.contains(VALGRIND_CODSPEED_VERSION) } else { false } @@ -89,14 +91,20 @@ async fn install_valgrind(system_info: &SystemInfo) -> Result<()> { debug!("Installing valgrind"); let valgrind_deb_url = format!( "https://github.com/CodSpeedHQ/valgrind-codspeed/releases/download/{}/{}", - VALGRIND_CODSPEED_VERSION, + VALGRIND_CODSPEED_DEB_VERSION.as_str(), get_codspeed_valgrind_filename(system_info)? ); let deb_path = env::temp_dir().join("valgrind-codspeed.deb"); download_file(&Url::parse(valgrind_deb_url.as_str()).unwrap(), &deb_path).await?; run_with_sudo(&["apt-get", "update"])?; - run_with_sudo(&["apt-get", "install", "-y", deb_path.to_str().unwrap()])?; + run_with_sudo(&[ + "apt-get", + "install", + "--allow-downgrades", + "-y", + deb_path.to_str().unwrap(), + ])?; Ok(()) } @@ -155,7 +163,7 @@ mod tests { }; assert_snapshot!( get_codspeed_valgrind_filename(&system_info).unwrap(), - @"valgrind_3.21.0-0codspeed3_ubuntu-22.04_amd64.deb" + @"valgrind_3.24.0-0codspeed1_ubuntu-22.04_amd64.deb" ); } @@ -169,7 +177,7 @@ mod tests { }; assert_snapshot!( get_codspeed_valgrind_filename(&system_info).unwrap(), - @"valgrind_3.21.0-0codspeed3_ubuntu-24.04_amd64.deb" + @"valgrind_3.24.0-0codspeed1_ubuntu-24.04_amd64.deb" ); } @@ -177,13 +185,13 @@ mod tests { fn test_system_info_to_codspeed_valgrind_version_debian() { let system_info = SystemInfo { os: "debian".to_string(), - os_version: "11".to_string(), + os_version: "12".to_string(), arch: "x86_64".to_string(), ..SystemInfo::test() }; assert_snapshot!( get_codspeed_valgrind_filename(&system_info).unwrap(), - @"valgrind_3.21.0-0codspeed3_ubuntu-20.04_amd64.deb" + @"valgrind_3.24.0-0codspeed1_ubuntu-22.04_amd64.deb" ); } @@ -197,7 +205,7 @@ mod tests { }; assert_snapshot!( get_codspeed_valgrind_filename(&system_info).unwrap(), - @"valgrind_3.21.0-0codspeed3_ubuntu-22.04_arm64.deb" + @"valgrind_3.24.0-0codspeed1_ubuntu-22.04_arm64.deb" ); } }