|
| 1 | +// Pinned downloads. Each `PinnedBinary` variant carries the URL and the |
| 2 | +// expected SHA-256 of the file at that URL — bumping a version requires |
| 3 | +// updating both. See CONTRIBUTING.md for the regeneration workflow. |
| 4 | + |
| 5 | +pub const VALGRIND_DEB_VERSION: &str = "3.26.0-0codspeed0"; |
| 6 | +pub const MEMTRACK_VERSION: &str = "1.2.3"; |
| 7 | +pub const EXEC_HARNESS_VERSION: &str = "1.3.0"; |
| 8 | +pub const MONGODB_TRACER_VERSION: &str = "cs-mongo-tracer-v0.2.0"; |
| 9 | + |
| 10 | +/// A binary the runner downloads at install time. The download helper looks |
| 11 | +/// up the URL and SHA-256 via `url()` and `sha256()` and rejects the install |
| 12 | +/// if the bytes don't match. |
| 13 | +#[derive(Debug, Clone, Copy)] |
| 14 | +pub enum PinnedBinary { |
| 15 | + ValgrindDeb { |
| 16 | + distro_version: &'static str, |
| 17 | + arch: &'static str, |
| 18 | + }, |
| 19 | + MemtrackInstaller, |
| 20 | + ExecHarnessInstaller, |
| 21 | + MongoTracerInstaller, |
| 22 | +} |
| 23 | + |
| 24 | +impl PinnedBinary { |
| 25 | + pub fn url(&self) -> String { |
| 26 | + match self { |
| 27 | + PinnedBinary::ValgrindDeb { |
| 28 | + distro_version, |
| 29 | + arch, |
| 30 | + } => format!( |
| 31 | + "https://github.com/CodSpeedHQ/valgrind-codspeed/releases/download/{VALGRIND_DEB_VERSION}/valgrind_{VALGRIND_DEB_VERSION}_ubuntu-{distro_version}_{arch}.deb" |
| 32 | + ), |
| 33 | + PinnedBinary::MemtrackInstaller => format!( |
| 34 | + "https://github.com/CodSpeedHQ/codspeed/releases/download/memtrack-v{MEMTRACK_VERSION}/memtrack-installer.sh" |
| 35 | + ), |
| 36 | + PinnedBinary::ExecHarnessInstaller => format!( |
| 37 | + "https://github.com/CodSpeedHQ/codspeed/releases/download/exec-harness-v{EXEC_HARNESS_VERSION}/exec-harness-installer.sh" |
| 38 | + ), |
| 39 | + PinnedBinary::MongoTracerInstaller => format!( |
| 40 | + "https://codspeed-public-assets.s3.eu-west-1.amazonaws.com/mongo-tracer/{MONGODB_TRACER_VERSION}/cs-mongo-tracer-installer.sh" |
| 41 | + ), |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + pub fn sha256(&self) -> &'static str { |
| 46 | + match self { |
| 47 | + PinnedBinary::ValgrindDeb { |
| 48 | + distro_version, |
| 49 | + arch, |
| 50 | + } => match (*distro_version, *arch) { |
| 51 | + ("22.04", "amd64") => { |
| 52 | + "e0743f01668d664a97d85903057da7557dbf2dbbf0ceeb88e6b67ae9fb2f392f" |
| 53 | + } |
| 54 | + ("24.04", "amd64") => { |
| 55 | + "2f02fd8e9377168310258ea03b356f4fa4beda3557e50da85681a3df889a886a" |
| 56 | + } |
| 57 | + ("22.04", "arm64") => { |
| 58 | + "f24fc0676b8e0fd16de8efb8ab2a1dec0083304469883c03e553fb881dd5df29" |
| 59 | + } |
| 60 | + ("24.04", "arm64") => { |
| 61 | + "32a48910da4b094192ef5c83e6526712fbf03b3d76a12e84423cbf6cc9ecbadf" |
| 62 | + } |
| 63 | + (d, a) => unreachable!("unknown valgrind target {d}/{a}"), |
| 64 | + }, |
| 65 | + PinnedBinary::MemtrackInstaller => { |
| 66 | + "67f30ebe17d5da4246b51d8663394026385d95203ff09e81289772159e969603" |
| 67 | + } |
| 68 | + PinnedBinary::ExecHarnessInstaller => { |
| 69 | + "75cbff4fdaefe98927d24fff43fd600c621eb1263b0c40b0fd32c68fa6d88ebd" |
| 70 | + } |
| 71 | + PinnedBinary::MongoTracerInstaller => { |
| 72 | + "685f1d540cb24c2aa6f447991958339c6b70ec7664df2dba2713b8b3d77687e7" |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | +} |
0 commit comments