name: Cargo Fuzz

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * 0' # Run everyweek

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
  cancel-in-progress: true

jobs:
  fuzz:
    name: Cargo Fuzz
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: taiki-e/checkout-action@v1

      - name: Install cargo-fuzz
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-fuzz

      - name: Nightly
        run: rustup default nightly

      - name: Run Fuzzer
        run: cargo +nightly fuzz run --sanitizer none --release parser -- -only_ascii=1 -detect_leaks=0 -max_total_time=900
