github.com/dolthub/maphash@v0.1.0/.github/workflows/ci-go-tests.yaml (about)

     1  name: Test
     2  on:
     3    pull_request:
     4      branches: [ main ]
     5    workflow_dispatch:
     6  
     7  concurrency:
     8    group: test-${{ github.event.pull_request.number || github.ref }}
     9    cancel-in-progress: true
    10  
    11  jobs:
    12    test:
    13      strategy:
    14        matrix:
    15          go-version: [1.18.x, 1.19.x]
    16          platform: [ubuntu-latest, macos-latest, windows-latest]
    17      runs-on: ${{ matrix.platform }}
    18      steps:
    19      - name: Install Go
    20        uses: actions/setup-go@v3
    21        with:
    22          go-version: ${{ matrix.go-version }}
    23      - name: Checkout code
    24        uses: actions/checkout@v3
    25      - name: Test All
    26        run: go test -race ./...
    27    fuzz:
    28      strategy:
    29        matrix:
    30          go-version: [1.18.x, 1.19.x, 1.20.x]
    31          platform: [ubuntu-latest]
    32      runs-on: ${{ matrix.platform }}
    33      steps:
    34      - name: Install Go
    35        uses: actions/setup-go@v3
    36        with:
    37          go-version: ${{ matrix.go-version }}
    38      - name: Checkout code
    39        uses: actions/checkout@v3
    40      - name: Fuzz Test All
    41        working-directory: .
    42        run: |
    43          files=$(grep -r --include='**_test.go' --files-with-matches 'func Fuzz' .)
    44          for file in ${files}
    45          do
    46              funcs=$(grep -oP 'func \K(Fuzz\w*)' $file)
    47              for func in ${funcs}
    48              do
    49                  echo "Fuzzing $func in $file"
    50                  parentDir=$(dirname $file)
    51                  go test $parentDir -run=$func -fuzz=$func -fuzztime=5s
    52              done
    53          done