name: Fuzz Test Linux-X64

on: pull_request

jobs:
  build:
    strategy:
        max-parallel: 2
        matrix:
          mode: [run, runopt]
          os: [ubuntu-latest, ubuntu-24.04-arm]
          exclude:
            - os: ubuntu-24.04-arm
              mode: runopt

    runs-on: ${{ matrix.os }}
    steps:
      - name: Clear repository
        run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE

      - uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: 1.20.x

      - uses: actions/cache@v4
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-

      - name: Fuzz sonic
        run: ./scripts/fuzz.sh ${{ matrix.mode }}

