Skip to content

Slightly simplified zerocopy usage in tests (#62) #2

Slightly simplified zerocopy usage in tests (#62)

Slightly simplified zerocopy usage in tests (#62) #2

Workflow file for this run

name: Rust CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
# Check Code style quickly by running `rustfmt` over all code
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: cargo clippy -- -D warnings
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
test:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo test --no-fail-fast -- --nocapture
msrv_minimal_versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Generate Cargo.lock with minimal-version dependencies
run: cargo -Zminimal-versions generate-lockfile
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: 1.63.0
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: build
run: cargo build -v
# make sure the crate works with all features enabled/disabled
features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- uses: taiki-e/install-action@cargo-hack
- run: cargo hack test --each-feature
# taken from https://github.com/image-rs/image/blob/ca9e2dceb436a8c5a8202797cb9e8a1573eba35e/.github/workflows/rust.yml#L64-L88
test_other_archs:
# github actions does not support 32-bit or big endian systems directly, but
# it does support QEMU. so we install qemu, then build and run the tests in
# an emulated mips system. NOTE: you can also use this approach to test for
# big endian locally.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [powerpc-unknown-linux-gnu, i686-unknown-linux-gnu]
steps:
- uses: actions/checkout@v4
- name: Install or use cached cross-rs/cross
uses: baptiste0928/cargo-install@v2
with:
crate: cross
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: ${{ matrix.arch }}
- name: Start Docker (required for cross-rs)
run: sudo systemctl start docker
- name: Cross-Run Tests using QEMU
run: cross test --no-fail-fast --target ${{ matrix.arch }} -- --nocapture
fuzz_decoder:
name: Fuzzing Decoder
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-fuzz
- run: cargo fuzz run decoder --no-default-features -- -max_total_time=15 -max_len=512000