Files
protocol-rs/.github/workflows/ci.yml
T
swaits da9249446c ci: pin fuzz jobs to x86_64-unknown-linux-gnu
cargo-fuzz defaults to x86_64-unknown-linux-musl on Linux so ASAN can
statically link, but dtolnay/rust-toolchain@nightly doesn't ship a
musl std and GH runners don't have it preinstalled — build failed with
'can't find crate for core' on byteorder. Pinning both fuzz build and
fuzz run to the gnu target uses the std that comes with the toolchain
and works out of the box.
2026-04-13 14:07:24 -06:00

165 lines
4.7 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test (${{ matrix.features }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- default
- no-default-features
- all-features
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: nextest
- name: cargo nextest run
run: |
case "${{ matrix.features }}" in
default) cargo nextest run ;;
no-default-features) cargo nextest run --no-default-features ;;
all-features) cargo nextest run --all-features ;;
esac
- name: cargo test --doc
run: cargo test --doc
clippy:
name: Clippy (${{ matrix.features }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- default
- no-default-features
- all-features
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: cargo clippy
run: |
case "${{ matrix.features }}" in
default) cargo clippy --all-targets -- -D warnings ;;
no-default-features) cargo clippy --all-targets --no-default-features -- -D warnings ;;
all-features) cargo clippy --all-targets --all-features -- -D warnings ;;
esac
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt -- --check
doc:
name: Doc
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo doc --no-deps --all-features
deny:
name: Cargo Deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
miri:
name: Miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: miri
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: nextest
- run: cargo +nightly miri nextest run --lib --test vectors
- run: cargo +nightly miri nextest run --lib --test vectors --no-default-features
fuzz:
name: Fuzz (60s per target)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
fuzz
- uses: taiki-e/install-action@v2
with:
tool: cargo-fuzz
- name: Build fuzz targets
working-directory: fuzz
# Pin to the gnu target — cargo-fuzz defaults to musl for ASAN
# static linking, but the nightly toolchain we install doesn't
# ship a musl std.
run: cargo +nightly fuzz build --target x86_64-unknown-linux-gnu
- name: Smoke-run every target
working-directory: fuzz
run: |
for target in parse_command parse_radio_config cobs_decoder_feed cobs_roundtrip command_roundtrip cobs_decoder_multi_frame cobs_chunk_invariant; do
echo "── $target ──"
cargo +nightly fuzz run "$target" --target x86_64-unknown-linux-gnu -- -max_total_time=60
done
mutants:
name: Mutants
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- default
- no-default-features
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-mutants, nextest
- name: cargo mutants (${{ matrix.features }})
run: |
extra=""
[ "${{ matrix.features }}" = "no-default-features" ] && extra="--no-default-features"
cargo mutants --no-shuffle --test-tool=nextest $extra \
-E 'replace > with >= in Command::from_bytes' \
-E 'replace > with >= in CobsDecoder::feed' \
-E 'replace < with <= in cobs_encode_response'
- name: Upload mutants.out on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: mutants-${{ matrix.features }}
path: mutants.out