Skip to content

Commit 5c0adbd

Browse files
committed
add fuzzer codecov job
1 parent 9a82ff9 commit 5c0adbd

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+
flags: fuzz-packet_parsing_sound
283+
- fuzz_target: record_encode_decode
284+
corpus: ""
285+
features: ''
286+
flags: fuzz-packet_parsing_sound
287+
steps:
288+
- name: Checkout sources
289+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
290+
with:
291+
persist-credentials: false
292+
- name: Install nightly toolchain
293+
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
294+
with:
295+
toolchain: nightly
296+
components: llvm-tools-preview
297+
- name: Install cargo fuzz & rustfilt
298+
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
299+
with:
300+
tool: cargo-fuzz,rustfilt
301+
- name: Run `cargo fuzz`
302+
env:
303+
RUST_BACKTRACE: "1"
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: ${{ matrix.flags }}
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)