# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
# See also: https://github.com/marketplace/actions/bazel-action

name: Nightly Fuzz
on:
  schedule:
    # Nightly at midnight.
    - cron:  '0 0 * * *'

jobs:
  build:
    name: Nightly Fuzz
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Mount Bazel Cache
        uses: actions/cache@v1
        with:
          path: "/home/runner/.cache/bazel"
          key: bazel
      - name: Install bazelisk
        run: |
          curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64"
          mkdir -p "${GITHUB_WORKSPACE}/bin/"
          mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
          chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
      - name: Install dependencies via apt
        run: sudo apt install python3-dev python3-distutils python3-dev libtinfo5
      - name: Configure Python3 Path For Bazel
        run: |
          ln -s $(which python3) ${GITHUB_WORKSPACE}/bin/python
          echo "::add-path::${GITHUB_WORKSPACE}/bin"
      - name: Bazel Run Fuzz (nosim, opt)
        run: |
          "${GITHUB_WORKSPACE}/bin/bazel" run -c opt xls/dslx/fuzzer:run_fuzz_multiprocess -- --crash_path "${GITHUB_WORKSPACE}/crashers" --sample_count=1024 --nocodegen --nosimulate
      - name: Fuzz Crashers
        uses: actions/upload-artifact@v2
        with:
          name: crashers
          path: "${GITHUB_WORKSPACE}/crashers"

Add GitHub action for nightly fuzz.
Add GitHub action for nightly fuzz.

Just a small number of samples for now to test it out.

PiperOrigin-RevId: 328385881
