Skip to content

Commit

Permalink
feat: add a fuzzing workflow to github actions
Browse files Browse the repository at this point in the history
Currently this won't actually run anything, because we haven't written
any fuzz tests, but it sets up the framework for running the built-in Go
fuzzer against any tests that do get added
  • Loading branch information
dnwe committed Sep 22, 2021
1 parent 461b931 commit dc9a568
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: CI

on: [push, pull_request]
Expand All @@ -15,6 +16,7 @@ jobs:

env:
DEBUG: true
GOFLAGS: -trimpath
KAFKA_VERSION: ${{ matrix.kafka-version }}

steps:
Expand All @@ -25,9 +27,18 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- uses: actions/cache@v2
- name: Get Go environment
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Fuzzing

on: [push, pull_request]

jobs:
test:
name: Fuzz
runs-on: ubuntu-latest

env:
GOFLAGS: -trimpath

steps:
- uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x

- name: Get Go environment
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up cache
uses: actions/cache@v2
with:
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
key: fuzz-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
fuzz-go-
- name: Build Go tip
run: go install golang.org/dl/gotip@latest && gotip download

- name: Run any fuzzing tests
run: gotip test -v -run=^Fuzz -test.fuzztime=5m ./...

0 comments on commit dc9a568

Please sign in to comment.