-
Notifications
You must be signed in to change notification settings - Fork 1
180 lines (165 loc) · 6.64 KB
/
Copy pathfuzz-nightly.yml
File metadata and controls
180 lines (165 loc) · 6.64 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: fuzz (nightly)
on:
schedule:
# 02:00 UTC daily -- off-peak for both US and EU dev mornings.
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
target:
description: "Fuzz target name (or 'all' to run the full matrix)."
required: false
default: all
type: string
duration:
description: "Per-target budget in seconds (default 1800 = 30 minutes)."
required: false
default: "1800"
type: string
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
# Default to read-only; the `fuzz` job opts into `issues: write` for
# auto-issue filing on crash. Scorecard's Token-Permissions check fails
# on workflows that inherit the legacy permissive GITHUB_TOKEN.
permissions:
contents: read
jobs:
fuzz:
name: ${{ matrix.target }}
runs-on: ubuntu-latest
# Hard ceiling above the 30-minute budget, leaving margin for setup,
# cache restore, and artifact upload.
timeout-minutes: 60
permissions:
issues: write
contents: read
strategy:
fail-fast: false
matrix:
target:
- record_decode
- record_roundtrip
- dense_record_decode
- dense_record_roundtrip
- proto_get_ts_request_decode
- proto_get_ts_response_decode
- proto_leader_hint_decode
- log_entry_decode
- snapshot_payload_decode
- toolkit_codec_decode
- openraft_entry_decode
- openraft_meta_decode
- openraft_advance_dense_batch_decode
- openraft_set_leases_decode
- codec_roundtrip
- paxos_log_entry_decode
- paxos_snapshot_decode
- paxos_meta_ballot_decode
- paxos_codec_roundtrip
steps:
# cargo-fuzz compiles the whole dependency tree (rocksdb included) with
# ASAN instrumentation, so the artifacts are large. Reclaim ~30 GB before
# cargo starts; tool-cache: false keeps the runner tool cache (where
# cargo-fuzz is installed) intact.
- name: free disk space
uses: jlumbroso/free-disk-space@ceedf095f4ec1a097402bc6bd80831f2e1a6fde6 # v2.0.0
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Skip non-matching target (manual dispatch)
# When dispatched manually with a specific target, all other matrix
# legs become no-ops. Cheaper than disabling the matrix.
if: |
github.event_name == 'workflow_dispatch' &&
github.event.inputs.target != 'all' &&
github.event.inputs.target != matrix.target
env:
MATRIX_TARGET: ${{ matrix.target }}
REQUESTED_TARGET: ${{ github.event.inputs.target }}
run: |
echo "Skipping $MATRIX_TARGET (workflow_dispatch requested $REQUESTED_TARGET)"
exit 0
- name: Install pinned nightly toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: nightly-2026-03-31
components: rust-src, llvm-tools-preview
- name: Install protoc
timeout-minutes: 5
uses: awalsh128/cache-apt-pkgs-action@553a35bb8ebd9fcabcb1c9451aa4c98e1b4ca8a9 # v1.6.3
with:
packages: protobuf-compiler
version: 1
- name: Install cargo-fuzz
uses: taiki-e/install-action@83ac0ad63c0167e6f06796fab0fce28db1bf3db0 # v2.87.22
with:
tool: cargo-fuzz@0.13.1
- name: Restore working corpus
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: fuzz/corpus/${{ matrix.target }}
key: fuzz-corpus-${{ matrix.target }}-${{ hashFiles('fuzz/Cargo.lock', format('fuzz/fuzz_targets/{0}.rs', matrix.target)) }}-${{ github.run_id }}
restore-keys: |
fuzz-corpus-${{ matrix.target }}-${{ hashFiles('fuzz/Cargo.lock', format('fuzz/fuzz_targets/{0}.rs', matrix.target)) }}-
fuzz-corpus-${{ matrix.target }}-
- name: Determine budget
id: budget
env:
REQUESTED_DURATION: ${{ github.event.inputs.duration }}
EVENT_NAME: ${{ github.event_name }}
run: |
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
echo "seconds=${REQUESTED_DURATION}" >> "$GITHUB_OUTPUT"
else
echo "seconds=1800" >> "$GITHUB_OUTPUT"
fi
- name: Run fuzz target
id: fuzz
working-directory: fuzz
# --target x86_64-unknown-linux-gnu overrides cargo-fuzz 0.13's
# default of x86_64-unknown-linux-musl on Linux. The musl default
# links libc statically, which is incompatible with ASAN. See the
# matching comment in fuzz-pr.yml for the full explanation.
env:
TARGET: ${{ matrix.target }}
BUDGET: ${{ steps.budget.outputs.seconds }}
run: |
set +e
cargo fuzz run "$TARGET" \
--sanitizer address \
--target x86_64-unknown-linux-gnu \
-- -max_total_time="$BUDGET" \
2>&1 | tee fuzz-output.log
EXIT=${PIPESTATUS[0]}
echo "exit_code=${EXIT}" >> "$GITHUB_OUTPUT"
exit "$EXIT"
- name: Upload crash artifact
if: failure() && steps.fuzz.outputs.exit_code != '0'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: fuzz-crash-${{ matrix.target }}-${{ github.run_id }}
path: fuzz/artifacts/${{ matrix.target }}/
retention-days: 30
if-no-files-found: warn
- name: Auto-file deduplicated issue
# Schedule and workflow_dispatch always run with full GITHUB_TOKEN
# permissions in the base repo's context -- no fork-PR gate needed
# here (unlike fuzz-pr.yml).
if: failure() && steps.fuzz.outputs.exit_code != '0'
uses: ./.github/actions/fuzz-auto-issue
with:
target: ${{ matrix.target }}
libfuzzer-output: fuzz/fuzz-output.log
artifact-name: fuzz-crash-${{ matrix.target }}-${{ github.run_id }}
run-id: ${{ github.run_id }}
- name: Save working corpus (even on failure)
if: always()
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: fuzz/corpus/${{ matrix.target }}
key: fuzz-corpus-${{ matrix.target }}-${{ hashFiles('fuzz/Cargo.lock', format('fuzz/fuzz_targets/{0}.rs', matrix.target)) }}-${{ github.run_id }}