Merge pull request #92 from zip-rs/docs-check-feature-flag

ci: Run cargo doc and clippy with default features, all features and no features
This commit is contained in:
Chris Hennick 2024-05-03 21:18:47 +00:00 committed by GitHub
commit 00d8cadba3
Signed by: DevComp
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 10 deletions

View file

@ -52,33 +52,51 @@ 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
toolchain: nightly
override: true
components: rustfmt, clippy
components: rustfmt
- 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:
- 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 ${{ matrix.feature_flag }}
fuzz_read:
runs-on: ubuntu-latest
needs:
- build_and_test
- cargo_fmt
- style_and_docs
steps:
- uses: actions/checkout@v4
@ -126,6 +144,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- build_and_test
- cargo_fmt
- style_and_docs
steps:
- uses: actions/checkout@v4
@ -173,6 +192,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- build_and_test
- cargo_fmt
- style_and_docs
steps:
- uses: actions/checkout@v4
@ -220,6 +240,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- build_and_test
- cargo_fmt
- style_and_docs
steps:
- uses: actions/checkout@v4

View file

@ -65,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();
@ -95,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();
@ -110,6 +112,7 @@ fn merge_archive_raw_copy_file_compressed(bench: &mut Bencher) {
});
}
#[cfg(feature = "_deflate-any")]
benchmark_group!(
benches,
merge_archive_stored,
@ -117,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);