Fuzz testing #123
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 testing | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "src/parsers/**" | |
| - "fuzz/**" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "src/parsers/**" | |
| - "fuzz/**" | |
| schedule: | |
| - cron: "0 3 * * 1" # Monday 03:00 UTC | |
| workflow_dispatch: | |
| permissions: read-all | |
| env: | |
| CARGO_TERM_COLOR: always | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| fuzz: | |
| name: Fuzz ${{ matrix.target }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - fuzz_parse_sbom | |
| - fuzz_cyclonedx_json | |
| - fuzz_cyclonedx_xml | |
| - fuzz_spdx_json | |
| - fuzz_spdx_tagvalue | |
| - fuzz_detect_format | |
| - fuzz_score_sbom | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| persist-credentials: false | |
| - name: Install nightly toolchain | |
| uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master | |
| with: | |
| toolchain: nightly | |
| - name: Cache cargo registry and build | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| with: | |
| workspaces: fuzz -> target | |
| key: fuzz-${{ matrix.target }} | |
| - name: Install cargo-fuzz | |
| run: cargo +nightly install cargo-fuzz --locked | |
| - name: Run fuzzer | |
| run: | | |
| cargo +nightly fuzz run ${{ matrix.target }} -- \ | |
| -max_total_time=120 \ | |
| -seed_inputs=fuzz/corpus/seed/* |