permissions:
contents: read
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: fuzz
jobs:
fuzz:
runs-on: ubuntu-latest
name: ubuntu / nightly / ${{ matrix.fuzz-target }} / fuzz
strategy:
fail-fast: false
matrix:
fuzz-target: [fuzz_target_1]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
submodules: true
persist-credentials: false
- name: Install nightly
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 with:
components: llvm-tools-preview
toolchain: nightly
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@0005e0116e92d8489d8d96fbff83f061c79ba95a with:
tool: cargo-llvm-cov,rustfilt
- run: cargo install cargo-fuzz
- run: cargo check
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo fuzz
run: |
ls *
cd fuzz
cargo +nightly fuzz run --release ${{ matrix.fuzz-target }} -- -max_total_time=300
- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
- name: Fuzz codecov
run: |
cargo +nightly fuzz coverage --release ${{matrix.fuzz-target}}
$(rustc --print sysroot)/lib/rustlib/$(rustc --print host-tuple)/bin/llvm-cov export -Xdemangler=rustfilt \
target/$(rustc --print host-tuple)/coverage/$(rustc --print host-tuple)/release/${{ matrix.fuzz-target }} \
-instr-profile=fuzz/coverage/${{ matrix.fuzz-target }}/coverage.profdata \
--format=lcov \
-ignore-filename-regex="\.cargo|\.rustup|fuzz_targets" > lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
files: ./lcov.info
fail_ci_if_error: false
flags: ${{ matrix.flags }}
token: ${{ secrets.CODECOV_TOKEN }}
name: fuzz
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f if: failure()
with:
name: fuzzing-artifacts-${{ matrix.fuzz_target }}-${{ github.sha }}
path: fuzz/artifacts