Skip to content

Commit

Permalink
Add pull request workflow trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwoj-microsoft committed Nov 15, 2024
1 parent cbe30a4 commit 02d942a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/fuzzing-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ on:
package-type:
required: true
type: string
timeout-seconds:
description: The maximum time in seconds to run the fuzzer.
required: false
type: number
default: 600
trigger:
description: The event name that triggered this workflow.
required: true
type: string
container-tag:
type: string
required: false
Expand All @@ -25,6 +24,8 @@ on:
env:
MOUNT: /azure-osconfig
REGISTRY: ghcr.io
WF_DISPATCH_TIMEOUT: 3600
PR_DISPATCH_TIMEOUT: 300

jobs:
package:
Expand Down Expand Up @@ -63,12 +64,21 @@ jobs:
working-directory: ${{ env.MOUNT }}/tests/fuzzer
cmd: mkdir -p ${{ env.MOUNT }}/output/artifacts && mkdir /tmp/corpus && cp -r ${{ env.MOUNT }}/src/tests/fuzzer/seed_corpus/* /tmp/corpus && chmod u+x ./osconfig-fuzzer

- name: Run osconfig-fuzzer
- if: ${{ inputs.trigger == 'workflow_dispatch' }}
name: Run osconfig-fuzzer
uses: ./.github/actions/container-exec
with:
container: ${{ steps.container.outputs.id }}
working-directory: ${{ env.MOUNT }}/tests/fuzzer
cmd: set -o pipefail && ./osconfig-fuzzer -artifact_prefix=${{ env.MOUNT }}/output/artifacts/ -max_total_time=${{ env.WF_DISPATCH_TIMEOUT }} /tmp/corpus 2>&1 >/dev/null | tee ${{ env.MOUNT }}/output/osconfig-fuzzer.log

- if: ${{ inputs.trigger == 'pull_request' }}
name: Run osconfig-fuzzer
uses: ./.github/actions/container-exec
with:
container: ${{ steps.container.outputs.id }}
working-directory: ${{ env.MOUNT }}/tests/fuzzer
cmd: set -o pipefail && ./osconfig-fuzzer -artifact_prefix=${{ env.MOUNT }}/output/artifacts/ -max_total_time=${{ inputs.timeout-seconds }} /tmp/corpus 2>&1 >/dev/null | tee ${{ env.MOUNT }}/output/osconfig-fuzzer.log
cmd: set -o pipefail && ./osconfig-fuzzer -artifact_prefix=${{ env.MOUNT }}/output/artifacts/ -max_total_time=${{ env.PR_DISPATCH_TIMEOUT }} /tmp/corpus 2>&1 >/dev/null | tee ${{ env.MOUNT }}/output/osconfig-fuzzer.log

- uses: actions/upload-artifact@v4
if: success() || failure()
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/fuzzing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Fuzzer execution

on:
workflow_dispatch:
pull_request:

jobs:
fuzzer-execution:
Expand All @@ -19,4 +20,4 @@ jobs:
target: ${{ matrix.target.os }}-${{ matrix.target.version }}
arch: ${{ matrix.arch }}
package-type: ${{ matrix.target.package-type }}
timeout-seconds: 3600
trigger: ${{ github.event_name }}

0 comments on commit 02d942a

Please sign in to comment.