Skip to content

Commit 712b6bb

Browse files
authored
Merge pull request #2038 from Shopify/dnwe/github-actions
feat: add a fuzzing workflow to github actions
2 parents 461b931 + 2524b44 commit 712b6bb

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: CI
23

34
on: [push, pull_request]
@@ -6,6 +7,9 @@ jobs:
67
test:
78
name: Go ${{ matrix.go-version }} with Kafka ${{ matrix.kafka-version }} on Ubuntu
89
runs-on: ubuntu-latest
10+
# We want to run on external PRs, but not on our own internal PRs as they'll be run
11+
# by the push to the branch.
12+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
913
strategy:
1014
fail-fast: false
1115
matrix:
@@ -15,6 +19,7 @@ jobs:
1519

1620
env:
1721
DEBUG: true
22+
GOFLAGS: -trimpath
1823
KAFKA_VERSION: ${{ matrix.kafka-version }}
1924

2025
steps:
@@ -25,9 +30,18 @@ jobs:
2530
with:
2631
go-version: ${{ matrix.go-version }}
2732

28-
- uses: actions/cache@v2
33+
- name: Get Go environment
34+
id: go-env
35+
run: |
36+
echo "::set-output name=cache::$(go env GOCACHE)"
37+
echo "::set-output name=modcache::$(go env GOMODCACHE)"
38+
39+
- name: Set up cache
40+
uses: actions/cache@v2
2941
with:
30-
path: ~/go/pkg/mod
42+
path: |
43+
${{ steps.go-env.outputs.cache }}
44+
${{ steps.go-env.outputs.modcache }}
3145
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3246
restore-keys: |
3347
${{ runner.os }}-go-

.github/workflows/fuzz.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Fuzzing
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
test:
8+
name: Fuzz
9+
runs-on: ubuntu-latest
10+
# We want to run on external PRs, but not on our own internal PRs as they'll be run
11+
# by the push to the branch.
12+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
13+
14+
env:
15+
GOFLAGS: -trimpath
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: 1.17.x
24+
25+
- name: Get Go environment
26+
id: go-env
27+
run: |
28+
echo "::set-output name=cache::$(go env GOCACHE)"
29+
echo "::set-output name=modcache::$(go env GOMODCACHE)"
30+
31+
- name: Set up cache
32+
uses: actions/cache@v2
33+
with:
34+
path: |
35+
${{ steps.go-env.outputs.cache }}
36+
${{ steps.go-env.outputs.modcache }}
37+
key: fuzz-go-${{ hashFiles('**/go.sum') }}
38+
restore-keys: |
39+
fuzz-go-
40+
41+
- name: Build Go tip
42+
run: go install golang.org/dl/gotip@latest && gotip download
43+
44+
- name: Run any fuzzing tests
45+
run: gotip test -v -run=^Fuzz -test.fuzztime=5m ./...

0 commit comments

Comments
 (0)