Skip to content

Commit 3f5c3c6

Browse files
authored
Speed up Fuzzing workflow (#7856)
This makes a small number of tweaks to `cifuzz.yml` to try to speed up fuzzing in CI: * Shorten the fuzz duration to 5 minutes (down from 10) * Use path filtering to only run on Cirq module code paths * Target only the `main` branch * Use build artifact caching * Use larger GitHub runners
1 parent 0eab4c2 commit 3f5c3c6

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

.github/workflows/cifuzz.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ run-name: >-
55
66
on:
77
pull_request:
8+
branches:
9+
- main
10+
paths:
11+
- 'cirq-*/**'
812
workflow_dispatch:
913

1014
permissions: {}
@@ -17,12 +21,21 @@ concurrency:
1721
jobs:
1822
fuzzing:
1923
name: Fuzz testing
20-
runs-on: ubuntu-24.04
24+
if: github.repository_owner == 'quantumlib'
25+
runs-on: ubuntu-24.04-x64-16-core
2126
permissions:
2227
security-events: write
2328
steps:
2429
- name: Checkout Code
2530
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
31+
- name: Cache build artifacts
32+
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
33+
with:
34+
path: |
35+
~/.cache/pip
36+
~/.cache/bazel
37+
key: ${{runner.os}}-cifuzz-${{hashFiles('cirq-*/**')}}
38+
restore-keys: ${{runner.os}}-cifuzz-
2639
- name: Build Fuzzers
2740
id: build
2841
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
@@ -34,17 +47,17 @@ jobs:
3447
with:
3548
oss-fuzz-project-name: cirq
3649
language: python
37-
fuzz-seconds: 600
50+
fuzz-seconds: 300
3851
output-sarif: true
3952
- name: Upload artifacts to workflow page if a failure occurred
40-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
53+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
4154
if: failure() && steps.build.outcome == 'success'
4255
with:
4356
name: artifacts
4457
path: ./out/artifacts
4558
- name: Upload SARIF file to results page
4659
if: always() && steps.build.outcome == 'success'
47-
uses: github/codeql-action/upload-sarif@d378195403bf7cd9c9b55e4713ede0962aa58b83 # v3
60+
uses: github/codeql-action/upload-sarif@25a224b8085c21d4d61b7fc051468805fc3ac490 # codeql-bundle-v2.24.0
4861
with:
4962
# This the output SARIF file path generated by the 'run_fuzzers' action.
5063
sarif_file: cifuzz-sarif/results.sarif

0 commit comments

Comments
 (0)