fix(ci): merge fuzz build+run into one container so cargo-fuzz persists
All checks were successful
ci / test (push) Successful in 4m46s
ci / sdk (push) Successful in 57s
ci / fuzz (push) Successful in 4m30s

The fuzz job's two CI steps ran in separate Docker containers, so the
cargo-fuzz binary installed in step 1 was gone by step 2: run-fuzz.sh
failed with 'error: no such command: fuzz'. Merge the nightly toolchain
install, cargo-fuzz install, fuzz build, fuzz list, and run-fuzz.sh into
a single container step so the installed binary and built targets survive.

Carry the /target/tmp mkdir from 1b2c63b (rustup self-update needs TMPDIR
to exist before its temp dir creation).
Co-authored-by: agent <agent@local>
This commit is contained in:
agent 2026-09-17 23:10:08 -04:00
commit 99a941b437
No known key found for this signature in database

View file

@ -158,7 +158,7 @@ jobs:
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
- name: nightly toolchain + cargo-fuzz
- name: build + run fuzz targets
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}"
@ -166,37 +166,6 @@ jobs:
docker volume create "$FUZZ_REGISTRY_VOLUME" > /dev/null
docker volume create "$FUZZ_TARGET_VOLUME" > /dev/null
docker rm -f "$FUZZ_BUILD_CONTAINER" > /dev/null 2>&1 || true
docker create --name "$FUZZ_BUILD_CONTAINER" -i \
-e CARGO_TARGET_DIR=/target \
-e CARGO_BUILD_JOBS=2 \
-e CARGO_TERM_COLOR=never \
-e TMPDIR=/target/tmp \
-e RUSTUP_HOME=/usr/local/rustup \
-e CARGO_HOME=/usr/local/cargo \
-v "$FUZZ_REGISTRY_VOLUME":/usr/local/cargo/registry \
-v "$FUZZ_TARGET_VOLUME":/target \
-w /src \
"$RUST_IMAGE" \
sh -euxc 'mkdir -p /src /target/tmp && tar xzf - -C /src && cd /src \
&& apt-get update \
&& apt-get install -y --no-install-recommends pkg-config libssl-dev \
&& rustup toolchain install nightly --profile minimal \
&& rustup default nightly \
&& cargo install cargo-fuzz --locked \
&& export PATH="/usr/local/cargo/bin:$PATH" \
&& cd /src/fuzz \
&& cargo +nightly fuzz build \
&& cargo +nightly fuzz list'
tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees . \
| docker start -a -i "$FUZZ_BUILD_CONTAINER"
- name: run each fuzz target for 15s
run: |
set -euo pipefail
cd "${GITHUB_WORKSPACE}"
docker volume create "$FUZZ_REGISTRY_VOLUME" > /dev/null
docker volume create "$FUZZ_TARGET_VOLUME" > /dev/null
docker rm -f "$FUZZ_BUILD_CONTAINER" > /dev/null 2>&1 || true
docker create --name "$FUZZ_BUILD_CONTAINER" -i \
-e CARGO_TARGET_DIR=/target \
-e CARGO_BUILD_JOBS=2 \
@ -211,8 +180,15 @@ jobs:
-w /src \
"$RUST_IMAGE" \
sh -euxc 'mkdir -p /src /target/tmp && tar xzf - -C /src && cd /src \
&& apt-get update \
&& apt-get install -y --no-install-recommends pkg-config libssl-dev \
&& rustup toolchain install nightly --profile minimal \
&& rustup default nightly \
&& cargo install cargo-fuzz --locked \
&& export PATH="/usr/local/cargo/bin:$PATH" \
&& cd /src/fuzz \
&& cargo +nightly fuzz build \
&& cargo +nightly fuzz list \
&& bash /src/scripts/run-fuzz.sh'
tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees . \
| docker start -a -i "$FUZZ_BUILD_CONTAINER"