Skip to content

Move gz API to libz-rs-sys-cdylib #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,21 @@ jobs:
run: cargo nextest run --target ${{matrix.target}} ${{ matrix.features }} --no-fail-fast
env:
RUST_BACKTRACE: 1
- name: cargo nextest cdylib
if: matrix.os != 'windows-2022'
working-directory: libz-rs-sys-cdylib
run: cargo llvm-cov nextest --target ${{matrix.target}} ${{ matrix.features }} --features="gz" --lcov --output-path cdylib.lcov.info --ignore-filename-regex "test-libz|dynamic-libz"
- name: cargo nextest cdylib
if: matrix.os == 'windows-2022'
working-directory: libz-rs-sys-cdylib
run: cargo nextest run --target ${{matrix.target}} ${{ matrix.features }} --features="gz" --no-fail-fast
- name: Upload coverage to Codecov
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
if: matrix.os != 'windows-2022' && matrix.rust == 'stable'
with:
files: ./lcov.info
files: |
./lcov.info
./cdylib.lcov.info
fail_ci_if_error: false
flags: test-${{matrix.target}}
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down Expand Up @@ -167,15 +177,22 @@ jobs:
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: stable
components: clippy
components: clippy, rustfmt
targets: ${{matrix.target}}
- name: Rust cache
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8
with:
shared-key: "stable-${{matrix.target}}"

- name: Run clippy
run: cargo clippy --target ${{matrix.target}} ${{matrix.features}} --workspace --all-targets -- -D warnings
- name: Run rustfmt and clippy
run: |
cargo fmt --all --check
cargo clippy --target ${{matrix.target}} ${{matrix.features}} --workspace --all-targets -- -D warnings
- name: Run rustfmt and clippy (cdylib)
working-directory: libz-rs-sys-cdylib
run: |
cargo fmt --all --check
cargo clippy --target ${{matrix.target}} ${{matrix.features}} --workspace --all-targets -- -D warnings
- name: Run clippy (fuzzers)
if: ${{ !contains(matrix.features, 'gz') }}
run: cargo clippy --target ${{matrix.target}} ${{matrix.features}} --manifest-path ./fuzz/Cargo.toml --all-targets -- -D warnings
Expand Down Expand Up @@ -255,7 +272,7 @@ jobs:
done

fuzz-code-coverage:
name: Fuzz with code coverage
name: Fuzz with code coverage
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -399,7 +416,7 @@ jobs:
working-directory: libz-rs-sys-cdylib
run: |
# build using cargo-c this time
cargo cinstall --offline --release --destdir=/tmp/cargo-cbuild-libz-rs
cargo cinstall --release --destdir=/tmp/cargo-cbuild-libz-rs
tree /tmp/cargo-cbuild-libz-rs
# verify that the SONAME is set and includes a version
objdump -p target/x86_64-unknown-linux-gnu/release/libz_rs.so | awk '/SONAME/{print $2}' | grep -E 'libz_rs\.so\.1'
Expand Down Expand Up @@ -483,7 +500,8 @@ jobs:
- name: Test allocator with miri
run: "cargo +nightly miri nextest run -j4 -p zlib-rs --target ${{ matrix.target }} allocate::"
- name: Test gz logic with miri
run: "cargo +nightly miri nextest run -j4 -p libz-rs-sys --target ${{ matrix.target }} --features=gz"
working-directory: libz-rs-sys-cdylib
run: "cargo +nightly miri nextest run -j4 -p libz-rs-sys-cdylib --target ${{ matrix.target }} --features=gz"
env:
MIRIFLAGS: "-Zmiri-tree-borrows -Zmiri-disable-isolation"

Expand Down
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions libz-rs-sys-cdylib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions libz-rs-sys-cdylib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ rust-version = "1.75" # MSRV

[lib]
name = "z_rs" # turns into e.g. `libz_rs.so`
crate-type=["cdylib"]
test = false
crate-type = ["cdylib", "lib"]

[profile.dev]
panic = "abort" # abort on panics. This is crucial, unwinding would cause UB!
Expand All @@ -28,9 +27,12 @@ rust-allocator = ["libz-rs-sys/rust-allocator", "libz-rs-sys/std"] # by default,
custom-prefix = ["libz-rs-sys/custom-prefix"] # use the LIBZ_RS_SYS_PREFIX to prefix all exported symbols
semver-prefix = ["libz-rs-sys/semver-prefix"] # prefix all symbols in a semver-compatible way
capi = []
gz = ["dep:libc"] # support for the `gz*` functions is experimental

[dependencies]
libz-rs-sys = { version = "0.5.0", path = "../libz-rs-sys", default-features = false, features = ["export-symbols"] }
zlib-rs = { version = "0.5.0", path = "../zlib-rs", default-features = false }
libc = { version = "0.2.171", optional = true }

[package.metadata.capi.library]
version = "1.3.0" # the zlib api version we match
Expand Down
Loading
Loading