bzr 0.2.0

A CLI for Bugzilla, inspired by gh
Documentation
name: Fuzz

on:
  pull_request:
    branches: [main]
  schedule:
    # Longer campaign weekly (Sunday 4 AM UTC)
    - cron: '0 4 * * 0'

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  fuzz:
    name: Fuzz ${{ matrix.target }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        target:
          - fuzz_xmlrpc_parse
          - fuzz_url_parser
          - fuzz_flag_parser
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6
        with:
          persist-credentials: false

      # Pinned to the last nightly that compiled cargo-fuzz 0.13.1's
      # transitive `rustix v0.36.5` dep. Newer nightlies dropped the
      # unstable `rustc_layout_scalar_valid_range_{start,end}` attribute
      # form rustix 0.36.5 uses. Bump this once cargo-fuzz pulls a
      # rustix release that compiles on current nightly.
      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8  # nightly
        with:
          toolchain: nightly-2026-05-02

      - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4  # v2
        with:
          key: fuzz-${{ matrix.target }}

      - name: Install cargo-fuzz
        run: cargo install cargo-fuzz --locked

      - name: Run fuzzer
        run: |
          if [ "${{ github.event_name }}" = "schedule" ]; then
            MAX_TIME=300   # 5 minutes per target on schedule
          else
            MAX_TIME=30    # 30 seconds per target on PR
          fi
          cargo +nightly fuzz run ${{ matrix.target }} -- -max_total_time=$MAX_TIME