Skip to content

Remove accumulated work history and consolidate project guides (#525) #556

Remove accumulated work history and consolidate project guides (#525)

Remove accumulated work history and consolidate project guides (#525) #556

Workflow file for this run

name: Fuzz tests
on:
pull_request:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "crates/**"
- "fuzz/**"
- "scripts/run_fuzz_campaign.py"
- "scripts/tests/test_fuzz_campaign.py"
- ".github/workflows/fuzz.yml"
push:
branches: [main]
workflow_dispatch:
schedule:
- cron: "43 2 * * *"
permissions:
contents: read
concurrency:
group: fuzz-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
smoke:
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
runs-on: ${{ github.repository_owner == 'astral-sh' && 'github-ubuntu-24.04-x86_64-4' || 'ubuntu-24.04' }}
timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0
with:
toolchain: nightly-2026-09-07
- run: cargo install cargo-fuzz --version 0.13.2 --locked
- run: python3 -m unittest discover -s scripts/tests -p test_fuzz_campaign.py
- name: Exercise each boundary
shell: bash
run: |
set -euo pipefail
mkdir -p fuzz/logs
for fuzz_target in parser preprocess semantic bindings checked; do
mkdir -p "fuzz/corpus/$fuzz_target"
seed_extension=h
if [[ "$fuzz_target" == parser ]]; then
seed_extension=c
fi
cp "fuzz/seeds/$fuzz_target/"*."$seed_extension" "fuzz/corpus/$fuzz_target/"
max_length=16384
if [[ "$fuzz_target" == bindings ]]; then
max_length=8192
fi
cargo fuzz run "$fuzz_target" "fuzz/corpus/$fuzz_target" -- \
-dict=fuzz/c.dict -max_len="$max_length" -len_control=0 \
-max_total_time=60 -timeout=5 -rss_limit_mb=1024 -print_final_stats=1 \
2>&1 | tee "fuzz/logs/$fuzz_target.log"
done
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
if: always()
with:
name: fuzz-evidence
path: |
fuzz/logs/
fuzz/artifacts/
if-no-files-found: warn
retention-days: 14
campaign:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
target: [parser, preprocess, semantic, bindings, checked]
runs-on: ${{ github.repository_owner == 'astral-sh' && 'github-ubuntu-24.04-x86_64-4' || 'ubuntu-24.04' }}
timeout-minutes: 45
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0
with:
toolchain: nightly-2026-09-07
- run: cargo install cargo-fuzz --version 0.13.2 --locked
- uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: fuzz/corpus/${{ matrix.target }}
key: fuzz-corpus-v1-${{ matrix.target }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: fuzz-corpus-v1-${{ matrix.target }}-
- name: Run a fifteen-minute campaign
env:
FUZZ_TARGET: ${{ matrix.target }}
FUZZ_SEED: ${{ github.run_number }}
run: python3 scripts/run_fuzz_campaign.py "$FUZZ_TARGET" --seconds 900 --seed "$FUZZ_SEED" --output "fuzz/runs/$FUZZ_TARGET"
- name: Check the compiled profile selector
if: contains(fromJSON('["semantic", "bindings", "checked"]'), matrix.target)
env:
TOUCAN_FUZZ_BINARY: fuzz/runs/${{ matrix.target }}/${{ matrix.target }}
run: python3 -m unittest discover -s scripts/tests -p test_fuzz_campaign.py
- uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
if: success() && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
with:
path: fuzz/corpus/${{ matrix.target }}
key: fuzz-corpus-v1-${{ matrix.target }}-${{ github.run_id }}-${{ github.run_attempt }}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
if: always()
with:
name: fuzz-campaign-${{ matrix.target }}
path: |
fuzz/runs/${{ matrix.target }}/
fuzz/corpus/${{ matrix.target }}/
if-no-files-found: warn
retention-days: 30