mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-16 10:06:36 +02:00
50 lines
1.7 KiB
YAML
50 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Install Go
|
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.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@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
|
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
|