From 3afa45d865dcfd5fda73f9759c15e51edb4eb69e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 20 Feb 2024 14:10:53 +0100 Subject: [PATCH 1/2] allow the compilation of sccache without any features (only local build) --- .github/workflows/ci.yml | 4 ++++ src/cache/cache.rs | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 588935b6f..41879fa24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,10 @@ jobs: rustc: nightly allow_failure: true extra_args: --features=unstable + - os: ubuntu-20.04 + extra_desc: no-default-features + extra_args: --no-default-features + allow_failure: true - os: ubuntu-22.04 - os: macOS-11 # M1 CPU diff --git a/src/cache/cache.rs b/src/cache/cache.rs index 3c07983a9..f5aa43178 100644 --- a/src/cache/cache.rs +++ b/src/cache/cache.rs @@ -674,7 +674,9 @@ pub fn storage_from_config( return Ok(Arc::new(storage)); } #[allow(unreachable_patterns)] - _ => bail!("cache type is not enabled"), + // if we build only with `cargo build --no-default-features` + // we only want to use sccache with a local cache (no remote storage) + _ => {} } } From 8086fe81fd68c2eec2a77acaf7bdc510709ec79f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 20 Feb 2024 17:13:03 +0100 Subject: [PATCH 2/2] Disable tests when the feature is disabled --- tests/sccache_args.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/sccache_args.rs b/tests/sccache_args.rs index 88c727b97..12b4bb89f 100644 --- a/tests/sccache_args.rs +++ b/tests/sccache_args.rs @@ -30,6 +30,7 @@ fn stop_sccache() -> Result<()> { #[test] #[serial] +#[cfg(feature = "gcs")] fn test_gcp_arg_check() -> Result<()> { trace!("sccache with log"); stop_sccache()?; @@ -72,6 +73,7 @@ fn test_gcp_arg_check() -> Result<()> { #[test] #[serial] +#[cfg(feature = "s3")] fn test_s3_invalid_args() -> Result<()> { stop_sccache()?;