Skip to content

Commit

Permalink
test/lint with --all-features
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Fay <tomfay@microsoft.com>
  • Loading branch information
tofay committed Oct 4, 2024
1 parent bdc4fbf commit c3a9e5c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
7 changes: 4 additions & 3 deletions examples/zstd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 2 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>) -> Result<ZstdLayerWriter> {
Ok(ZstdLayerWriter::new(&self.dir, compression_level)?)
ZstdLayerWriter::new(&self.dir, compression_level)
}

#[cfg(feature = "zstdmt")]
Expand All @@ -298,11 +298,7 @@ impl OciDir {
compression_level: Option<i32>,
n_workers: u32,
) -> Result<ZstdLayerWriter> {
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.
Expand Down

0 comments on commit c3a9e5c

Please sign in to comment.