From 8e0f4ace34a13dbd22d029bf18fe832dfda102e7 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 3 May 2024 11:32:07 -0700 Subject: [PATCH 1/6] ci: Run cargo doc and clippy with default features, all features and no features --- .github/workflows/ci.yaml | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b441c409..c6fc39c6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,13 +52,12 @@ jobs: command: test args: --all ${{ matrix.feature_flag }} - style_and_docs: + cargo_fmt: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -67,18 +66,30 @@ jobs: components: rustfmt, clippy - name: fmt run: cargo fmt --all -- --check - - name: clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-targets --all-features -- -D warnings - - name: Docs - run: cargo doc --no-deps + + style_and_docs: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + strategy: + matrix: + feature_flag: ["--all-features", "--no-default-features", ""] + runs-on: ubuntu-latest + steps: + - name: clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --all-targets ${{ matrix.feature_flag }} -- -D warnings + - name: docs + uses: actions-rs/cargo@v1 + with: + command: doc + args: --no-deps --all-targets ${{ matrix.feature_flag }} -- -D warnings fuzz_read: runs-on: ubuntu-latest needs: - build_and_test + - cargo_fmt - style_and_docs steps: - uses: actions/checkout@v4 @@ -126,6 +137,7 @@ jobs: runs-on: ubuntu-latest needs: - build_and_test + - cargo_fmt - style_and_docs steps: - uses: actions/checkout@v4 @@ -173,6 +185,7 @@ jobs: runs-on: ubuntu-latest needs: - build_and_test + - cargo_fmt - style_and_docs steps: - uses: actions/checkout@v4 @@ -220,6 +233,7 @@ jobs: runs-on: ubuntu-latest needs: - build_and_test + - cargo_fmt - style_and_docs steps: - uses: actions/checkout@v4 From f814a6dbc33e6bde4190caa43ebf4f969a403554 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 3 May 2024 11:41:04 -0700 Subject: [PATCH 2/6] ci: Bug fix: need to check out code and install toolchain in new jobs --- .github/workflows/ci.yaml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c6fc39c6..83a2c5da 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -63,7 +63,7 @@ jobs: profile: minimal toolchain: nightly override: true - components: rustfmt, clippy + components: rustfmt - name: fmt run: cargo fmt --all -- --check @@ -74,16 +74,23 @@ jobs: feature_flag: ["--all-features", "--no-default-features", ""] runs-on: ubuntu-latest steps: - - name: clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-targets ${{ matrix.feature_flag }} -- -D warnings - - name: docs - uses: actions-rs/cargo@v1 - with: - command: doc - args: --no-deps --all-targets ${{ matrix.feature_flag }} -- -D warnings + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: clippy + - name: clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --all-targets ${{ matrix.feature_flag }} -- -D warnings + - name: docs + uses: actions-rs/cargo@v1 + with: + command: doc + args: --no-deps --all-targets ${{ matrix.feature_flag }} -- -D warnings fuzz_read: runs-on: ubuntu-latest From cb6f87bc02a973d0236e27130b8dbf44d3114546 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 3 May 2024 11:43:41 -0700 Subject: [PATCH 3/6] chore: Fix a pre-existing failure --- benches/merge_archive.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/benches/merge_archive.rs b/benches/merge_archive.rs index c5cb26c5..e0e9a740 100644 --- a/benches/merge_archive.rs +++ b/benches/merge_archive.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "_deflate-any")] + use bencher::{benchmark_group, benchmark_main}; use std::io::{Cursor, Read, Seek, Write}; From d663b31fb2c1d05efef13f2559d20e213e01f132 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 3 May 2024 11:49:09 -0700 Subject: [PATCH 4/6] chore: Fix: don't feature-gate all of merge_archive.rs, only the parts that use compression --- benches/merge_archive.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/benches/merge_archive.rs b/benches/merge_archive.rs index e0e9a740..709cd8a5 100644 --- a/benches/merge_archive.rs +++ b/benches/merge_archive.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "_deflate-any")] - use bencher::{benchmark_group, benchmark_main}; use std::io::{Cursor, Read, Seek, Write}; @@ -67,6 +65,7 @@ fn merge_archive_stored(bench: &mut Bencher) { }); } +#[cfg(feature = "_deflate-any")] fn merge_archive_compressed(bench: &mut Bencher) { let options = SimpleFileOptions::default().compression_method(zip::CompressionMethod::Deflated); let (len, src) = generate_random_archive(NUM_ENTRIES, ENTRY_SIZE, options).unwrap(); @@ -97,6 +96,7 @@ fn merge_archive_raw_copy_file_stored(bench: &mut Bencher) { }); } +#[cfg(feature = "_deflate-any")] fn merge_archive_raw_copy_file_compressed(bench: &mut Bencher) { let options = SimpleFileOptions::default().compression_method(zip::CompressionMethod::Deflated); let (len, src) = generate_random_archive(NUM_ENTRIES, ENTRY_SIZE, options).unwrap(); @@ -112,6 +112,7 @@ fn merge_archive_raw_copy_file_compressed(bench: &mut Bencher) { }); } +#[cfg(feature = "_deflate-any")] benchmark_group!( benches, merge_archive_stored, @@ -119,4 +120,12 @@ benchmark_group!( merge_archive_raw_copy_file_stored, merge_archive_raw_copy_file_compressed, ); + +#[cfg(not(feature = "_deflate-any"))] +benchmark_group!( + benches, + merge_archive_stored, + merge_archive_raw_copy_file_stored, +); + benchmark_main!(benches); From 06feb9ae72523e81f9727e7dbe9867b383a6cda0 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 3 May 2024 11:51:00 -0700 Subject: [PATCH 5/6] chore: Fix: cargo doc doesn't have an `--all-targets` option --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 83a2c5da..6b7542d7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -90,7 +90,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: doc - args: --no-deps --all-targets ${{ matrix.feature_flag }} -- -D warnings + args: --no-deps ${{ matrix.feature_flag }} -- -D warnings fuzz_read: runs-on: ubuntu-latest From bebf54c64164f156d71babf1c4e9b1c7a3547223 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 3 May 2024 11:55:02 -0700 Subject: [PATCH 6/6] chore: Fix: cargo doc doesn't have a `-D warnings` option --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6b7542d7..6fe1a9b3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -90,7 +90,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: doc - args: --no-deps ${{ matrix.feature_flag }} -- -D warnings + args: --no-deps ${{ matrix.feature_flag }} fuzz_read: runs-on: ubuntu-latest