Repository navigation
56 lines (50 loc) · 1.66 KB
/
Copy pathfuzz.yml
File metadata and controls
56 lines (50 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Fuzz
# The regular test jobs only replay each fuzz target's seed corpus. This
# runs every target for real, weekly and on demand, and keeps the inputs
# that fail as an artifact (#470).
on:
schedule:
- cron: '17 4 * * 1'
workflow_dispatch:
inputs:
fuzztime:
description: How long to fuzz each target (a Go duration)
required: false
default: 60s
permissions:
contents: read
jobs:
fuzz:
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7
with:
go-version: stable
- name: Fuzz every target
shell: bash
env:
FUZZTIME: ${{ inputs.fuzztime || '60s' }}
run: |
set -uo pipefail
failed=0
# Every Fuzz function in every package, found rather than listed, so
# a new target is fuzzed without editing this file.
while read -r file target; do
pkg="./$(dirname "$file")"
echo "::group::$pkg $target"
if ! go test "$pkg" -run '^$' -fuzz "^${target}\$" -fuzztime "$FUZZTIME"; then
echo "::error::$target in $pkg failed"
failed=1
fi
echo "::endgroup::"
done < <(grep -rEo --include='*_test.go' '^func Fuzz[A-Za-z0-9_]+' . | sed -E 's|^\./||; s|:func | |')
exit "$failed"
- name: Keep the failing inputs
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: fuzz-crashers
path: '**/testdata/fuzz/**'
if-no-files-found: ignore