Skip to content

Fuzz-test crate

Fuzz-test crate #214

Workflow file for this run

name: Fuzz-test crate
on:
workflow_dispatch:
schedule:
# run once a day at 12:00 UTC
- cron: '0 12 * * *'
jobs:
test:
name: Build and test crate
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
rust:
- stable
- beta
- nightly
- 1.81.0 # MSRV
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Rust toolchain with rustup
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
targets: thumbv6m-none-eabi
- name: Use cache
uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: cargo build
run: cargo build --all-features
- name: cargo build for non_std
run: cargo build --target thumbv6m-none-eabi --features bincode,borsh,bytemuck,postcard,rkyv,rkyv-safe,serde
- name: cargo test with no features
run: cargo test
- name: cargo test with all features
run: cargo test --all-features
- name: cargo miri test with all features
if: ${{ matrix.rust == 'nightly' }}
run: |
rustup +nightly component add miri
cargo +nightly miri test --all-features
lint:
name: Lint crate (stable)
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Rust toolchain with rustup
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: clippy
targets: thumbv6m-none-eabi
- name: Use cache
uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: cargo clippy
run: cargo clippy --all-features
fuzzing:
name: Fuzz-testing crate (nightly)
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
target:
- addition
- increment
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Rust toolchain with rustup
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: rustfmt, clippy
targets: thumbv6m-none-eabi
- name: Use cache
uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: cargo fuzz
run: cargo fuzz run ${{ matrix.target }} -- -runs=16777216