|
| 1 | +name: Fuzzing |
| 2 | +on: |
| 3 | + # Uncomment to enable scheduled runs. |
| 4 | + #schedule: |
| 5 | + # Run every day at 22 CET |
| 6 | + # - cron: '0 21 * * *' |
| 7 | + |
| 8 | + pull_request: |
| 9 | + branches: [ main ] |
| 10 | + |
| 11 | + merge_group: |
| 12 | + |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + |
| 21 | + build_and_test: |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + name: Build & Test |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + os: [ubuntu-22.04, windows-2022, macos-14] |
| 27 | + jdk: [21, 8] |
| 28 | + include: |
| 29 | + - jdk: 21 |
| 30 | + # Workaround for https://github.com/bazelbuild/bazel/issues/14502 |
| 31 | + extra_bazel_args: "--jvmopt=-Djava.security.manager=allow" |
| 32 | + - os: ubuntu-22.04 |
| 33 | + arch: "linux" |
| 34 | + - os: macos-14 |
| 35 | + arch: "macos-arm64" |
| 36 | + bazel_args: "--xcode_version_config=//.github:host_xcodes" |
| 37 | + - os: windows-2022 |
| 38 | + arch: "windows" |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Set up JDK |
| 44 | + uses: actions/setup-java@v4 |
| 45 | + with: |
| 46 | + distribution: zulu |
| 47 | + java-version: 21 |
| 48 | + |
| 49 | + - name: Set Build Buddy config |
| 50 | + run: .github/scripts/echoBuildBuddyConfig.sh ${{ secrets.BUILDBUDDY_API_KEY }} >> $GITHUB_ENV |
| 51 | + shell: bash |
| 52 | + |
| 53 | + - name: Install Clang on Windows |
| 54 | + if: matrix.os == 'windows-2022' |
| 55 | + run: | |
| 56 | + choco install llvm --version=19.1.0 --force |
| 57 | + echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 58 | +
|
| 59 | + - name: Cache Fuzzing Corpus |
| 60 | + uses: actions/cache@v4 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + ~/fuzzing-corpus |
| 64 | +
|
| 65 | + key: "Catch-22" |
| 66 | + |
| 67 | + - name: Build & Fuzz |
| 68 | + run: | |
| 69 | + mkdir ~/fuzzing-corpus/ArgumentsMutatorFuzzTest && |
| 70 | + bazelisk run ${{env.BUILD_BUDDY_CONFIG}} --java_runtime_version=remotejdk_${{ matrix.jdk }} ${{ matrix.bazel_args }} ${{ matrix.extra_bazel_args }} //selffuzz/src/test/java/com/code_intelligence/selffuzz/mutation:ArgumentsMutatorFuzzTest -- -runs=200000 ~/fuzzing-corpus/ArgumentsMutatorFuzzTest |
| 71 | +
|
| 72 | + - name: Copy Bazel log |
| 73 | + if: always() |
| 74 | + shell: bash |
| 75 | + run: cp "$(readlink bazel-out)"/../../../java.log* . |
| 76 | + |
| 77 | + - name: Upload test logs |
| 78 | + if: always() |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: testlogs-${{ matrix.arch }}-${{ matrix.jdk }} |
| 82 | + # https://github.com/actions/upload-artifact/issues/92#issuecomment-711107236 |
| 83 | + path: | |
| 84 | + bazel-testlogs*/**/test.log |
| 85 | + java.log* |
0 commit comments