Debian Codegraph @

.github/workflows/fuzz.yml

raw symbols SCIP
1 name: Fuzz
2 on:
3 schedule:
4 - cron: "0 3 */3 * *"
5 workflow_dispatch:
6
7 permissions:
8 contents: read
9
10 jobs:
11 fuzz:
12 runs-on: ubuntu-latest
13 steps:
14 - name: Checkout code
15 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
16 with:
17 persist-credentials: false
18 - name: Install Go
19 uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
20 with:
21 go-version: 'stable'
22 # Cache interesting fuzzing inputs so subsequential fuzz runs
23 # don't start from zero.
24 - name: Locate fuzz cache
25 run: echo "GOFUZZCACHE=$(go env GOCACHE)/fuzz" >> "$GITHUB_ENV"
26 - name: Restore fuzz corpus
27 uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
28 with:
29 path: ${{ env.GOFUZZCACHE }}
30 # The key is unique per run so a fresh cache is always saved; restore-keys
31 # falls back to the most recent corpus from a previous run.
32 key: fuzz-${{ runner.os }}-${{ github.run_id }}
33 restore-keys: |
34 fuzz-${{ runner.os }}-
35 # 2m per target is chosen so that roughly half of the 2000 free CI minutes
36 # offered by Github will be used each month. The other half is reserved for
37 # tests in PRs. Keep an eye on the total run time when adding fuzz targets.
38 - name: Run all fuzz tests
39 run: |
40 for pkg in $(go list ./...); do
41 for target in $(go test -list '^Fuzz' "$pkg" | grep '^Fuzz' || true); do
42 echo "=== fuzzing $target in $pkg for 64bit ==="
43 go test -fuzztime=3m -fuzz="^${target}\$" "$pkg"
44 echo "=== fuzzing $target in $pkg for 32bit ==="
45 GOARCH=386 go test -fuzztime=1m -fuzz="^${target}\$" "$pkg"
46 done
47 done
48
49 - name: Save fuzz corpus
50 if: always()
51 uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
52 with:
53 path: ${{ env.GOFUZZCACHE }}
54 key: fuzz-${{ runner.os }}-${{ github.run_id }}