Use the "C-unwind" abi for functions we cannot guarantee won't panic #731
Workflow file for this run
This file contains 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: | |
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 }}" | |
strategy: | |
matrix: | |
include: | |
- rust: stable | |
os: ubuntu-latest | |
features: "" | |
target: "x86_64-unknown-linux-gnu" | |
- rust: msrv | |
os: ubuntu-latest | |
features: "" | |
target: "x86_64-unknown-linux-gnu" | |
- rust: beta | |
os: ubuntu-latest | |
features: "" | |
target: "x86_64-unknown-linux-gnu" | |
- rust: "stable" | |
os: macos-latest | |
features: "" | |
target: "x86_64-apple-darwin" | |
- rust: "stable" | |
os: macos-14 | |
features: "" | |
target: "aarch64-apple-darwin" | |
- rust: stable-x86_64-gnu | |
os: windows-2022 | |
features: "" | |
target: "x86_64-pc-windows-gnu" | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
persist-credentials: false | |
- name: Set target rust version | |
run: echo "TARGET_RUST_VERSION=$(if [ "${{matrix.rust}}" = "msrv" ]; then grep rust-version Cargo.toml | grep MSRV | cut -d'"' -f2; else echo "${{matrix.rust}}"; fi)" >> $GITHUB_ENV | |
if: matrix.os != 'windows-2022' | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
with: | |
toolchain: "${TARGET_RUST_VERSION}" | |
targets: "${{ matrix.target }}" | |
if: matrix.os != 'windows-2022' | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
with: | |
toolchain: "${{matrix.rust}}" | |
targets: "${{ matrix.target }}" | |
if: matrix.os == 'windows-2022' | |
- name: target | |
run: "rustc -vV | sed -n 's|host: ||p'" | |
if: matrix.os != 'windows-2022' | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8 | |
with: | |
tool: cargo-llvm-cov | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8 | |
with: | |
tool: cargo-nextest | |
- name: cargo build | |
run: cargo build --target ${{matrix.target}} ${{ matrix.features }} | |
- name: cargo nextest # reports segfaults in a helpful way | |
run: cargo nextest run --target ${{matrix.target}} ${{ matrix.features }} --no-fail-fast | |
env: | |
RUST_BACKTRACE: 1 | |
- name: cargo test with llvm-cov | |
run: cargo llvm-cov --target ${{matrix.target}} ${{ matrix.features }} --lcov --output-path lcov.info | |
env: | |
RUST_BACKTRACE: 1 | |
if: matrix.os != 'windows-2022' | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d | |
if: matrix.os != 'windows-2022' | |
with: | |
files: lcov.info | |
fail_ci_if_error: false | |
build-qemu: | |
name: QEMU build & test | |
runs-on: "${{ matrix.os }}" | |
strategy: | |
matrix: | |
include: | |
- rust: stable | |
os: ubuntu-latest | |
features: "" | |
target: "s390x-unknown-linux-gnu" | |
gcc: "s390x-linux-gnu-gcc" | |
- rust: stable | |
os: ubuntu-latest | |
features: "" | |
target: "i686-unknown-linux-gnu" | |
gcc: "i686-linux-gnu-gcc" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: qemu-user qemu-user-static qemu-system-s390x gcc-s390x-linux-gnu gcc-i686-linux-gnu g++-s390x-linux-gnu | |
version: 1.0 | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
persist-credentials: false | |
- name: Copy QEMU Cargo Config | |
run: | | |
mkdir -p .cargo | |
cp qemu-cargo-config.toml .cargo/config.toml | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 | |
with: | |
toolchain: "stable" | |
targets: "${{ matrix.target }}" | |
- name: target | |
run: "rustc -vV | sed -n 's|host: ||p'" | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8 | |
with: | |
tool: cargo-nextest | |
- name: cargo build | |
run: cargo build --target ${{matrix.target}} ${{ matrix.features }} | |
- name: cargo nextest # reports segfaults in a helpful way | |
run: cargo nextest run --target ${{matrix.target}} ${{ matrix.features }} | |
env: | |
RUST_BACKTRACE: 1 | |
CC: ${{matrix.gcc}} | |
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"' | |
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 | |
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}} --workspace --all-targets -- -D warnings | |
- name: Run clippy (fuzzers) | |
run: cargo clippy --target ${{matrix.target}} --manifest-path ./fuzz/Cargo.toml --all-targets -- -D warnings | |
if: ${{matrix.fuzzer}} | |
fuzz: | |
name: Smoke-test fuzzing targets | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
features: | |
- "" | |
- '--no-default-features --features="c-allocator"' | |
- '--no-default-features --features="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 | |
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8 | |
with: | |
tool: cargo-fuzz | |
- name: Smoke-test fuzz targets | |
run: | | |
cargo fuzz build ${{ matrix.features }} | |
for target in $(cargo fuzz list ${{ matrix.features }}) ; do | |
RUST_BACKTRACE=1 cargo fuzz run ${{ matrix.features }} $target -- -max_total_time=10 | |
done | |
fuzz-aarch64: | |
name: Smoke-test fuzzing targets | |
runs-on: macos-14 | |
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 | |
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8 | |
with: | |
tool: cargo-fuzz | |
- name: Smoke-test fuzz targets | |
run: | | |
cargo fuzz build ${{ matrix.features }} | |
for target in $(cargo fuzz list ${{ matrix.features }}) ; do | |
RUST_BACKTRACE=1 cargo fuzz run ${{ matrix.features }} $target -- -max_total_time=10 | |
done | |
link-c-dynamic-library: | |
name: 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: Rust cache | |
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 | |
with: | |
shared-key: "stable-${{matrix.target}}" | |
- name: get zpipe.c | |
run: wget https://www.zlib.net/zpipe.c | |
- name: cargo build | |
run: cargo build --target ${{matrix.target}} -p libz-rs-sys --release | |
- name: cc | |
run: cc -o zpipe zpipe.c target/${{matrix.target}}/release/deps/liblibz_rs_sys.so | |
- name: execute | |
run: cat Cargo.toml | ./zpipe | ./zpipe -d > out.txt | |
- name: compare | |
run: cmp -s Cargo.toml out.txt | |
miri: | |
name: "Miri" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Miri | |
run: | | |
rustup toolchain install nightly --component miri | |
cargo +nightly miri setup | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8 | |
with: | |
tool: cargo-nextest | |
- name: Test public C api with NULL arguments | |
run: "cargo +nightly miri nextest run -j4 -p test-libz-rs-sys null::" | |
env: | |
RUSTFLAGS: "-Ctarget-feature=+avx2" | |
MIRIFLAGS: "-Zmiri-tree-borrows" |