diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09f632c..7ab9581 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,10 +36,10 @@ jobs: - name: cargo build run: cargo build --all-targets --all-features - name: cargo test - run: cargo test --all-targets + run: cargo test --all-targets --all-features # https://github.com/rust-lang/cargo/issues/6669 - name: cargo test --doc - run: cargo test --doc + run: cargo test --doc --all-features linting: name: Lints, pinned toolchain runs-on: ubuntu-latest @@ -56,4 +56,4 @@ jobs: - name: cargo fmt (check) run: cargo fmt -- --check -l - name: cargo clippy (warnings) - run: cargo clippy --all-targets -- -D warnings + run: cargo clippy --all-targets --all-features -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index 08dddb9..7d538a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ zstd = { version = "0.13.2", optional = true } [dev-dependencies] anyhow = "1.0.89" +cap-tempfile = "3.3.0" [features] zstd = ["dep:zstd"] diff --git a/examples/zstd.rs b/examples/zstd.rs index 75c29e2..3b2fa2e 100644 --- a/examples/zstd.rs +++ b/examples/zstd.rs @@ -2,10 +2,11 @@ fn main() { use std::{env, path::PathBuf}; + use cap_tempfile::TempDir; use oci_spec::image::Platform; - use ocidir::{cap_std::fs::Dir, new_empty_manifest, OciDir}; - let dir = Dir::open_ambient_dir(env::temp_dir(), ocidir::cap_std::ambient_authority()).unwrap(); - let oci_dir = OciDir::ensure(dir).unwrap(); + use ocidir::{new_empty_manifest, OciDir}; + let dir = TempDir::new(ocidir::cap_std::ambient_authority()).unwrap(); + let oci_dir = OciDir::ensure(dir.try_clone().unwrap()).unwrap(); let mut manifest = new_empty_manifest().build().unwrap(); let mut config = ocidir::oci_spec::image::ImageConfigurationBuilder::default() diff --git a/src/lib.rs b/src/lib.rs index 708cda6..25e84f7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -281,7 +281,7 @@ impl OciDir { /// /// This method is only available when the `zstd` feature is enabled. pub fn create_layer_zstd(&self, compression_level: Option) -> Result { - Ok(ZstdLayerWriter::new(&self.dir, compression_level)?) + ZstdLayerWriter::new(&self.dir, compression_level) } #[cfg(feature = "zstdmt")] @@ -298,11 +298,7 @@ impl OciDir { compression_level: Option, n_workers: u32, ) -> Result { - Ok(ZstdLayerWriter::multithread( - &self.dir, - compression_level, - n_workers, - )?) + ZstdLayerWriter::multithread(&self.dir, compression_level, n_workers) } /// Add a layer to the top of the image stack. The firsh pushed layer becomes the root.