name: ci
on:
push:
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Cargo sort
run: cargo install cargo-sort && cargo sort --check --check-format
- name: Format
run: cargo fmt --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v6
- run: sudo apt-get update
- run: sudo apt-get install binutils-dev libunwind-dev gnuplot
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: rustup component add rust-src llvm-tools
- run: cargo install cargo-afl honggfuzz
- name: Install LLVM matching the nightly toolchain (for AFL++ cmplog plugins)
if: ${{ matrix.toolchain == 'nightly' }}
run: |
# afl.rs builds the AFL++ LLVM pass plugins against rustc's embedded
# LLVM, so we need a matching `llvm-config-<major>` on PATH.
LLVM_VERSION=$(rustc --version --verbose | sed -n 's/^LLVM version: \([0-9]*\).*/\1/p')
echo "Nightly toolchain uses LLVM ${LLVM_VERSION}"
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh "${LLVM_VERSION}"
sudo apt-get install -y "llvm-${LLVM_VERSION}-dev" "libclang-${LLVM_VERSION}-dev"
llvm-config-"${LLVM_VERSION}" --version
- if: ${{ matrix.toolchain == 'nightly' }}
run: cargo afl config --plugins --build
- run: cargo install --path . --verbose
- if: ${{ matrix.toolchain == 'stable' }}
run: diff <(awk '/^```$/ && p{exit} p; /^\$ cargo ziggy/{p=1}' README.md) <(cargo ziggy 2>&1)
- run: cargo test --workspace --verbose -- --show-output