name: Fuzz
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
schedule:
- cron: '0 2 * * 6' workflow_dispatch:
env:
CARGO_TERM_COLOR: always
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
fuzz:
name: Fuzz (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [parse_edid, capabilities_static]
steps:
- uses: actions/checkout@v4
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Install cargo-fuzz
run: cargo install --git https://github.com/rust-fuzz/cargo-fuzz --locked
- name: Restore corpus cache
uses: actions/cache@v4
with:
path: fuzz/corpus/${{ matrix.target }}
key: fuzz-corpus-${{ matrix.target }}-${{ github.sha }}
restore-keys: fuzz-corpus-${{ matrix.target }}-
- name: Fuzz (smoke, 60 s) — PRs and pushes
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: cargo +nightly fuzz run ${{ matrix.target }} -- -max_total_time=60
- name: Fuzz (deep, 1 h) — scheduled and manual
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: cargo +nightly fuzz run ${{ matrix.target }} -- -max_total_time=3600
- name: Minimise corpus
if: success() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
run: cargo +nightly fuzz cmin ${{ matrix.target }}
- name: Upload crash artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-crash-${{ matrix.target }}
path: fuzz/artifacts/${{ matrix.target }}/