checks #2729
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: checks | |
| permissions: | |
| contents: read | |
| on: # zizmor: ignore[cache-poisoning] not actually used for releases | |
| push: | |
| branches: | |
| - main | |
| - 'release/**' | |
| pull_request: | |
| branches-ignore: | |
| - 'release/**' | |
| schedule: | |
| - cron: '0 4 * * *' | |
| merge_group: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| name: Build and test | |
| runs-on: "${{ matrix.os }}" | |
| env: | |
| RUST_BACKTRACE: 1 | |
| # i686-unknown-linux-gnu | |
| CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER: i686-linux-gnu-gcc | |
| # s390x-unknown-linux-gnu | |
| CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER: s390x-linux-gnu-gcc | |
| CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER: qemu-s390x -L /usr/s390x-linux-gnu | |
| # powerpc64le-unknown-linux-gnu | |
| CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER: powerpc64le-linux-gnu-gcc | |
| CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUNNER: qemu-ppc64le -L /usr/powerpc64le-linux-gnu | |
| # loongarch64-unknown-linux-gnu | |
| CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER: loongarch64-linux-gnu-gcc | |
| CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_RUNNER: qemu-loongarch64 -L /usr/loongarch64-linux-gnu | |
| # wasm32-wasip1 (std for wasip2 is unstable) | |
| WASI_SDK_PATH: /tmp/wasi-sdk-24.0-x86_64-linux | |
| CC_wasm32_wasip1: /tmp/wasi-sdk-24.0-x86_64-linux/bin/clang | |
| CXX_wasm32_wasip1: /tmp/wasi-sdk-24.0-x86_64-linux/bin/clang++ | |
| AR_wasm32_wasip1: /tmp/wasi-sdk-24.0-x86_64-linux/bin/llvm-ar | |
| CARGO_TARGET_WASM32_WASIP1_RUNNER: "wasmtime --dir /home/runner/work/zlib-rs/zlib-rs/test-libz-rs-sys --dir /tmp/" | |
| CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS: "-Ctarget-feature=+simd128" | |
| BINDGEN_EXTRA_CLANG_ARGS_wasm32_wasip1: "--sysroot=/tmp/wasi-sdk-24.0-x86_64-linux/share/wasi-sysroot" | |
| strategy: | |
| matrix: | |
| include: | |
| - rust: stable | |
| target: "x86_64-unknown-linux-gnu" | |
| os: ubuntu-latest | |
| codecov: true | |
| - rust: msrv | |
| target: "x86_64-unknown-linux-gnu" | |
| os: ubuntu-latest | |
| codecov: false | |
| - rust: beta | |
| target: "x86_64-unknown-linux-gnu" | |
| os: ubuntu-latest | |
| codecov: false | |
| - rust: nightly | |
| target: "x86_64-unknown-linux-gnu" | |
| os: ubuntu-latest | |
| flags: "--features=gzprintf" | |
| codecov: true | |
| - target: "aarch64-unknown-linux-gnu" | |
| os: ubuntu-24.04-arm | |
| codecov: true | |
| - target: "i686-unknown-linux-gnu" | |
| os: ubuntu-latest | |
| codecov: true | |
| packages: gcc-i686-linux-gnu g++-i686-linux-gnu | |
| - target: "s390x-unknown-linux-gnu" | |
| os: ubuntu-26.04 | |
| codecov: false | |
| packages: gcc-s390x-linux-gnu g++-s390x-linux-gnu qemu-user qemu-user-binfmt | |
| - target: "powerpc64le-unknown-linux-gnu" | |
| os: ubuntu-26.04 | |
| codecov: false | |
| packages: gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu qemu-user qemu-user-binfmt | |
| - rust: nightly | |
| target: "loongarch64-unknown-linux-gnu" | |
| os: ubuntu-26.04 | |
| codecov: false | |
| flags: "--features=lsx" | |
| packages: gcc-loongarch64-linux-gnu g++-loongarch64-linux-gnu qemu-user qemu-user-binfmt | |
| - target: "wasm32-wasip1" | |
| os: ubuntu-latest | |
| flags: "-p zlib-rs -p libz-rs-sys -p test-libz-rs-sys" | |
| codecov: false | |
| - target: "x86_64-apple-darwin" | |
| os: macos-latest | |
| codecov: true | |
| - target: "aarch64-apple-darwin" | |
| os: macos-14 | |
| codecov: true | |
| - target: "x86_64-pc-windows-gnu" | |
| os: windows-2022 | |
| codecov: false | |
| - target: "aarch64-pc-windows-msvc" | |
| os: windows-11-arm | |
| codecov: false | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| # Install the correct rust toolchain/version | |
| - name: Set target rust version | |
| run: echo "MSRV=$(grep rust-version Cargo.toml | grep MSRV | awk -F '\"' '{print $2}')" >> $GITHUB_ENV | |
| if: ${{ matrix.rust == 'msrv' }} | |
| - name: Install toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: ${{ env.MSRV || matrix.rust || 'stable' }} | |
| targets: "${{ matrix.target }}" | |
| # Install dependencies | |
| - name: Install cargo-llvm-cov & cargo-nextest | |
| uses: taiki-e/install-action@d12e869b89167df346dd0ff65da342d1fb1202fb # v2.53.2 | |
| with: | |
| tool: cargo-llvm-cov,cargo-nextest | |
| - name: Cache apt packages | |
| if: matrix.packages != '' | |
| uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 | |
| with: | |
| packages: "${{ matrix.packages }}" | |
| version: 2 | |
| - name: Download wasmtime & wasi-sdk | |
| if: ${{ contains(matrix.target, 'wasm') }} | |
| run: | | |
| curl https://wasmtime.dev/install.sh -sSf | bash | |
| echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH | |
| curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-linux.tar.gz | tar xz --directory /tmp | |
| # build | |
| - name: cargo build | |
| run: cargo build --target ${{matrix.target}} ${{ matrix.flags }} | |
| # ensure tests for "real" features work standalone | |
| - name: cargo test --no-default-features --features ... | |
| run: | | |
| cargo test --target ${{matrix.target}} ${{ matrix.flags }} --no-default-features --features c-allocator | |
| cargo test --target ${{matrix.target}} ${{ matrix.flags }} --no-default-features --features rust-allocator | |
| # Run tests | |
| - name: cargo llvm-cov nextest | |
| if: matrix.codecov | |
| run: cargo llvm-cov nextest --lcov --output-path lcov.info --ignore-filename-regex "test-libz|dynamic-libz" --target ${{matrix.target}} ${{ matrix.flags }} --features=gz --no-fail-fast | |
| - name: cargo nextest | |
| if: matrix.codecov == false | |
| run: cargo nextest run --target ${{matrix.target}} ${{ matrix.flags }} --features=gz --no-fail-fast | |
| # Run overflow test | |
| - name: check for overflows | |
| run: cargo run -p test-libz-rs-sys --target ${{matrix.target}} --example overflow | |
| # Build feature configuriations | |
| - name: check all-features and no-default-features. | |
| if: matrix.rust == 'stable' && matrix.target == 'x86_64-unknown-linux-gnu' | |
| run: | | |
| cargo test -p zlib-rs --target ${{matrix.target}} ${{ matrix.flags }} --all-features --no-run | |
| cargo test --target ${{matrix.target}} ${{ matrix.flags }} --no-default-features --features=rust-allocator --no-run | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0 | |
| if: matrix.codecov | |
| with: | |
| files: | | |
| ./lcov.info | |
| ./cdylib.lcov.info | |
| fail_ci_if_error: false | |
| flags: test-${{matrix.target}} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| name: test | |
| verbose: true | |
| clippy: | |
| name: Clippy | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| features: | |
| - "" | |
| - '--no-default-features --features="c-allocator"' | |
| - '--no-default-features --features="rust-allocator"' | |
| - '--no-default-features --features="gz" --features="c-allocator"' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install rust toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: stable | |
| components: clippy, rustfmt | |
| targets: ${{matrix.target}} | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 | |
| with: | |
| shared-key: "stable-${{matrix.target}}" | |
| - 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 | |
| - name: Run cargo doc, deny warnings | |
| env: | |
| RUSTDOCFLAGS: "-D warnings" | |
| run: | | |
| cargo doc --target ${{matrix.target}} -p libz-rs-sys | |
| check-msrv: | |
| name: MSRV check (${{ matrix.target }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Roughly the targets for which we have custom SIMD. | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - aarch64-unknown-linux-gnu | |
| - wasm32-unknown-unknown | |
| - loongarch64-unknown-linux-gnu | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Determine MSRV | |
| run: | | |
| echo "MSRV=$(grep rust-version Cargo.toml | grep MSRV | awk -F '"' '{print $2}')" >> "$GITHUB_ENV" | |
| - name: Install toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: ${{ env.MSRV }} | |
| targets: ${{ matrix.target }} | |
| # Don't check the test crate (it would need a linker etc. to run build.rs). | |
| - name: Cargo check | |
| run: cargo check --target ${{ matrix.target }} -p zlib-rs -p libz-rs-sys | |
| fuzz: | |
| name: Smoke-test fuzzing targets | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| features: | |
| - 'default' | |
| - 'c-allocator' | |
| - 'rust-allocator' | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install nightly toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: nightly | |
| - name: Install cargo fuzz | |
| run: cargo install cargo-fuzz | |
| - name: Smoke-test fuzz targets | |
| run: | | |
| cargo fuzz build --no-default-features --features="${{ matrix.features }}" | |
| for target in $(cargo fuzz list); do | |
| if [ "$target" = "uncompress" ]; then | |
| features="${{ matrix.features }} disable-checksum" | |
| else | |
| features="${{ matrix.features }}" | |
| fi | |
| RUST_BACKTRACE=1 cargo fuzz run --no-default-features --features="$features" $target -- -max_total_time=10 | |
| done | |
| fuzz-aarch64: | |
| name: Smoke-test fuzzing targets | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - rust: "stable" | |
| os: macos-14 | |
| features: "" | |
| target: "aarch64-apple-darwin" | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install nightly toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: nightly | |
| - name: Install cargo fuzz | |
| run: cargo install cargo-fuzz | |
| - name: Smoke-test fuzz targets | |
| run: | | |
| cargo fuzz build --no-default-features --features="${{ matrix.features }}" | |
| for target in $(cargo fuzz list); do | |
| if [ "$target" = "uncompress" ]; then | |
| features="${{ matrix.features }} disable-checksum" | |
| else | |
| features="${{ matrix.features }}" | |
| fi | |
| RUST_BACKTRACE=1 cargo fuzz run --no-default-features --features="$features" $target -- -max_total_time=10 | |
| done | |
| fuzz-code-coverage: | |
| name: Fuzz with code coverage | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - fuzz_target: uncompress | |
| corpus: "gzip-files/compressed" | |
| features: '--no-default-features --features="disable-checksum,keep-invalid-in-corpus"' | |
| flags: fuzz-decompress | |
| - fuzz_target: compress | |
| corpus: "" | |
| features: '' | |
| flags: fuzz-compress | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install nightly toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: nightly | |
| components: llvm-tools-preview | |
| - name: Install cargo fuzz | |
| run: cargo install cargo-fuzz | |
| - name: Install rustfilt | |
| uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8 | |
| with: | |
| tool: rustfilt | |
| - name: Download custom decompression corpus | |
| if: ${{ contains(matrix.corpus, 'gzip-files') }} | |
| run: | | |
| wget https://github.com/trifectatechfoundation/compression-corpus/releases/download/2025-04-14-103007/gzip-files.zip | |
| unzip gzip-files.zip -d gzip-files | |
| - name: Run `cargo fuzz` | |
| env: | |
| RUST_BACKTRACE: "1" | |
| # prevents `cargo fuzz coverage` from rebuilding everything | |
| RUSTFLAGS: "-C instrument-coverage" | |
| run: | | |
| cargo fuzz run ${{matrix.features}} ${{matrix.fuzz_target}} ${{matrix.corpus}} -- -max_total_time=10 | |
| - name: Fuzz codecov | |
| run: | | |
| cargo fuzz coverage ${{matrix.features}} ${{matrix.fuzz_target}} ${{matrix.corpus}} | |
| $(rustc --print sysroot)/lib/rustlib/$(rustc --print host-tuple)/bin/llvm-cov export -Xdemangler=rustfilt \ | |
| target/$(rustc --print host-tuple)/coverage/$(rustc --print host-tuple)/release/${{matrix.fuzz_target}} \ | |
| -instr-profile=fuzz/coverage/${{matrix.fuzz_target}}/coverage.profdata \ | |
| --format=lcov \ | |
| -ignore-filename-regex="\.cargo|\.rustup|fuzz_targets" > lcov.info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d | |
| with: | |
| files: ./lcov.info | |
| fail_ci_if_error: false | |
| flags: ${{ matrix.flags }} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| name: fuzz | |
| link-c-dynamic-library: | |
| name: vanilla dynamic library | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| features: | |
| - '' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install rust toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: stable | |
| targets: ${{matrix.target}} | |
| - name: "cdylib: default settings" | |
| working-directory: libz-rs-sys-cdylib | |
| env: | |
| LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps" | |
| run: | | |
| cargo build --release --target ${{matrix.target}} | |
| cc -o zpipe zpipe.c target/${{matrix.target}}/release/deps/libz_rs.so | |
| ./zpipe < Cargo.toml | ./zpipe -d > out.txt | |
| cmp -s Cargo.toml out.txt | |
| - name: "cdylib: rust-allocator" | |
| env: | |
| LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps" | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| cargo build --release --target ${{matrix.target}} --no-default-features --features="rust-allocator" | |
| cc -o zpipe zpipe.c target/${{matrix.target}}/release/deps/libz_rs.so | |
| ./zpipe < Cargo.toml | ./zpipe -d > out.txt | |
| cmp -s Cargo.toml out.txt | |
| - name: "cdylib: no_std" | |
| env: | |
| LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps" | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| cargo build --release --target ${{matrix.target}} --no-default-features | |
| cc -DNO_STD -o zpipe zpipe.c target/${{matrix.target}}/release/deps/libz_rs.so | |
| ./zpipe < Cargo.toml | ./zpipe -d > out.txt | |
| cmp -s Cargo.toml out.txt | |
| - name: "cdylib: custom-prefix" | |
| working-directory: libz-rs-sys-cdylib | |
| env: | |
| LIBZ_RS_SYS_PREFIX: "MY_CUSTOM_PREFIX_" | |
| run: | | |
| cargo build --release --target ${{matrix.target}} --features=custom-prefix | |
| objdump -tT target/${{matrix.target}}/release/deps/libz_rs.so | grep -q "MY_CUSTOM_PREFIX_uncompress" || (echo "symbol not found!" && exit 1) | |
| - name: "cdylib: semver-prefix" | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| cargo build --release --target ${{matrix.target}} --features=semver-prefix | |
| objdump -tT target/${{matrix.target}}/release/deps/libz_rs.so | grep -q -E "LIBZ_RS_SYS_v0.[0-9]+.x_uncompress" || (echo "symbol not found!" && exit 1) | |
| - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends valgrind | |
| - name: "cdylib: example.c" | |
| env: | |
| LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps" | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| rustup toolchain install nightly | |
| cargo +nightly build --release --target ${{matrix.target}} --no-default-features --features=gz,gzprintf,c-allocator | |
| cc -o example example.c target/${{matrix.target}}/release/deps/libz_rs.so | |
| ./example | |
| valgrind --track-origins=yes --error-exitcode=1 ./example | |
| - name: "cdylib: example.c with our .h files" | |
| env: | |
| LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps" | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| cc -o example example.c target/${{matrix.target}}/release/deps/libz_rs.so -I../libz-rs-sys/include/ | |
| ./example | |
| valgrind --track-origins=yes --error-exitcode=1 ./example | |
| symbol-versioning: | |
| name: Symbol versioning | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| features: | |
| - '' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install rust toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: nightly # for c-variadic functions | |
| targets: ${{matrix.target}} | |
| - name: Install apt packages | |
| uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 | |
| with: | |
| packages: build-essential cmake pkg-config abigail-tools binutils | |
| version: 2 | |
| - name: Build zlib-ng (in zlib compat mode) | |
| working-directory: /tmp | |
| run: | | |
| git clone --depth 1 https://github.com/zlib-ng/zlib-ng.git | |
| cmake -B zlib-ng-build -S zlib-ng \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DZLIB_COMPAT=ON | |
| cmake --build zlib-ng-build --config Release | |
| ls /tmp/zlib-ng-build | |
| - name: Build libz_rs.versioned.so | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| cargo +nightly build --release --target ${{matrix.target}} --features=gz,gzprintf | |
| cc -shared \ | |
| -Wl,--gc-sections \ | |
| -Wl,--whole-archive target/${{matrix.target}}/release/libz_rs.a \ | |
| -Wl,--no-whole-archive \ | |
| -Wl,--version-script=include/zlib.map \ | |
| -Wl,--undefined-version \ | |
| -Wl,-soname,libz_rs.so.1 \ | |
| -lc \ | |
| -o target/${{matrix.target}}/release/libz_rs.versioned.so | |
| ls target/${{matrix.target}}/release | |
| - name: Check versioned symbols | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| objdump -T target/${{matrix.target}}/release/libz_rs.versioned.so | grep "ZLIB" | |
| objdump -T target/${{matrix.target}}/release/libz_rs.versioned.so | grep -q -E "ZLIB_1\.2\.2\.3.*deflateTune" || (echo "symbol not found!" && exit 1) | |
| objdump -T target/${{matrix.target}}/release/libz_rs.versioned.so | grep -q -E "ZLIB_1\.3\.1\.2.*deflateUsed" || (echo "symbol not found!" && exit 1) | |
| objdump -T target/${{matrix.target}}/release/libz_rs.versioned.so | grep -q -E "ZLIB_1\.3\.2.*uncompress_z" || (echo "symbol not found!" && exit 1) | |
| - name: ABI comparison vs zlib-ng | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| abidiff --no-unreferenced-symbols --ignore-soname /tmp/zlib-ng-build/libz.so.1 target/${{matrix.target}}/release/libz_rs.versioned.so | |
| cargo-c-dynamic-library: | |
| name: cargo-c dynamic library | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| features: | |
| - '' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install rust toolchain | |
| uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
| with: | |
| toolchain: stable | |
| targets: ${{matrix.target}} | |
| - name: Install cargo-c | |
| env: | |
| LINK: https://github.com/lu-zero/cargo-c/releases/download/v0.10.5 | |
| run: | | |
| curl -L "$LINK/cargo-c-x86_64-unknown-linux-musl.tar.gz" | | |
| tar xz -C $HOME/.cargo/bin | |
| - name: build with and test the result of cargo-c | |
| working-directory: libz-rs-sys-cdylib | |
| run: | | |
| # build using cargo-c this time | |
| 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' | |
| # build zpipe with our library | |
| cc -o zpipe zpipe.c -L/tmp/cargo-cbuild-libz-rs/usr/local/lib/x86_64-linux-gnu -lz_rs | |
| export LD_LIBRARY_PATH=/tmp/cargo-cbuild-libz-rs/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH | |
| ./zpipe < Cargo.toml | ./zpipe -d > out.txt | |
| cmp -s Cargo.toml out.txt | |
| miri-zlib-rs: | |
| name: "Miri (zlib-rs)" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| - target: x86_64-pc-windows-gnu | |
| env: | |
| QUICKCHECK_TESTS: 10 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install Miri | |
| run: | | |
| rustup target add ${{ matrix.target }} | |
| rustup toolchain install nightly --component miri | |
| cargo +nightly miri setup | |
| - name: Install gcc | |
| if: ${{ contains(matrix.target, 'windows') }} | |
| run: | | |
| sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 | |
| x86_64-w64-mingw32-gcc --help | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@d12e869b89167df346dd0ff65da342d1fb1202fb # v2.53.2 | |
| with: | |
| tool: cargo-nextest | |
| - name: Test with miri | |
| run: "cargo +nightly miri nextest run -p zlib-rs --target ${{ matrix.target }}" | |
| miri-libz-rs-sys: | |
| name: "Miri (libz-rs-sys)" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| - target: x86_64-pc-windows-gnu | |
| env: | |
| QUICKCHECK_TESTS: 10 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install Miri | |
| run: | | |
| rustup target add ${{ matrix.target }} | |
| rustup toolchain install nightly --component miri | |
| cargo +nightly miri setup | |
| - name: Install gcc | |
| if: ${{ contains(matrix.target, 'windows') }} | |
| run: | | |
| sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 | |
| x86_64-w64-mingw32-gcc --help | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@d12e869b89167df346dd0ff65da342d1fb1202fb # v2.53.2 | |
| with: | |
| tool: cargo-nextest | |
| - name: Test public C api with NULL arguments | |
| run: "cargo +nightly miri nextest run -p test-libz-rs-sys --target ${{ matrix.target }} null::" | |
| env: | |
| RUSTFLAGS: "-Ctarget-feature=+avx2,+bmi2,+bmi1" | |
| - name: Test gz internals with miri | |
| working-directory: libz-rs-sys | |
| run: "cargo +nightly miri nextest run -p libz-rs-sys --target ${{ matrix.target }} --features=gz gz::" | |
| env: | |
| MIRIFLAGS: "-Zmiri-tree-borrows -Zmiri-disable-isolation" | |
| - name: Test gz api with miri | |
| if: ${{ contains(matrix.target, 'linux') }} | |
| run: "cargo +nightly miri nextest run -p test-libz-rs-sys --target ${{ matrix.target }} gz::" | |
| env: | |
| MIRIFLAGS: "-Zmiri-no-short-fd-operations -Zmiri-disable-isolation" | |
| miri-avx512: | |
| name: "Miri avx512" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| env: | |
| QUICKCHECK_TESTS: 10 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install Miri | |
| run: | | |
| rustup target add ${{ matrix.target }} | |
| rustup toolchain install nightly --component miri | |
| cargo +nightly miri setup | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@d12e869b89167df346dd0ff65da342d1fb1202fb # v2.53.2 | |
| with: | |
| tool: cargo-nextest | |
| - name: Test avx512 crc32 implementation | |
| run: "cargo +nightly miri nextest run -j4 -p zlib-rs --target ${{ matrix.target }} --features=vpclmulqdq crc32::" | |
| env: | |
| RUSTFLAGS: "-Ctarget-feature=+vpclmulqdq,+avx512f" | |
| - name: Test avx512 adler32 implementation | |
| run: "cargo +nightly miri nextest run -j4 -p zlib-rs --target ${{ matrix.target }} --features=avx512 adler32::avx512::test" | |
| env: | |
| RUSTFLAGS: "-Ctarget-feature=+avx2,+bmi2,+bmi1,+avx512f,+avx512bw" | |
| - name: Test avx512 vnni adler32 implementation | |
| run: "cargo +nightly miri nextest run -j4 -p zlib-rs --target ${{ matrix.target }} --features=avx512 adler32::" | |
| env: | |
| RUSTFLAGS: "-Ctarget-feature=+avx2,+bmi2,+bmi1,+avx512f,+avx512bw,+avx512vnni" | |
| - name: Test avx512 compare256 implementation | |
| run: "cargo +nightly miri nextest run -j4 -p zlib-rs --target ${{ matrix.target }} --features=avx512 compare256" | |
| env: | |
| RUSTFLAGS: "-Ctarget-feature=+avx512vl,+avx512bw" | |
| miri-simd: | |
| name: "Miri SIMD" | |
| runs-on: ubuntu-24.04-arm # so we don't need to install gcc | |
| strategy: | |
| matrix: | |
| include: | |
| - target: aarch64-unknown-linux-gnu | |
| # Errors out on miri atm, see https://github.com/rust-lang/miri/pull/5075. | |
| # - target: aarch64_be-unknown-linux-gnu | |
| - target: loongarch64-unknown-linux-gnu | |
| env: | |
| QUICKCHECK_TESTS: 10 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: Install Miri | |
| run: | | |
| rustup toolchain install nightly --component miri | |
| cargo +nightly miri setup | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@d12e869b89167df346dd0ff65da342d1fb1202fb # v2.53.2 | |
| with: | |
| tool: cargo-nextest | |
| - name: Test aarch64 with `+neon,+crc` | |
| if: ${{ contains(matrix.target, 'aarch64') }} | |
| run: "cargo +nightly miri test --target ${{ matrix.target }} -- crc32 adler32 compare256" | |
| env: | |
| RUSTFLAGS: "-Ctarget-feature=+crc" | |
| - name: Test loongarch64 | |
| if: ${{ contains(matrix.target, 'loongarch64') }} | |
| # FIXME: the -p zlib-rs is needed because github's ubuntu | |
| # does not have loongarch64 gcc for building our C dependencies. | |
| run: "cargo +nightly miri test --target ${{ matrix.target }} -p zlib-rs -- crc32 adler32 compare256" | |
| run-flate2-test-suite: | |
| name: run flate2 test suite | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| features: | |
| - '' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| persist-credentials: false | |
| - name: run | |
| run: | | |
| cd .. | |
| git clone https://github.com/rust-lang/flate2-rs.git | |
| cd flate2-rs | |
| sed -i '/^libz-rs-sys =/c\libz-rs-sys = { path = "../zlib-rs/libz-rs-sys", optional = true, default-features = false, features = ["std", "rust-allocator"] }' Cargo.toml | |
| cargo test --no-default-features --features="zlib-rs" | |