Skip to content

Fuzz Testing

Fuzz Testing #207

Workflow file for this run

name: Fuzz Testing
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 3 * * 1" # Weekly on Monday at 3:00 UTC
# Minimum required permissions
permissions:
contents: read
jobs:
fuzz:
name: Fuzz Tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: "go.mod"
cache: true
- name: Run Fuzz Tests
run: |
# Find all fuzz test functions and run them with a time limit
find . -name "*_test.go" -exec grep -l "func Fuzz" {} \; | while read file; do
dir=$(dirname "$file")
pkg=$(basename "$dir")
echo "Running fuzz tests in $dir..."
cd "$dir"
# Get all fuzz function names
grep -E "^func Fuzz" *.go 2>/dev/null | cut -d'(' -f1 | cut -d' ' -f2 | while read fuzz_func; do
echo " Running $fuzz_func..."
go test -fuzz="$fuzz_func" -fuzztime=30s . || true
done
cd - > /dev/null
done
- name: Upload Fuzz Artifacts
if: failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: fuzz-artifacts
path: |
**/testdata/fuzz/**
retention-days: 7