Skip to content

FUZZ

FUZZ #152

Workflow file for this run

name: FUZZ
on:
push:
branches:
- master
pull_request:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
workflow_dispatch:
inputs:
fuzzseconds:
description: "How many seconds to run fuzzing"
required: false
default: "30"
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
actions: read
jobs:
fuzz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1
with:
toolchain: nightly
- name: Set seconds to run tests
id: fuzz_config
env:
SECONDS: ${{ inputs.fuzzseconds }}
EVENT: ${{ github.event_name }}
run: |
seconds="${SECONDS}"
if ! [[ "$seconds" =~ ^[0-9]+$ ]] || (( seconds < 0 || seconds > 600 )); then
echo "Invalid fuzzseconds input; using default 30"
seconds=30
fi
if [ "${EVENT}" = "schedule" ]; then
echo "fuzzseconds=600" >> "$GITHUB_OUTPUT"
elif [ "${EVENT}" = "workflow_dispatch" ]; then
echo "fuzzseconds=$seconds" >> "$GITHUB_OUTPUT"
else
echo "fuzzseconds=30" >> "$GITHUB_OUTPUT"
fi
- name: Run tests
env:
SECONDS: ${{ steps.fuzz_config.outputs.fuzzseconds }}
run: |
cargo install cargo-fuzz
cargo +nightly fuzz run static_vector -- -max_total_time=${SECONDS}