Home

Awesome

go-fuzz-action

GitHub Action for Go fuzz testing. This Action runs Go's built-in fuzz testing, added in Go 1.18, on your code.

Do you find this useful?

You can sponsor me here!

Inputs

Returns:

Usage

⚠️This Action is not tested on windows GitHub Actions runners! Use with windows runner OS at your own risk!

Create a .github/workflows/go-fuzz-test.yml in your repository containing:

name: Go fuzz test
on:
  push:
  pull_request:
jobs:
  fuzz-test:
    name: Fuzz test
    runs-on: ubuntu-latest
    steps:
      - uses: jidicula/go-fuzz-action@v1.1.0
        with:
          fuzz-time: 30s

Fuzz test all packages in repo

If you have multiple packages in your repo and you want to fuzz test them all, create a .github/workflows/go-fuzz-test.yml in your repository containing:

name: Go fuzz test
on:
  push:
  pull_request:
jobs:
  fuzz-test:
    name: Fuzz test
    runs-on: ubuntu-latest
    steps:
      - uses: jidicula/go-fuzz-action@v1.1.0
        with:
          packages: './...'
          fuzz-time: 30s

Longer minimize time

If you want the fuzz test to spend more time on minimizing the failing input to the smallest possible and most human readable value which will still produce an error, create a .github/workflows/go-fuzz-test.yml in your repository containing:

name: Go fuzz test
on:
  push:
  pull_request:
jobs:
  fuzz-test:
    name: Fuzz test
    runs-on: ubuntu-latest
    steps:
      - uses: jidicula/go-fuzz-action@v1.1.0
        with:
          packages: './...'
          fuzz-time: 30s
          fuzz-minimize-time: 1m

Fuzz tests with different regexp

If you have fuzz tests that don't begin with Fuzz (the default regexp), create a .github/workflows/go-fuzz-test.yml in your repository containing:

name: Go fuzz test
on:
  push:
  pull_request:
jobs:
  fuzz-test:
    name: Fuzz test
    runs-on: ubuntu-latest
    steps:
      - uses: jidicula/go-fuzz-action@main
        with:
          packages: './...'
          fuzz-time: 30s
          fuzz-minimize-time: 1m
          fuzz-regexp: OtherFuzzRegexp

Example repo

I haven't figured out how to test this adequately within this repo, so you can verify its behaviour here: https://github.com/jidicula/test-go-fuzz-action/pull/2

Who uses this?

These public repos use this Action.