From f42da8416a5450c7c3c924353c3cc9112afd18f0 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 18 Feb 2023 16:57:35 +0100 Subject: [PATCH] feat(ci): with sccache --- ci/src/main.rs | 41 +++++++++++++++++++++++++++++++++++++++++ src/main.rs | 2 ++ 2 files changed, 43 insertions(+) diff --git a/ci/src/main.rs b/ci/src/main.rs index 1363c29..ab443d2 100644 --- a/ci/src/main.rs +++ b/ci/src/main.rs @@ -98,10 +98,51 @@ fn get_dependencies(client: Arc) -> Container { let cache_cargo_index_dir = client.cache_volume("cargo_index".into()); let cache_cargo_deps = client.cache_volume("cargo_deps".into()); + let minio_url = "https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz".into(); + let base_image = client .container(None) .from("rust:latest".into()) .with_workdir("app".into()) + .with_exec(vec!["apt-get".into(), "update".into()], None) + .with_exec( + vec![ + "apt-get".into(), + "install".into(), + "--yes".into(), + "libpq-dev".into(), + "wget".into(), + ], + None, + ) + .with_exec(vec!["wget".into(), minio_url], None) + .with_exec( + vec![ + "tar".into(), + "xzf".into(), + "sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz".into(), + ], + None, + ) + .with_exec( + vec![ + "mv".into(), + "sccache-v0.3.3-x86_64-unknown-linux-musl/sccache".into(), + "/usr/local/bin/sccache".into(), + ], + None, + ) + .with_exec( + vec!["chmod".into(), "+x".into(), "/usr/local/bin/sccache".into()], + None, + ) + .with_env_variable("RUSTC_WRAPPER".into(), "/usr/local/bin/sccache".into()) + .with_env_variable("SCCACHE_BUCKET".into(), "sccache".into()) + .with_env_variable("SCCACHE_REGION".into(), "auto".into()) + .with_env_variable( + "SCCACHE_ENDPOINT".into(), + "https://api-minio.front.kjuulh.io".into(), + ) .with_exec( vec!["cargo".into(), "install".into(), "cargo-chef".into()], None, diff --git a/src/main.rs b/src/main.rs index a9cbd75..2fe74bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,8 @@ pub mod cli; mod cli_generate; fn main() -> eyre::Result<()> { + // + color_eyre::install().unwrap(); let args = std::env::args();