-
Notifications
You must be signed in to change notification settings - Fork 7
50 lines (47 loc) · 1.8 KB
/
go-fuzz.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Go Fuzz
on:
push:
branches:
- main
pull_request:
merge_group:
types:
- checks_requested
jobs:
fuzz:
name: go-fuzz
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Fuzz
env:
FUZZTIME: 30s
GOGC: '100'
run: make fuzz
- name: Upload fuzz failure seed corpus as run artifact
if: failure()
uses: actions/upload-artifact@v4
id: testdata-upload
with:
name: testdata
path: '**/testdata/fuzz'
- name: Output message
if: failure()
shell: bash
run: |
echo -e 'Fuzz test failed on commit https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}. To troubleshoot locally, use the GitHub CLI to download the seed corpus by running:\n $ gh run download ${ github.run_id } -n testdata\nAlternatively, download from:\n ${{ steps.testdata-upload.outputs.artifact-url }}'
- name: Post PR comment
uses: actions/github-script@v7
if: failure() && github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Fuzz test failed on commit ${{ github.event.pull_request.head.sha }}. To troubleshoot locally, download the seed corpus using [GitHub CLI](https://cli.github.com) by running:\n```shell\ngh run download ${{ github.run_id }} -n testdata\n```\nAlternatively, download directly from [here](${{ steps.testdata-upload.outputs.artifact-url }}).'
})