Skip to content

Commit c9beefe

Browse files
committed
ci: run fuzzer regularly
1 parent b0852fd commit c9beefe

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.circleci/config.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,67 @@ jobs:
370370
command: cargo +nightly fuzz build
371371
- cache_save
372372

373+
# Runs fuzzing
374+
run-fuzz:
375+
docker:
376+
- image: quay.io/influxdb/rust:ci
377+
resource_class: xlarge # use of a smaller executor tends crashes on link
378+
environment:
379+
# Disable incremental compilation to avoid overhead. We are not preserving these files anyway.
380+
CARGO_INCREMENTAL: "0"
381+
# Disable full debug symbol generation to speed up CI build
382+
# "1" means line tables only, which is useful for panic tracebacks.
383+
RUSTFLAGS: "-C debuginfo=1"
384+
# https://github.com/rust-lang/cargo/issues/10280
385+
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
386+
steps:
387+
- checkout
388+
- rust_components
389+
- cache_restore
390+
- restore_cache:
391+
name: Restoring artifacts & corpus
392+
keys:
393+
- fuzz-corpus
394+
- run:
395+
name: Install cargo-fuzz
396+
command: cargo install cargo-fuzz
397+
- run:
398+
name: Install nightly toolchain
399+
command: rustup toolchain install nightly-x86_64-unknown-linux-gnu
400+
- run:
401+
name: Cargo fuzz build
402+
command: cargo +nightly fuzz build
403+
- run:
404+
name: Run fuzzers
405+
command: |
406+
for f in ./fuzz/fuzz_targets/*.rs; do
407+
cargo +nightly fuzz run "$(basename "$f" .rs)" -- -runs=100000
408+
done
409+
- save_cache:
410+
name: Save artifacts & corpus
411+
paths:
412+
- fuzz/artifacts
413+
- fuzz/corpus
414+
key: fuzz-corpus-{{ epoch }}
415+
when: always
416+
- store_artifacts:
417+
path: fuzz/artifacts
418+
- cache_save
419+
420+
parameters:
421+
fuzz:
422+
description: Run fuzzing job
423+
type: boolean
424+
default: false
425+
373426
workflows:
374427
version: 2
375428

376429
# CI for all pull requests.
377430
ci:
431+
when:
432+
and:
433+
- not: << pipeline.parameters.fuzz >>
378434
jobs:
379435
- fmt
380436
- lint
@@ -386,3 +442,16 @@ workflows:
386442
- build-all-features
387443
- build-fuzz
388444
- doc
445+
446+
# Run fuzzer every 15mins
447+
fuzz:
448+
when: << pipeline.parameters.fuzz >>
449+
# triggers:
450+
# - schedule:
451+
# cron: "*/15 * * * *"
452+
# filters:
453+
# branches:
454+
# only:
455+
# - main
456+
jobs:
457+
- run-fuzz

0 commit comments

Comments
 (0)