name: Fuzz Testing
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
inputs:
fuzz_duration:
description: "Fuzzing duration in seconds per target"
required: false
default: "120"
env:
CARGO_TERM_COLOR: always
jobs:
fuzz:
name: Fuzz Testing
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- roundtrip
- simd_scalar_equivalence
- valid_iupac
- decode_robust
- boundaries
- bit_rotation
- reverse_complement
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: llvm-tools-preview
override: true
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: Cache fuzz corpus
uses: actions/cache@v4
with:
path: fuzz/corpus/${{ matrix.target }}
key: fuzz-corpus-${{ matrix.target }}-${{ github.sha }}
restore-keys: |
fuzz-corpus-${{ matrix.target }}-
- name: Run fuzzer - ${{ matrix.target }}
run: |
DURATION=${{ github.event.inputs.fuzz_duration || (github.event_name == 'schedule' && '600' || '60') }}
echo "Running fuzzer for $DURATION seconds..."
cargo +nightly fuzz run ${{ matrix.target }} -- \
-max_total_time=$DURATION \
-rss_limit_mb=4096
- name: Upload crash artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: crash-${{ matrix.target }}
path: |
fuzz/artifacts/${{ matrix.target }}/*
if-no-files-found: ignore
- name: Upload corpus
if: always()
uses: actions/upload-artifact@v4
with:
name: corpus-${{ matrix.target }}
path: fuzz/corpus/${{ matrix.target }}
if-no-files-found: ignore