Skip to content

Commit 1166295

Browse files
committed
ci(fuzz): add daily fuzz job
- adds a new daily CI fuzz job, it runs every day at 5am UTC and uploads the artifacts on failures. - it currently only uses the `cargo fuzz`, as it's the only supported harness at the moment.
1 parent e0b6e69 commit 1166295

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/cron_daily_fuzz.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Daily Fuzz
2+
3+
on:
4+
schedule:
5+
- cron: "00 05 * * *" # At 05:00 (UTC) every day.
6+
workflow_dispatch: # allows manual triggering
7+
8+
jobs:
9+
fuzz:
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
# The version of `cargo-fuzz` to install and use.
14+
CARGO_FUZZ_VERSION: 0.13.1
15+
16+
# The number of seconds to run the fuzz target. 1800 seconds = 30 minutes.
17+
FUZZ_TIME: 1800
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- fuzz_target: bdk_wallet
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
persist-credentials: false
30+
31+
- name: Install the nightly Rust channel
32+
uses: actions-rs/toolchain@v1
33+
with:
34+
toolchain: nightly
35+
override: true
36+
PROFILE: minimal
37+
38+
- name: Install and Cache `cargo-fuzz`
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ runner.tool_cache }}/cargo-fuzz
42+
key: cargo-fuzz-bin-${{ env.CARGO_FUZZ_VERSION }}
43+
run: echo "${{ runner.tool_cache }}/cargo-fuzz/bin" >> $GITHUB_PATH
44+
run: cargo install --root "${{ runner.tool_cache }}/cargo-fuzz" --version ${{ env.CARGO_FUZZ_VERSION }} cargo-fuzz --locked
45+
46+
- name: Build & Run Fuzz Target
47+
run: cargo fuzz build ${{ matrix.fuzz_target }}
48+
run: cargo fuzz run ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }}
49+
50+
- name: Upload fuzzing artifacts on failure
51+
uses: actions/upload-artifact@v4
52+
if: failure()
53+
with:
54+
name: fuzzing-artifacts-${{ matrix.fuzz_target }}-${{ github.sha }}
55+
path: fuzz/artifacts
56+
57+
# TODO: add a verify-execution job similar to rust-bitcoin's one

0 commit comments

Comments
 (0)