granit-parser 1.1.0

A YAML parser with comment and style support, written in pure Rust
Documentation
name: Fuzz

on:
  pull_request:
  push:
    branches:
      - master
  schedule:
    - cron: "30 3 * * 0"
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: fuzz-${{ github.ref }}
  cancel-in-progress: true

jobs:
  fuzz:
    name: Fuzz ${{ matrix.target }}
    runs-on: ubuntu-latest
    timeout-minutes: 45
    strategy:
      fail-fast: false
      matrix:
        target:
          - aliases_merges
          - directives_tags
          - duplicate_keys
          - fallible_input
          - flow_collections
          - large_scalars
          - options
          - parse_any
          - scan_any
    env:
      CARGO_TERM_COLOR: always
      FUZZ_SECONDS: 1200
    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
        with:
          fetch-depth: 0
          submodules: 'recursive'

      - name: Install nightly Rust
        run: rustup toolchain install nightly --profile minimal --no-self-update

      - name: Rust cache
        uses: Swatinem/rust-cache@v2

      - name: Install cargo-fuzz
        run: cargo +nightly install cargo-fuzz

      - name: Build fuzz target
        run: cargo +nightly fuzz build "${{ matrix.target }}"

      - name: Smoke-run fuzz target
        shell: bash
        run: |
          mkdir -p "fuzz/corpus/${{ matrix.target }}"
          cargo +nightly fuzz run "${{ matrix.target }}" "fuzz/corpus/${{ matrix.target }}" tests/yaml-test-suite/src -- \
            -dict=fuzz/yaml.dict -max_total_time="${FUZZ_SECONDS}" -timeout=10 -rss_limit_mb=4096

      - name: Upload crash artifact
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: fuzz-${{ matrix.target }}-artifacts
          path: fuzz/artifacts/${{ matrix.target }}
          if-no-files-found: ignore