Skip to content

Commit 27e06b1

Browse files
committed
Run fuzz test in CI
1 parent 3c072a1 commit 27e06b1

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,43 @@ jobs:
7575
run: cargo test
7676
env:
7777
RUST_BACKTRACE: 1
78+
79+
fuzz:
80+
name: Fuzz Testing
81+
runs-on: ubuntu-latest
82+
env:
83+
CARGO_FUZZ_VERSION: 0.12.0
84+
FUZZ_TIME: 300
85+
strategy:
86+
matrix:
87+
fuzz_target:
88+
- soavec_api
89+
steps:
90+
- uses: actions/checkout@v5
91+
- name: Install Rust nightly toolchain
92+
uses: dtolnay/rust-toolchain@nightly
93+
with:
94+
toolchain: nightly
95+
- name: Cache cargo-fuzz
96+
uses: actions/cache@v4
97+
with:
98+
path: ${{ runner.tool_cache }}/cargo-fuzz
99+
key: cargo-fuzz-bin-${{ env.CARGO_FUZZ_VERSION }}
100+
- name: Add cargo-fuzz to PATH
101+
run: echo "${{ runner.tool_cache }}/cargo-fuzz/bin" >> $GITHUB_PATH
102+
- name: Install cargo-fuzz
103+
run: cargo install --root "${{ runner.tool_cache }}/cargo-fuzz" --version ${{ env.CARGO_FUZZ_VERSION }} cargo-fuzz --locked
104+
- name: Cache on ${{ github.ref_name }}
105+
uses: Swatinem/rust-cache@v2
106+
with:
107+
shared-key: warm
108+
- name: Build fuzz target
109+
run: cargo +nightly fuzz build ${{ matrix.fuzz_target }}
110+
- name: Run fuzz target
111+
run: cargo +nightly fuzz run ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }}
112+
- name: Upload fuzzing artifacts
113+
uses: actions/upload-artifact@v4
114+
if: failure()
115+
with:
116+
name: fuzzing-artifacts-${{ matrix.fuzz_target }}-${{ github.sha }}
117+
path: fuzz/artifacts

0 commit comments

Comments
 (0)