mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-13 22:36:57 +00:00
ci: persist fuzz corpora between runs Signed-off-by: dhruvxvaishnav <dhruvvaishnav687@gmail.com>
83 lines
3.1 KiB
YAML
83 lines
3.1 KiB
YAML
name: Fuzz Test
|
|
description: 'Run one or more fuzz targets against the prepared service'
|
|
inputs:
|
|
targets:
|
|
description: "Newline-separated fuzz targets to test"
|
|
required: true
|
|
group:
|
|
description: "Stable identifier for this group of fuzz targets"
|
|
required: true
|
|
max-total-time:
|
|
description: "Maximum libFuzzer runtime per target in seconds"
|
|
required: true
|
|
unstable:
|
|
default: 'false'
|
|
description: "Enable the unstable feature"
|
|
fail-fast:
|
|
default: 'true'
|
|
description: "Stop this group after the first failed target"
|
|
collect-cluster-artifacts:
|
|
default: 'false'
|
|
description: "Collect Kind, Kubernetes, and monitor artifacts on target failure"
|
|
artifact-root:
|
|
default: '/tmp/greptime-fuzz-artifacts'
|
|
description: "Directory that stores target-scoped diagnostic artifacts"
|
|
prebuilt-binaries-dir:
|
|
default: ''
|
|
description: "Directory containing prebuilt fuzz target executables"
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Prepare Fuzz Corpus
|
|
id: corpus
|
|
shell: bash
|
|
env:
|
|
FUZZ_TARGETS: ${{ inputs.targets }}
|
|
run: bash .github/scripts/prepare-fuzz-corpus.sh
|
|
|
|
- name: Restore Fuzz Corpus
|
|
id: restore-corpus
|
|
uses: actions/cache/restore@v4
|
|
continue-on-error: true
|
|
with:
|
|
path: ${{ steps.corpus.outputs.paths }}
|
|
key: ${{ steps.corpus.outputs.key-prefix }}${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|
|
restore-keys: ${{ steps.corpus.outputs.key-prefix }}
|
|
|
|
- name: Report Fuzz Corpus Cache
|
|
shell: bash
|
|
env:
|
|
CACHE_OUTCOME: ${{ steps.restore-corpus.outcome }}
|
|
CACHE_MATCHED_KEY: ${{ steps.restore-corpus.outputs.cache-matched-key }}
|
|
run: |
|
|
if [[ "${CACHE_OUTCOME}" == failure ]]; then
|
|
echo '::warning::Fuzz corpus restore failed; running with available inputs'
|
|
elif [[ -n "${CACHE_MATCHED_KEY}" ]]; then
|
|
printf 'Restored fuzz corpus: %s\n' "${CACHE_MATCHED_KEY}"
|
|
else
|
|
echo 'No cached fuzz corpus found; starting with an empty corpus'
|
|
fi
|
|
|
|
- name: Run Fuzz Tests
|
|
id: run-fuzz
|
|
shell: bash
|
|
env:
|
|
FUZZ_TARGETS: ${{ inputs.targets }}
|
|
FUZZ_GROUP: ${{ inputs.group }}
|
|
FUZZ_MAX_TOTAL_TIME: ${{ inputs.max-total-time }}
|
|
FUZZ_UNSTABLE: ${{ inputs.unstable }}
|
|
FUZZ_FAIL_FAST: ${{ inputs.fail-fast }}
|
|
FUZZ_COLLECT_CLUSTER_ARTIFACTS: ${{ inputs.collect-cluster-artifacts }}
|
|
FUZZ_ARTIFACT_ROOT: ${{ inputs.artifact-root }}
|
|
FUZZ_BIN_DIR: ${{ inputs.prebuilt-binaries-dir }}
|
|
FUZZ_CORPUS_ROOT: ${{ github.workspace }}/tests-fuzz/corpus
|
|
run: .github/scripts/run-fuzz-targets.sh
|
|
|
|
- name: Save Fuzz Corpus
|
|
if: ${{ !cancelled() && (steps.run-fuzz.outcome == 'success' || steps.run-fuzz.outcome == 'failure') }}
|
|
uses: actions/cache/save@v4
|
|
continue-on-error: true
|
|
with:
|
|
path: ${{ steps.corpus.outputs.paths }}
|
|
key: ${{ steps.corpus.outputs.key-prefix }}${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index || 0 }}
|