runners.rs

 1pub const LINUX_CHEAP: Runner = Runner("namespace-profile-2x4-ubuntu-2404");
 2pub const LINUX_DEFAULT: Runner = Runner("namespace-profile-16x32-ubuntu-2204");
 3
 4// Using Ubuntu 20.04 for minimal glibc version
 5pub const LINUX_X86_BUNDLER: Runner = Runner("namespace-profile-32x64-ubuntu-2004");
 6pub const LINUX_ARM_BUNDLER: Runner = Runner("namespace-profile-8x32-ubuntu-2004-arm-m4");
 7
 8pub const MAC_DEFAULT: Runner = Runner("self-mini-macos");
 9pub const WINDOWS_DEFAULT: Runner = Runner("self-32vcpu-windows-2022");
10
11pub struct Runner(&'static str);
12
13impl Into<gh_workflow::RunsOn> for Runner {
14    fn into(self) -> gh_workflow::RunsOn {
15        self.0.into()
16    }
17}
18
19#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
20pub enum Arch {
21    X86_64,
22    AARCH64,
23}
24
25impl std::fmt::Display for Arch {
26    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27        match self {
28            Arch::X86_64 => write!(f, "x86_64"),
29            Arch::AARCH64 => write!(f, "aarch64"),
30        }
31    }
32}
33
34impl Arch {
35    pub fn triple(&self) -> &'static str {
36        match self {
37            Arch::X86_64 => "x86_64-unknown-linux-gnu",
38            Arch::AARCH64 => "aarch64-unknown-linux-gnu",
39        }
40    }
41
42    pub fn linux_bundler(&self) -> Runner {
43        match self {
44            Arch::X86_64 => LINUX_X86_BUNDLER,
45            Arch::AARCH64 => LINUX_ARM_BUNDLER,
46        }
47    }
48}