Repository navigation
117 lines (111 loc) · 3.5 KB
/
Copy pathfuzz.yml
File metadata and controls
117 lines (111 loc) · 3.5 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Fuzz
# Long-running libFuzzer runs of the pure codecs (fuzz/README.md). Never on push or pull
# request: weekly, or by hand with a time per target.
on:
workflow_dispatch:
inputs:
minutes:
description: Minutes to fuzz each target
type: string
default: "10"
targets:
description: Space-separated targets to run (empty runs all of fuzz/fuzz_targets)
type: string
default: ""
schedule:
- cron: "17 3 * * 0"
permissions:
contents: read
concurrency:
group: fuzz
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
plan:
name: choose targets
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
targets: ${{ steps.pick.outputs.targets }}
steps:
- uses: actions/checkout@v4
- id: pick
env:
REQUESTED: ${{ inputs.targets }}
run: |
all=()
for file in fuzz/fuzz_targets/*.rs; do
name=${file##*/}
all+=("${name%.rs}")
done
read -r -a requested <<< "$REQUESTED"
chosen=("${all[@]}")
if [ "${#requested[@]}" -gt 0 ]; then
chosen=()
for name in "${requested[@]}"; do
case " ${all[*]} " in
*" $name "*) chosen+=("$name") ;;
*) echo "::error::unknown fuzz target '$name'"; exit 1 ;;
esac
done
fi
json=$(printf '"%s",' "${chosen[@]}")
echo "targets=[${json%,}]" >> "$GITHUB_OUTPUT"
fuzz:
name: ${{ matrix.target }}
needs: plan
runs-on: ubuntu-latest
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
target: ${{ fromJSON(needs.plan.outputs.targets) }}
env:
MINUTES: ${{ inputs.minutes || '15' }}
defaults:
run:
working-directory: fuzz
steps:
- uses: actions/checkout@v4
# fuzz/rust-toolchain.toml pins the nightly; rustup reads it from this directory.
- name: Nightly toolchain from fuzz/rust-toolchain.toml
run: rustup toolchain install
- name: Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.cargo/bin
fuzz/target
key: cargo-fuzz-${{ hashFiles('fuzz/Cargo.lock', 'fuzz/rust-toolchain.toml') }}
restore-keys: cargo-fuzz-
- name: cargo-fuzz
run: command -v cargo-fuzz || cargo install cargo-fuzz --locked --version 0.13.2
# The working corpus carries over between runs; the seeds in fuzz/corpus are always read.
- name: Restore the working corpus
uses: actions/cache/restore@v4
with:
path: fuzz/work/${{ matrix.target }}
key: fuzz-corpus-${{ matrix.target }}-${{ github.run_id }}
restore-keys: fuzz-corpus-${{ matrix.target }}-
- name: Fuzz
run: ./run.sh "$((MINUTES * 60))" "${{ matrix.target }}"
- name: Save the working corpus
if: always()
uses: actions/cache/save@v4
with:
path: fuzz/work/${{ matrix.target }}
key: fuzz-corpus-${{ matrix.target }}-${{ github.run_id }}
- name: Crash inputs and log
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-${{ matrix.target }}
path: |
fuzz/artifacts/${{ matrix.target }}
fuzz/work/log/${{ matrix.target }}.log
if-no-files-found: warn