Skip to content

Commit 15ee9be

Browse files
committed
ci: fix fuzz jobs - use nightly toolchain and fail on build errors
cargo-fuzz requires nightly Rust due to -Zsanitizer=address flag. The previous config used stable 1.85 which silently failed (masked by || true). Changes: - Switch fuzz jobs to dtolnay/rust-toolchain@nightly - Add explicit cargo fuzz build step to fail fast on compile errors - Replace || true with || [ $? -eq 124 ] to allow timeout but catch real failures - Update cache keys to include 'nightly' for separation
1 parent 74bc99f commit 15ee9be

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

.github/workflows/security.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ jobs:
9393
uses: actions/checkout@v4
9494

9595
- name: Install Rust toolchain
96-
uses: dtolnay/rust-toolchain@stable
97-
with:
98-
toolchain: "1.85"
96+
uses: dtolnay/rust-toolchain@nightly
9997

10098
- name: Cache Rust dependencies
10199
uses: actions/cache@v4
@@ -105,9 +103,9 @@ jobs:
105103
~/.cargo/registry/cache/
106104
~/.cargo/git/db/
107105
fuzz/target/
108-
key: ${{ runner.os }}-cargo-fuzz-${{ hashFiles('**/Cargo.lock') }}
106+
key: ${{ runner.os }}-cargo-fuzz-nightly-${{ hashFiles('**/Cargo.lock') }}
109107
restore-keys: |
110-
${{ runner.os }}-cargo-fuzz-
108+
${{ runner.os }}-cargo-fuzz-nightly-
111109
${{ runner.os }}-cargo-
112110
113111
- name: Install cargo-fuzz
@@ -116,7 +114,10 @@ jobs:
116114
- name: Run quick fuzz (corpus only)
117115
run: |
118116
cd fuzz
119-
timeout 120 cargo fuzz run ${{ matrix.target }} -- -runs=0 -max_total_time=120 || true
117+
# Build first - fail fast on compile errors
118+
cargo fuzz build ${{ matrix.target }}
119+
# Run corpus - timeout exit code 124 is acceptable (means it ran)
120+
timeout 120 cargo fuzz run ${{ matrix.target }} -- -runs=0 -max_total_time=120 || [ $? -eq 124 ]
120121
121122
deep-fuzz:
122123
name: Deep Fuzzing (8 hours)
@@ -147,9 +148,7 @@ jobs:
147148
uses: actions/checkout@v4
148149

149150
- name: Install Rust toolchain
150-
uses: dtolnay/rust-toolchain@stable
151-
with:
152-
toolchain: "1.85"
151+
uses: dtolnay/rust-toolchain@nightly
153152

154153
- name: Cache Rust dependencies
155154
uses: actions/cache@v4
@@ -159,9 +158,9 @@ jobs:
159158
~/.cargo/registry/cache/
160159
~/.cargo/git/db/
161160
fuzz/target/
162-
key: ${{ runner.os }}-cargo-fuzz-${{ hashFiles('**/Cargo.lock') }}
161+
key: ${{ runner.os }}-cargo-fuzz-nightly-${{ hashFiles('**/Cargo.lock') }}
163162
restore-keys: |
164-
${{ runner.os }}-cargo-fuzz-
163+
${{ runner.os }}-cargo-fuzz-nightly-
165164
${{ runner.os }}-cargo-
166165
167166
- name: Install cargo-fuzz
@@ -170,7 +169,10 @@ jobs:
170169
- name: Run deep fuzz (30 minutes per target)
171170
run: |
172171
cd fuzz
173-
timeout 1800 cargo fuzz run ${{ matrix.target }} -- -max_total_time=1800 || true
172+
# Build first - fail fast on compile errors
173+
cargo fuzz build ${{ matrix.target }}
174+
# Run fuzz - timeout exit code 124 is acceptable (means it ran the full duration)
175+
timeout 1800 cargo fuzz run ${{ matrix.target }} -- -max_total_time=1800 || [ $? -eq 124 ]
174176
175177
- name: Upload crash artifacts
176178
if: always()

0 commit comments

Comments
 (0)