Skip to content

Commit d3f9cce

Browse files
committed
ci: run fuzzer regularly
1 parent df3e5c9 commit d3f9cce

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.circleci/config.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
version: 2.1
33

4+
orbs:
5+
slack: circleci/[email protected]
6+
47
commands:
58
rust_components:
69
description: Verify installed components
@@ -370,11 +373,64 @@ jobs:
370373
command: cargo +nightly fuzz build
371374
- cache_save
372375

376+
# Runs fuzzing
377+
run-fuzz:
378+
docker:
379+
- image: quay.io/influxdb/rust:ci
380+
resource_class: xlarge # use of a smaller executor tends crashes on link
381+
environment:
382+
# Disable incremental compilation to avoid overhead. We are not preserving these files anyway.
383+
CARGO_INCREMENTAL: "0"
384+
# Disable full debug symbol generation to speed up CI build
385+
# "1" means line tables only, which is useful for panic tracebacks.
386+
RUSTFLAGS: "-C debuginfo=1"
387+
# https://github.com/rust-lang/cargo/issues/10280
388+
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
389+
steps:
390+
- checkout
391+
- rust_components
392+
- cache_restore
393+
- restore_cache:
394+
name: Restoring artifacts & corpus
395+
keys:
396+
- fuzz-state
397+
- run:
398+
name: Install cargo-fuzz
399+
command: cargo install cargo-fuzz
400+
- run:
401+
name: Install nightly toolchain
402+
command: rustup toolchain install nightly-x86_64-unknown-linux-gnu
403+
- run:
404+
name: Cargo fuzz build
405+
command: cargo +nightly fuzz build
406+
- run:
407+
name: Run fuzzers
408+
command: |
409+
for f in ./fuzz/fuzz_targets/*.rs; do
410+
cargo +nightly fuzz run "$(basename "$f" .rs)" -- -runs=100000
411+
done
412+
- save_cache:
413+
name: Save artifacts & corpus
414+
paths:
415+
- fuzz/artifacts
416+
- fuzz/corpus
417+
key: fuzz-state-{{ epoch }}
418+
when: always
419+
- store_artifacts:
420+
path: fuzz/artifacts
421+
- cache_save
422+
- slack/notify:
423+
event: fail
424+
template: basic_fail_1
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,15 @@ workflows:
386442
- build-all-features
387443
- build-fuzz
388444
- doc
445+
446+
# Run fuzzer every 15mins
447+
fuzz:
448+
triggers:
449+
- schedule:
450+
cron: "*/15 * * * *"
451+
filters:
452+
branches:
453+
only:
454+
- main
455+
jobs:
456+
- run-fuzz

0 commit comments

Comments
 (0)