prometheus/.github/workflows/fuzzing.yml
renovate[bot] b27435d356
chore(deps): update actions/checkout action to v7 (#19056)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-01 14:27:44 +02:00

49 lines
1.7 KiB
YAML

name: fuzzing
on:
workflow_call:
permissions:
contents: read
jobs:
fuzzing:
name: Run Go Fuzz Tests
runs-on: ubuntu-latest
strategy:
matrix:
fuzz_test: [[FuzzParseMetricText, FuzzParseOpenMetric], [FuzzParseMetricSelector, FuzzParseExpr], [FuzzXORChunk, FuzzXOR2Chunk], [FuzzParseProtobuf]]
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: 1.26.x
- name: Run Fuzzing
run: |
for fuzz_test in ${{ join(matrix.fuzz_test, ' ') }}; do
go test -fuzz="${fuzz_test}$" -fuzztime=4m ./util/fuzzing
done
id: fuzz
- name: Upload Crash Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: fuzz-artifacts-${{ join(matrix.fuzz_test, '-') }}
path: util/fuzzing/testdata/fuzz/
fuzzing_status:
# This status check aggregates the individual matrix jobs of the fuzzing
# step into a final status. Fails if a single matrix job fails, succeeds if
# all matrix jobs succeed.
name: Fuzzing
runs-on: ubuntu-latest
needs: [fuzzing]
if: always()
steps:
- name: Successful fuzzing
if: ${{ !(contains(needs.*.result, 'failure')) && !(contains(needs.*.result, 'cancelled')) }}
run: exit 0
- name: Failing or cancelled fuzzing
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1