Skip to content

Commit ca1c21a

Browse files
ToastChengpavoljuhasmhucka
authored
Add cifuzz CI config for OSS-Fuzz (#7625)
After adding the Cirq to OSS-Fuzz project list, we'll need to configure GitHub action to run the CI fuzzer. This PR basically follows https://google.github.io/oss-fuzz/getting-started/continuous-integration/ to enable the workflow. Partially implements #7515 --------- Co-authored-by: Pavol Juhas <juhas@google.com> Co-authored-by: Michael Hucka <mhucka@caltech.edu>
1 parent f066e63 commit ca1c21a

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/cifuzz.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CIFuzz
2+
run-name: >-
3+
Perform fuzz testing on pull request ${{github.event.pull_request.number}}
4+
by ${{github.actor}}
5+
6+
on:
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions: {}
11+
12+
concurrency:
13+
# Cancel any previously-started but still active runs on the same branch.
14+
cancel-in-progress: true
15+
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
16+
17+
jobs:
18+
fuzzing:
19+
name: Fuzz testing
20+
runs-on: ubuntu-24.04
21+
permissions:
22+
security-events: write
23+
steps:
24+
- name: Checkout Code
25+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
26+
- name: Build Fuzzers
27+
id: build
28+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
29+
with:
30+
oss-fuzz-project-name: cirq
31+
language: python
32+
- name: Run Fuzzers
33+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
34+
with:
35+
oss-fuzz-project-name: cirq
36+
language: python
37+
fuzz-seconds: 600
38+
output-sarif: true
39+
- name: Upload artifacts to workflow page if a failure occurred
40+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
41+
if: failure() && steps.build.outcome == 'success'
42+
with:
43+
name: artifacts
44+
path: ./out/artifacts
45+
- name: Upload SARIF file to results page
46+
if: always() && steps.build.outcome == 'success'
47+
uses: github/codeql-action/upload-sarif@d378195403bf7cd9c9b55e4713ede0962aa58b83 # v3
48+
with:
49+
# This the output SARIF file path generated by the 'run_fuzzers' action.
50+
sarif_file: cifuzz-sarif/results.sarif

0 commit comments

Comments
 (0)