Merge pull request #154 from dev-five-git/changepacks/main #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: fuzz | |
| on: | |
| # push: main — the ONLY auto-trigger. Each commit gets a fresh `github.sha` | |
| # cache key, so libfuzzer's discovered corpus actually persists across runs | |
| # (via the `restore-keys` prefix fallback). Path-filtered to skip docs-only | |
| # or workflow-unrelated commits. | |
| # | |
| # No schedule cron: actions/cache is immutable per key, so scheduled runs | |
| # on an unchanged SHA cannot save the corpus they discover — pure runtime | |
| # cost with zero persistent benefit. For deep-fuzz sessions, use | |
| # workflow_dispatch with a larger `duration_seconds` value. | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'crates/**/*.rs' | |
| - 'crates/**/Cargo.toml' | |
| - 'fuzz/**' | |
| - '.github/workflows/fuzz.yml' | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: 'Single fuzz target name (default: all)' | |
| default: 'all' | |
| duration_seconds: | |
| description: 'Per-target fuzz duration in seconds' | |
| default: '300' | |
| jobs: | |
| fuzz: | |
| name: cargo-fuzz | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - fuzz_model_deser | |
| - fuzz_sql_identifier | |
| - fuzz_migration_apply | |
| - fuzz_lsp_request | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| - uses: taiki-e/install-action@v2.81.6 | |
| with: | |
| tool: cargo-fuzz | |
| - name: Cache corpus | |
| uses: actions/cache@v5 | |
| with: | |
| path: fuzz/corpus/${{ matrix.target }} | |
| key: fuzz-corpus-${{ matrix.target }}-${{ github.sha }} | |
| restore-keys: | | |
| fuzz-corpus-${{ matrix.target }}- | |
| - name: Run cargo-fuzz (${{ matrix.target }}, 300s) | |
| run: | | |
| cd fuzz | |
| cargo +nightly fuzz run ${{ matrix.target }} \ | |
| -- -max_total_time=300 -max_len=4096 | |
| - name: Upload crash artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fuzz-artifacts-${{ matrix.target }} | |
| path: fuzz/artifacts/${{ matrix.target }}/ | |
| - name: Upload corpus | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fuzz-corpus-${{ matrix.target }} | |
| path: fuzz/corpus/${{ matrix.target }}/ |