-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
56 lines (53 loc) · 1.68 KB
/
action.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
51
52
53
54
55
56
name: Tree-sitter parser fuzzing
description: Fuzzing of tree-sitter parsers using libFuzzer
branding:
color: green
icon: shuffle
inputs:
directory:
description: The directory of the grammar
corpus:
description: The directory of the seed corpus
timeout:
description: The time to wait if the fuzzer hangs
default: "10"
max-time:
description: The maximum total fuzzing time
default: "60"
max-length:
description: The maximum fuzz input length
default: "4096"
tree-sitter-version:
description: The tree-sitter version to install
default: latest
runs:
using: composite
steps:
- name: Install tree-sitter
uses: tree-sitter/setup-action/lib@v1
with:
tree-sitter-ref: ${{inputs.tree-sitter-version}}
- name: Run the fuzzer
id: fuzz
working-directory: ${{github.action_path}}
shell: bash
run: |-
export LANG_DIR="$GITHUB_WORKSPACE${LANG_DIR:+/}$LANG_DIR"
[[ -z $CORPUS_DIR ]] || export CORPUS_DIR="$GITHUB_WORKSPACE/$CORPUS_DIR"
printf '::group::Running the fuzzer\n'
make LANG_NAME=$(jq -r .name $LANG_DIR/src/grammar.json) |& tee >(perl annotate.pl)
printf '::endgroup::\n'
env:
TIMEOUT: ${{inputs.timeout}}
MAX_TIME: ${{inputs.max-time}}
MAX_LEN: ${{inputs.max-length}}
LANG_DIR: ${{inputs.directory}}
CORPUS_DIR: ${{inputs.corpus}}
- name: Upload fuzzer artifacts
uses: actions/upload-artifact@v4
if: failure() && steps.fuzz.outcome == 'failure'
with:
path: ${{github.action_path}}/artifacts/*
name: fuzzer-artifacts-${{inputs.directory}}
retention-days: 7
overwrite: true