ferroni 1.4.2

Oniguruma-compatible regex engine
Documentation
name: Fuzz

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  schedule:
    - cron: "41 3 * * 1"
  workflow_dispatch:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  fuzz:
    name: Fuzz ${{ matrix.target }}
    runs-on: ubuntu-latest
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        target: [pattern-compile, pattern-match, scanner-api]
    # cargo-fuzz needs nightly; rust-toolchain.toml pins the local default to
    # stable, so RUSTUP_TOOLCHAIN keeps this job on the toolchain it asked for.
    env:
      RUSTUP_TOOLCHAIN: nightly
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: dtolnay/rust-toolchain@02cb101ec7c40f2c49e1d9714d64511d8e1b74de # master
        with:
          toolchain: nightly
      - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
        with:
          workspaces: fuzz
      - name: Install cargo-fuzz
        run: cargo install cargo-fuzz --version 0.13.2 --locked
      - name: Fuzz ${{ matrix.target }}
        # Pull requests and pushes get a smoke run that only has to catch an
        # obviously broken target; the weekly schedule does the real work.
        env:
          MAX_TOTAL_TIME: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && '900' || '60' }}
        run: >-
          cargo fuzz run ${{ matrix.target }} --
          -dict=fuzz/ferroni.dict
          -max_total_time="$MAX_TOTAL_TIME"
          -max_len=16384
          -timeout=10
          -rss_limit_mb=2048
      - name: Upload crash artifacts
        if: failure()
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: fuzz-artifacts-${{ matrix.target }}
          path: fuzz/artifacts
          if-no-files-found: ignore
          retention-days: 7