name: Fuzz
on:
push:
branches: [main]
paths:
- 'src/**'
- 'fuzz/**'
- '.github/workflows/fuzz.yml'
- '.github/actions/**'
pull_request:
branches: [main]
paths:
- 'src/**'
- 'fuzz/**'
- '.github/workflows/fuzz.yml'
- '.github/actions/**'
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
duration_seconds:
description: 'Per-target fuzz duration (seconds)'
required: false
default: '60'
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
fuzz:
name: Fuzz — ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- fuzz_step
- fuzz_collision
- fuzz_deterministic_roundtrip
- fuzz_step_parity
steps:
- uses: actions/checkout@v5
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
workspaces: fuzz
- name: Create ALICE optional bridge stubs
uses: ./.github/actions/alice-stubs
- name: Install cargo-fuzz
run: cargo install cargo-fuzz --locked
- name: Build fuzz target
run: |
cd fuzz
cargo +nightly fuzz build "${{ matrix.target }}"
- name: Set fuzz duration
id: dur
run: |
DURATION="${{ github.event.inputs.duration_seconds }}"
if [ -z "$DURATION" ]; then
DURATION=60
fi
echo "seconds=$DURATION" >> "$GITHUB_OUTPUT"
- name: Run fuzz target (time-boxed)
id: run
continue-on-error: true
run: |
cd fuzz
cargo +nightly fuzz run "${{ matrix.target }}" -- \
-max_total_time=${{ steps.dur.outputs.seconds }}
- name: Upload crash artifacts (if any)
if: steps.run.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: fuzz-crash-${{ matrix.target }}
path: fuzz/artifacts/${{ matrix.target }}
if-no-files-found: ignore
retention-days: 14
- name: Report crash (informational)
if: steps.run.outcome == 'failure'
run: echo "::warning::fuzz target ${{ matrix.target }} found a crash — see fuzz-crash-${{ matrix.target }} artifact"