From fba74dcfc9900816858b3196f7caa55c7f903bd4 Mon Sep 17 00:00:00 2001 From: stefan-aws Date: Wed, 14 Aug 2024 17:11:27 +0100 Subject: [PATCH 1/2] no fork fuzzing --- .github/workflows/compfuzzci_no_forks.yaml | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/compfuzzci_no_forks.yaml diff --git a/.github/workflows/compfuzzci_no_forks.yaml b/.github/workflows/compfuzzci_no_forks.yaml new file mode 100644 index 00000000000..4df45ce3689 --- /dev/null +++ b/.github/workflows/compfuzzci_no_forks.yaml @@ -0,0 +1,91 @@ +name: CompFuzzCI +on: + pull_request: + branches: + - master + types: [opened, closed, synchronize, reopened] + issues: + branches: + - master + types: [opened, closed, reopened] + +jobs: + FuzzOnPR: + if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize') && + github.event.pull_request.base.ref == 'master' && github.event.pull_request.head.repo.owner.login == 'dafny-lang' + runs-on: ubuntu-latest + steps: + - name: Trigger CompFuzzCI + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.COMPFUZZCI_PAT }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'CompFuzzCI', + repo: 'DafnyCompilerFuzzer', + workflow_id: 'fuzz.yaml', + ref: 'main', + inputs: { + commit: '${{ github.event.pull_request.head.sha }}', + main_commit: '${{github.event.pull_request.base.sha}}', + branch: '${{github.event.pull_request.head.ref}}', + duration: '3600', + instance: '2' + } + }) + UpdatePRClosed: + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.head.repo.owner.login == 'dafny-lang' + runs-on: ubuntu-latest + steps: + - name: Trigger CompFuzzCI + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.COMPFUZZCI_PAT }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'CompFuzzCI', + repo: 'DafnyCompilerFuzzer', + workflow_id: 'update_pr_close.yaml', + ref: 'main', + inputs: { + pr_head_ref: '${{github.event.pull_request.head.ref}}' + } + }) + UpdateIssueOpened: + if: github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'reopened') && github.event.pull_request.base.ref == 'master' + runs-on: ubuntu-latest + steps: + - name: Trigger CompFuzzCI + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.COMPFUZZCI_PAT }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'CompFuzzCI', + repo: 'DafnyCompilerFuzzer', + workflow_id: 'update_issue_open.yaml', + ref: 'main', + inputs: { + issue_number: '${{github.event.issue.number}}', + issuer: '${{github.event.issue.user.login}}', + commit: ${{ github.sha }} + } + }) + UpdateIssueClosed: + if: github.event_name == 'issues' && github.event.action == 'closed' + runs-on: ubuntu-latest + steps: + - name: Trigger CompFuzzCI + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.COMPFUZZCI_PAT }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'CompFuzzCI', + repo: 'DafnyCompilerFuzzer', + workflow_id: 'update_issue_close.yaml', + ref: 'main', + inputs: { + issue_number: '${{github.event.issue.number}}' + } + }) \ No newline at end of file From ca4fe828494c4ee07e93796c5ff4ddb2c8700d12 Mon Sep 17 00:00:00 2001 From: stefan-aws Date: Sat, 17 Aug 2024 14:22:23 +0100 Subject: [PATCH 2/2] addressing comments --- .github/workflows/compfuzzci_close_pr.yaml | 29 ++++++ .../workflows/compfuzzci_fuzz_no_forks.yaml | 32 +++++++ .github/workflows/compfuzzci_no_forks.yaml | 91 ------------------- .../workflows/compfuzzci_process_issues.yaml | 51 +++++++++++ 4 files changed, 112 insertions(+), 91 deletions(-) create mode 100644 .github/workflows/compfuzzci_close_pr.yaml create mode 100644 .github/workflows/compfuzzci_fuzz_no_forks.yaml delete mode 100644 .github/workflows/compfuzzci_no_forks.yaml create mode 100644 .github/workflows/compfuzzci_process_issues.yaml diff --git a/.github/workflows/compfuzzci_close_pr.yaml b/.github/workflows/compfuzzci_close_pr.yaml new file mode 100644 index 00000000000..fec95d7b6b2 --- /dev/null +++ b/.github/workflows/compfuzzci_close_pr.yaml @@ -0,0 +1,29 @@ +# This workflow is triggered on PR being closed. +# It dispatches workflow on CompFuzzCI repository, where the bugs found in the PR head is discarded from the database. + +name: Updating CompFuzzCI on PR Closed +on: + pull_request: + branches: + - master + types: [closed] + +jobs: + UpdatePRClosed: + if: github.event.pull_request.base.ref == 'master' && github.event.pull_request.head.repo.owner.login == 'dafny-lang' + runs-on: ubuntu-latest + steps: + - name: Trigger CompFuzzCI + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.COMPFUZZCI_PAT }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'CompFuzzCI', + repo: 'DafnyCompilerFuzzer', + workflow_id: 'update_pr_close.yaml', + ref: 'main', + inputs: { + pr_head_ref: '${{github.event.pull_request.head.ref}}' + } + }) \ No newline at end of file diff --git a/.github/workflows/compfuzzci_fuzz_no_forks.yaml b/.github/workflows/compfuzzci_fuzz_no_forks.yaml new file mode 100644 index 00000000000..ee41745889c --- /dev/null +++ b/.github/workflows/compfuzzci_fuzz_no_forks.yaml @@ -0,0 +1,32 @@ +# This workflow is triggered on PR being opened, synced, reopened, closed. +# It dispatches workflow on CompFuzzCI repository, where fuzzing of the PR is handled. + +name: Fuzzing on PR (excluding forks) +on: + pull_request: + branches: + - master + +jobs: + FuzzOnPR: + if: github.event.pull_request.base.ref == 'master' && github.event.pull_request.head.repo.owner.login == 'dafny-lang' + runs-on: ubuntu-latest + steps: + - name: Trigger CompFuzzCI + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.COMPFUZZCI_PAT }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'CompFuzzCI', + repo: 'DafnyCompilerFuzzer', + workflow_id: 'fuzz.yaml', + ref: 'main', + inputs: { + commit: '${{ github.event.pull_request.head.sha }}', + main_commit: '${{github.event.pull_request.base.sha}}', + branch: '${{github.event.pull_request.head.ref}}', + duration: '3600', + instance: '2' + } + }) \ No newline at end of file diff --git a/.github/workflows/compfuzzci_no_forks.yaml b/.github/workflows/compfuzzci_no_forks.yaml deleted file mode 100644 index 4df45ce3689..00000000000 --- a/.github/workflows/compfuzzci_no_forks.yaml +++ /dev/null @@ -1,91 +0,0 @@ -name: CompFuzzCI -on: - pull_request: - branches: - - master - types: [opened, closed, synchronize, reopened] - issues: - branches: - - master - types: [opened, closed, reopened] - -jobs: - FuzzOnPR: - if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize') && - github.event.pull_request.base.ref == 'master' && github.event.pull_request.head.repo.owner.login == 'dafny-lang' - runs-on: ubuntu-latest - steps: - - name: Trigger CompFuzzCI - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.COMPFUZZCI_PAT }} - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: 'CompFuzzCI', - repo: 'DafnyCompilerFuzzer', - workflow_id: 'fuzz.yaml', - ref: 'main', - inputs: { - commit: '${{ github.event.pull_request.head.sha }}', - main_commit: '${{github.event.pull_request.base.sha}}', - branch: '${{github.event.pull_request.head.ref}}', - duration: '3600', - instance: '2' - } - }) - UpdatePRClosed: - if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.head.repo.owner.login == 'dafny-lang' - runs-on: ubuntu-latest - steps: - - name: Trigger CompFuzzCI - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.COMPFUZZCI_PAT }} - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: 'CompFuzzCI', - repo: 'DafnyCompilerFuzzer', - workflow_id: 'update_pr_close.yaml', - ref: 'main', - inputs: { - pr_head_ref: '${{github.event.pull_request.head.ref}}' - } - }) - UpdateIssueOpened: - if: github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'reopened') && github.event.pull_request.base.ref == 'master' - runs-on: ubuntu-latest - steps: - - name: Trigger CompFuzzCI - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.COMPFUZZCI_PAT }} - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: 'CompFuzzCI', - repo: 'DafnyCompilerFuzzer', - workflow_id: 'update_issue_open.yaml', - ref: 'main', - inputs: { - issue_number: '${{github.event.issue.number}}', - issuer: '${{github.event.issue.user.login}}', - commit: ${{ github.sha }} - } - }) - UpdateIssueClosed: - if: github.event_name == 'issues' && github.event.action == 'closed' - runs-on: ubuntu-latest - steps: - - name: Trigger CompFuzzCI - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.COMPFUZZCI_PAT }} - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: 'CompFuzzCI', - repo: 'DafnyCompilerFuzzer', - workflow_id: 'update_issue_close.yaml', - ref: 'main', - inputs: { - issue_number: '${{github.event.issue.number}}' - } - }) \ No newline at end of file diff --git a/.github/workflows/compfuzzci_process_issues.yaml b/.github/workflows/compfuzzci_process_issues.yaml new file mode 100644 index 00000000000..2228ef0a2d9 --- /dev/null +++ b/.github/workflows/compfuzzci_process_issues.yaml @@ -0,0 +1,51 @@ +# This workflow is triggered on issue being opened, closed, reopened. +# The CompFuzzCI fuzzer needs to keep track of active issues in the repository to ensure that the fuzzer does not report the same issue multiple times. +# For open and reopen events: It dispatches workflow on CompFuzzCI repository, where the issue is added to the database. +# For close event: It dispatches workflow on CompFuzzCI repository, where the issue is removed from the database. + +name: Issue Update for Fuzzer +on: + issues: + branches: + - master + types: [opened, closed, reopened] + +jobs: + UpdateIssueOpened: + if: github.event.action == 'opened' || github.event.action == 'reopened' + runs-on: ubuntu-latest + steps: + - name: Trigger CompFuzzCI + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.COMPFUZZCI_PAT }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'CompFuzzCI', + repo: 'DafnyCompilerFuzzer', + workflow_id: 'update_issue_open.yaml', + ref: 'main', + inputs: { + issue_number: '${{github.event.issue.number}}', + issuer: '${{github.event.issue.user.login}}', + commit: '${{ github.sha }}' + } + }) + UpdateIssueClosed: + if: github.event.action == 'closed' + runs-on: ubuntu-latest + steps: + - name: Trigger CompFuzzCI + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.COMPFUZZCI_PAT }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'CompFuzzCI', + repo: 'DafnyCompilerFuzzer', + workflow_id: 'update_issue_close.yaml', + ref: 'main', + inputs: { + issue_number: '${{github.event.issue.number}}' + } + }) \ No newline at end of file