Skip to content

Commit 148689b

Browse files
committed
add fuzzer codecov job
1 parent 4dc443f commit 148689b

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/checks.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,56 @@ jobs:
270270
cargo fuzz run ${{ matrix.features }} $target -- -max_total_time=10
271271
done
272272
273+
fuzz-code-coverage:
274+
name: Fuzz with code coverage
275+
runs-on: ubuntu-latest
276+
strategy:
277+
matrix:
278+
include:
279+
- fuzz_target: packet_parsing_sound
280+
corpus: ""
281+
features: ''
282+
- fuzz_target: record_encode_decode
283+
corpus: ""
284+
features: ''
285+
steps:
286+
- name: Checkout sources
287+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
288+
with:
289+
persist-credentials: false
290+
- name: Install nightly toolchain
291+
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
292+
with:
293+
toolchain: nightly
294+
components: llvm-tools-preview
295+
- name: Install cargo fuzz & rustfilt
296+
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
297+
with:
298+
tool: cargo-fuzz,rustfilt
299+
- name: Run `cargo fuzz`
300+
env:
301+
RUST_BACKTRACE: "1"
302+
# prevents `cargo fuzz coverage` from rebuilding everything
303+
RUSTFLAGS: "-C instrument-coverage"
304+
run: |
305+
cargo fuzz run ${{matrix.features}} ${{matrix.fuzz_target}} ${{matrix.corpus}} -- -max_total_time=10
306+
- name: Fuzz codecov
307+
run: |
308+
cargo fuzz coverage ${{matrix.features}} ${{matrix.fuzz_target}} ${{matrix.corpus}}
309+
$(rustc --print sysroot)/lib/rustlib/$(rustc --print host-tuple)/bin/llvm-cov export -Xdemangler=rustfilt \
310+
target/$(rustc --print host-tuple)/coverage/$(rustc --print host-tuple)/release/${{matrix.fuzz_target}} \
311+
-instr-profile=fuzz/coverage/${{matrix.fuzz_target}}/coverage.profdata \
312+
--format=lcov \
313+
-ignore-filename-regex="\.cargo|\.rustup" > lcov.info
314+
- name: Upload coverage to Codecov
315+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
316+
with:
317+
files: ./lcov.info
318+
fail_ci_if_error: false
319+
flags: fuzz-${{ matrix.fuzz_target }}
320+
token: ${{ secrets.CODECOV_TOKEN }}
321+
name: fuzz
322+
273323
audit-dependencies:
274324
name: Audit dependencies
275325
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)