@@ -298,9 +298,54 @@ jobs:
298298 name : Build WASM package with wasm-pack
299299 run : wasm-pack build --target web --no-default-features --features alloc,panic-handler
300300
301+ fuzz-test :
302+ name : Fuzz Testing
303+ needs : check-previous-run
304+ if : needs.check-previous-run.outputs.should_skip != 'true'
305+ runs-on : ${{ matrix.os }}
306+ strategy :
307+ fail-fast : false
308+ matrix :
309+ os : [ubuntu-24.04, ubuntu-24.04-arm]
310+ fuzz-target :
311+ - digest_crc32_autosar
312+ - digest_crc32_bzip2
313+ - digest_crc32_iscsi
314+ - digest_crc32_iso_hdlc
315+ - digest_crc64_ecma_182
316+ - digest_crc64_nvme
317+ - checksum_crc32_autosar
318+ - checksum_crc32_bzip2
319+ - checksum_crc32_iscsi
320+ - checksum_crc32_iso_hdlc
321+ - checksum_crc64_ecma_182
322+ - checksum_crc64_nvme
323+ steps :
324+ - uses : actions/checkout@v4 # not pinning to commit hash since this is a GitHub action, which we trust
325+ - uses : actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 # v1.12.0
326+ with :
327+ toolchain : nightly
328+ cache-key : ${{ matrix.os }}-nightly-fuzz
329+ - name : Install cargo-fuzz
330+ run : cargo install cargo-fuzz
331+ - name : Run fuzzer
332+ run : |
333+ cargo fuzz run ${{ matrix.fuzz-target }} -- \
334+ -max_total_time=60 \
335+ -rss_limit_mb=2048 \
336+ -timeout=10 \
337+ -print_final_stats=1
338+ continue-on-error : true
339+ - name : Upload artifacts on crash
340+ if : failure()
341+ uses : actions/upload-artifact@v4
342+ with :
343+ name : fuzz-artifacts-${{ matrix.os }}-${{ matrix.fuzz-target }}
344+ path : fuzz/artifacts/${{ matrix.fuzz-target }}/
345+
301346 tests-complete :
302347 name : All tests complete
303- needs : [check-previous-run, test-aarch64, test-x86_64, test-x86-linux, test-x86-windows, test-software, miri-test-x86_64, test-no-std, test-wasm]
348+ needs : [check-previous-run, test-aarch64, test-x86_64, test-x86-linux, test-x86-windows, test-software, miri-test-x86_64, test-no-std, test-wasm, fuzz-test ]
304349 if : always()
305350 runs-on : ubuntu-latest
306351 steps :
@@ -323,7 +368,8 @@ jobs:
323368 [ "${{ needs.test-software.result }}" == "failure" ] || \
324369 [ "${{ needs.miri-test-x86_64.result }}" == "failure" ] || \
325370 [ "${{ needs.test-no-std.result }}" == "failure" ] || \
326- [ "${{ needs.test-wasm.result }}" == "failure" ]; then
371+ [ "${{ needs.test-wasm.result }}" == "failure" ] || \
372+ [ "${{ needs.fuzz-test.result }}" == "failure" ]; then
327373 echo "✗ One or more test jobs failed"
328374 exit 1
329375 fi
0 commit comments