mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-29 14:14:13 +00:00
* ci: gate the integration CI long tail by diff scope `integration.yml` starts its long tail on every pull request: the three fuzz families, the chaos legs, the export/import E2E job and the two sqlness KvBackend legs. Most diffs cannot affect them, so a `scope` job now classifies the pull request and tells those jobs whether to start. The classifier is deterministic and fail-open. Forced modes (merge queue, `schedule`, `workflow_dispatch`, `ci:full`, `CI_SCOPE_FORCE_ALL`) and three floors -- always-run paths, an uncovered `src/` change, and a PromQL/flow filter -- can only widen the result; everything else is a glob match against the suite catalog. Every step of the job is `continue-on-error` and every gate reads `needs.scope.outputs.<key> != 'false'`, so a classifier crash runs the jobs instead of skipping them. The rules are checked out from the pull request base, so a pull request cannot relax its own gate. The policy is data: `.github/ci/scope-rules.toml` holds the path groups, the suite catalog and the always-run list, with a `reason` on every exclusion. `ci_scope_rules.py` loads it with the stdlib `tomllib` and validates the shape (unknown or cyclic `@group` references, a `family` that disagrees with the suite id, an empty reason) and that every glob's literal prefix still exists, so a renamed crate cannot leave a rule that matches nothing. `make check-ci-scope` runs that check locally; the `CI Scope Rules` job runs it on `ubuntu-slim`, the same image the classifier uses. `.github/ci/scope-cases.toml` holds golden cases that `test_ci_scope.py` replays through the real classifier. The PostgreSQL and MySQL sqlness legs move into their own `sqlness-kvbackend` job so they can be gated: a job-level `if:` cannot read the matrix, and gating them inside `sqlness` would skip required checks and block the merge. They run the same cases as the required Basic leg, so only the backend itself matters. The verdict is visible where triage looks: one log line per suite, the exact gate values, `::warning::` when a lookup fails and the gate widens, and a job summary that lists each suite with the rule that decided it and the changed files that matched. Measured on 200 merged and open pull requests: 27.5% always run, 41% decided by path rules, 31.5% skip every gated job; 995 of 2600 suite selections are skipped, with no selection that a path rule makes. The classifier itself runs in about ten seconds on a single-vCPU runner. Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(ci): let the scope job read pull requests The `scope` job declared `permissions: contents: read`, and an explicit block sets every unlisted permission to `none`. `GET /pulls/{n}` therefore answered 403, `build_plan` widened to a full run as designed, and every gate read an absent output as "run": the gate could never skip anything. - `pull-requests: read` on the `scope` job. - `tests/runner/**` joins `@kv-backend`: the runner implements `--setup-pg`/`--setup-mysql`, which only the KV-backend legs pass, so a change there must not skip the only job that exercises it. The `UNMAPPED_CRATES` excuse is gone with it. - The README no longer claims a queue failure blocks the merge: the gated jobs are not required checks. Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(ci): run every suite when the kind registry script changes The distributed and chaos fuzz jobs start their cluster through `.github/actions/setup-kind`, which runs `.github/scripts/kind-with-registry.sh`. `.github/actions/**` is in `ALWAYS_RUN` but the script is not, so a change confined to it selected no suite at all and every gate stayed `false`: the jobs that exercise the changed cluster setup were skipped. The script joins `ALWAYS_RUN`, consistent with the action that calls it, and a golden case pins it. Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(ci): widen the gate for the fuzz corpus seeding script `fuzz-test/action.yaml` runs `.github/scripts/prepare-fuzz-corpus.sh` before the cache restore in every fuzz job, but the script was not in `ALWAYS_RUN`. A change confined to it therefore selected no suite: `any_fuzz` stayed `false` and every fuzz job that runs it was skipped. The script joins `ALWAYS_RUN` next to the other scripts the fuzz jobs execute, with a golden case for it. Both misses so far (this one and `kind-with-registry.sh`) came through a composite action, which the workflow never names. `WorkflowContractTests` now resolves `uses: ./.github/actions/<name>` transitively for the gated jobs and fails when one of the scripts they run is not in `ALWAYS_RUN`. Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com>
1129 lines
44 KiB
YAML
1129 lines
44 KiB
YAML
on:
|
|
schedule:
|
|
- cron: "0 15 * * 1-5"
|
|
merge_group:
|
|
pull_request:
|
|
types: [ opened, synchronize, reopened, ready_for_review ]
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- 'config/**'
|
|
- '**.md'
|
|
- '.dockerignore'
|
|
- 'docker/**'
|
|
- '.gitignore'
|
|
- 'grafana/**'
|
|
- 'Makefile'
|
|
workflow_dispatch:
|
|
inputs:
|
|
ci_command:
|
|
description: Internal comment-command marker
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
fuzz_profile:
|
|
description: Fuzz profile selected by /ci fuzz
|
|
required: false
|
|
default: none
|
|
type: choice
|
|
options: [none, standalone, distributed, chaos, all]
|
|
|
|
name: Integration CI
|
|
|
|
env:
|
|
CARGO_FUZZ_VERSION: "0.13.2"
|
|
# Fuzz targets require a nightly toolchain (cargo-fuzz needs
|
|
# `-Zsanitizer=fuzzer`). This pin decouples the fuzz workflow from the
|
|
# workspace default in rust-toolchain.toml, so it keeps working when the
|
|
# workspace moves to a stable toolchain.
|
|
FUZZ_RUST_TOOLCHAIN: "nightly-2026-03-21"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# Which jobs this gate skips, and why: .github/ci/README.md.
|
|
scope:
|
|
name: CI Scope
|
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
|
|
# ubuntu-slim ships python3, git and curl; this job only classifies.
|
|
runs-on: ubuntu-slim
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
# `/pulls/{n}` and `/pulls/{n}/files`. An explicit block sets every
|
|
# unlisted permission to none, and a 403 here would silently widen every
|
|
# gate instead of classifying.
|
|
pull-requests: read
|
|
outputs:
|
|
any_fuzz: ${{ steps.classify.outputs.any_fuzz }}
|
|
build_ci_needed: ${{ steps.classify.outputs.build_ci_needed }}
|
|
fuzz_standalone: ${{ steps.classify.outputs.fuzz_standalone }}
|
|
fuzz_distributed: ${{ steps.classify.outputs.fuzz_distributed }}
|
|
fuzz_chaos: ${{ steps.classify.outputs.fuzz_chaos }}
|
|
fuzz_unstable: ${{ steps.classify.outputs.fuzz_unstable }}
|
|
export_import_v2: ${{ steps.classify.outputs.export_import_v2 }}
|
|
sqlness_kvbackend: ${{ steps.classify.outputs.sqlness_kvbackend }}
|
|
steps:
|
|
# Rules come from the pull request base (the queue base on merge_group),
|
|
# so a pull request cannot weaken its own gate. If this job or the Classify
|
|
# step fails, the outputs stay empty and every gate below treats an absent
|
|
# value as "run", which keeps CI fail-open.
|
|
- uses: actions/checkout@v4
|
|
# A checkout failure leaves the outputs empty, which every gate treats
|
|
# as "run"; letting the step fail would skip the gates instead.
|
|
continue-on-error: true
|
|
with:
|
|
ref: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.sha }}
|
|
persist-credentials: false
|
|
- name: Classify
|
|
id: classify
|
|
continue-on-error: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CI_SCOPE_FORCE_ALL: ${{ vars.CI_SCOPE_FORCE_ALL || 'false' }}
|
|
run: |
|
|
args=(--repo "$GITHUB_REPOSITORY" --event "$GITHUB_EVENT_NAME"
|
|
--github-output "$GITHUB_OUTPUT"
|
|
--summary "$GITHUB_STEP_SUMMARY")
|
|
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
|
|
args+=(--pr "${{ github.event.pull_request.number }}"
|
|
--head-sha "${{ github.event.pull_request.head.sha }}"
|
|
--base-sha "${{ github.event.pull_request.base.sha }}")
|
|
fi
|
|
python3 .github/ci/ci_scope.py "${args[@]}"
|
|
|
|
build:
|
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
|
|
name: Build GreptimeDB binaries
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest ]
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: protoc@3.23.4
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
- name: Build Binaries Cache
|
|
id: build-binaries-cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
# Shares across multiple jobs
|
|
shared-key: "build-binaries"
|
|
cache-all-crates: "true"
|
|
cache-workspace-crates: "true"
|
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
- name: Report build binaries cache lookup
|
|
shell: bash
|
|
run: |
|
|
{
|
|
printf '## Build binaries cache lookup\n\n'
|
|
printf -- '- Dependency cache: `%s`\n' "${{ steps.build-binaries-cache.outputs.cache-hit }}"
|
|
} >>"${GITHUB_STEP_SUMMARY}"
|
|
- name: Install cargo-gc-bin
|
|
shell: bash
|
|
run: |
|
|
started_epoch="$(date +%s)"
|
|
cargo install cargo-gc-bin --force
|
|
elapsed_secs=$(( $(date +%s) - started_epoch ))
|
|
printf -- '- cargo-gc-bin install: **%ss**\n' "${elapsed_secs}" >>"${GITHUB_STEP_SUMMARY}"
|
|
- name: Build greptime binaries
|
|
shell: bash
|
|
# `cargo gc` will invoke `cargo build` with specified args
|
|
run: |
|
|
started_epoch="$(date +%s)"
|
|
cargo gc -- --bin greptime --bin sqlness-runner --features "pg_kvbackend,mysql_kvbackend,ai_functions"
|
|
elapsed_secs=$(( $(date +%s) - started_epoch ))
|
|
printf -- '- Binary build: **%ss**\n' "${elapsed_secs}" >>"${GITHUB_STEP_SUMMARY}"
|
|
- name: Pack greptime binaries
|
|
shell: bash
|
|
run: |
|
|
mkdir bins && \
|
|
mv ./target/debug/greptime bins && \
|
|
mv ./target/debug/sqlness-runner bins
|
|
- name: Print greptime binaries info
|
|
run: ls -lh bins
|
|
- name: Upload artifacts
|
|
uses: ./.github/actions/upload-artifacts
|
|
with:
|
|
artifacts-dir: bins
|
|
version: current
|
|
|
|
sqlness:
|
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
|
|
name: Sqlness Test (${{ matrix.mode.name }})
|
|
needs: build
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ ubuntu-latest ]
|
|
mode:
|
|
- name: "Basic"
|
|
opts: ""
|
|
kafka: false
|
|
- name: "Remote WAL"
|
|
opts: "-w kafka -k 127.0.0.1:9092"
|
|
kafka: true
|
|
- name: "Flat format"
|
|
opts: "--enable-flat-format"
|
|
kafka: false
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- if: matrix.mode.kafka
|
|
name: Setup Kafka
|
|
working-directory: tests-integration/fixtures
|
|
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait kafka
|
|
|
|
- name: Download pre-built binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bins
|
|
path: .
|
|
- name: Unzip binaries
|
|
run: tar -xvf ./bins.tar.gz
|
|
- name: Run sqlness
|
|
run: RUST_BACKTRACE=1 ./bins/sqlness-runner bare ${{ matrix.mode.opts }} -c ./tests/cases --bins-dir ./bins --preserve-state
|
|
- if: matrix.mode.name == 'Basic'
|
|
name: Run distributed workload scheduler E2E
|
|
env:
|
|
GREPTIMEDB_BIN: ${{ github.workspace }}/bins/greptime
|
|
WORKLOAD_SCHEDULER_RUN_DIR: /tmp/sqlness-workload-scheduler-e2e
|
|
run: bash ./.github/scripts/workload-scheduler-e2e.sh
|
|
- name: Upload sqlness logs
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlness-logs-${{ matrix.mode.name }}
|
|
path: |
|
|
/tmp/sqlness*
|
|
retention-days: 3
|
|
|
|
sqlness-kvbackend:
|
|
# The two foreign KV backends are the only sqlness legs that are not
|
|
# required checks, so they are the only ones this gate may skip. They run
|
|
# the same cases as the `Basic` leg, so the diff only matters when it can
|
|
# reach the backend itself; the merge queue runs them regardless.
|
|
if: ${{ !cancelled() && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) && needs.build.result == 'success' && needs.scope.outputs.sqlness_kvbackend != 'false' }}
|
|
name: Sqlness Test (${{ matrix.mode.name }})
|
|
needs: [scope, build]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ ubuntu-latest ]
|
|
mode:
|
|
- name: "Metasrv on PostgreSQL"
|
|
id: "metasrv-postgres"
|
|
opts: "--setup-pg postgresql://greptimedb:admin@127.0.0.1:5432/postgres"
|
|
postgres: true
|
|
mysql: false
|
|
- name: "Metasrv on MySQL"
|
|
id: "metasrv-mysql"
|
|
opts: "--setup-mysql mysql://greptimedb:admin@127.0.0.1:3306/mysql"
|
|
postgres: false
|
|
mysql: true
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- if: matrix.mode.postgres
|
|
name: Setup PostgreSQL
|
|
working-directory: tests-integration/fixtures
|
|
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait postgres
|
|
|
|
- if: matrix.mode.mysql
|
|
name: Setup MySQL
|
|
working-directory: tests-integration/fixtures
|
|
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait mysql
|
|
|
|
- name: Download pre-built binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bins
|
|
path: .
|
|
- name: Unzip binaries
|
|
run: tar -xvf ./bins.tar.gz
|
|
- name: Run sqlness
|
|
run: RUST_BACKTRACE=1 ./bins/sqlness-runner bare ${{ matrix.mode.opts }} -c ./tests/cases --bins-dir ./bins --preserve-state
|
|
- name: Upload sqlness logs
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sqlness-logs-${{ matrix.mode.name }}
|
|
path: |
|
|
/tmp/sqlness*
|
|
retention-days: 3
|
|
|
|
export-import-v2-e2e:
|
|
if: ${{ !cancelled() && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) && needs.build.result == 'success' && needs.scope.outputs.export_import_v2 != 'false' }}
|
|
name: Export/Import V2 E2E Test
|
|
needs: [scope, build]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: protoc@3.23.4
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: "export-import-v2-e2e"
|
|
cache-all-crates: "true"
|
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
- name: Setup MinIO
|
|
working-directory: tests-integration/fixtures
|
|
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait minio
|
|
- name: Download pre-built binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bins
|
|
path: .
|
|
- name: Unzip binaries
|
|
run: tar -xvf ./bins.tar.gz
|
|
- name: Start GreptimeDB standalone
|
|
env:
|
|
GREPTIMEDB_STANDALONE__STORAGE__COPY_ROOT: ${{ runner.temp }}/greptime-export-import-v2
|
|
run: |
|
|
mkdir -p "${GREPTIMEDB_STANDALONE__STORAGE__COPY_ROOT}"
|
|
./bins/greptime standalone start > greptimedb.log 2>&1 &
|
|
greptime_pid=$!
|
|
echo "Waiting for GreptimeDB..."
|
|
for i in {1..60}; do
|
|
if curl -sf http://localhost:4000/health > /dev/null; then
|
|
echo "GreptimeDB is ready"
|
|
exit 0
|
|
fi
|
|
if ! kill -0 "${greptime_pid}" 2>/dev/null; then
|
|
cat greptimedb.log
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
cat greptimedb.log
|
|
exit 1
|
|
- name: Run export/import v2 E2E tests
|
|
run: cargo test -p cli data::export_v2::tests --lib -- --ignored --test-threads=1
|
|
env:
|
|
TMPDIR: ${{ runner.temp }}/greptime-export-import-v2
|
|
GREPTIME_ADDR: 127.0.0.1:4000
|
|
GT_S3_BUCKET: greptime
|
|
GT_S3_ACCESS_KEY_ID: superpower_ci_user
|
|
GT_S3_ACCESS_KEY: superpower_password
|
|
GT_S3_REGION: us-west-2
|
|
GT_S3_ENDPOINT_URL: http://127.0.0.1:9000
|
|
- name: Upload GreptimeDB logs
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: export-import-v2-e2e-logs
|
|
path: greptimedb.log
|
|
if-no-files-found: warn
|
|
retention-days: 3
|
|
|
|
run-multi-lang-tests:
|
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
|
|
name: Run Multi-language SDK Tests
|
|
needs: build
|
|
uses: ./.github/workflows/run-multi-lang-tests.yml
|
|
with:
|
|
artifact-name: bins
|
|
|
|
compat-updater-check:
|
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) && (github.event_name == 'merge_group' || github.event_name == 'pull_request') }}
|
|
name: Check compat version updater
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
- name: Run compat updater unit tests
|
|
run: python3 -m unittest discover -s .github/scripts/tests -p 'test_*.py'
|
|
- name: Check compat version window and anchors
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: python3 .github/scripts/update-compat-versions.py --check --published-only --check-anchors
|
|
|
|
compat:
|
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || (github.event_name == 'pull_request' && (github.event.action == 'ready_for_review' || (github.event.action == 'opened' && github.event.pull_request.draft == false)))) }}
|
|
name: Compatibility Test (recent releases)
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
- name: Download pre-built binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bins
|
|
path: .
|
|
- name: Unzip binaries
|
|
run: tar -xvf ./bins.tar.gz
|
|
- name: Compute nightly compat window
|
|
id: nightly
|
|
if: ${{ github.event_name == 'schedule' }}
|
|
shell: bash
|
|
run: echo "extra=$(python3 .github/scripts/update-compat-versions.py --nightly-window)" >> "$GITHUB_OUTPUT"
|
|
- name: Run compatibility test
|
|
env:
|
|
NIGHTLY_EXTRA: ${{ steps.nightly.outputs.extra }}
|
|
run: |
|
|
EXTRA=""
|
|
if [[ "${GITHUB_EVENT_NAME}" == "schedule" && -n "${NIGHTLY_EXTRA}" ]]; then
|
|
EXTRA="--from-versions-extra=${NIGHTLY_EXTRA}"
|
|
fi
|
|
python3 .github/scripts/run-compat.py --preserve-state ${EXTRA}
|
|
- name: Upload compatibility logs
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: compatibility-logs
|
|
path: /tmp/sqlness-compat*
|
|
retention-days: 3
|
|
|
|
prepare-fuzz-targets:
|
|
if: ${{ !cancelled() && github.repository == 'GreptimeTeam/greptimedb' && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' && inputs.ci_command) || github.event_name == 'merge_group') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || inputs.fuzz_profile != 'none') && needs.scope.outputs.any_fuzz != 'false' }}
|
|
name: Prepare Fuzz Targets
|
|
needs: [scope]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: protoc@3.23.4
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache: false
|
|
toolchain: ${{ env.FUZZ_RUST_TOOLCHAIN }}
|
|
- name: Fuzz Dependency Cache
|
|
id: fuzz-dependencies-cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
prefix-key: "v1-fuzz-${{ env.CARGO_FUZZ_VERSION }}"
|
|
shared-key: "fuzz-dependencies"
|
|
workspaces: ". -> target"
|
|
cache-targets: "true"
|
|
cache-all-crates: "true"
|
|
save-if: ${{ github.event_name == 'pull_request' }}
|
|
- name: Look up prebuilt fuzz binaries
|
|
id: fuzz-binaries
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: ${{ runner.temp }}/greptime-fuzz-binaries
|
|
key: v1-fuzz-binaries-${{ env.CARGO_FUZZ_VERSION }}-${{ env.FUZZ_RUST_TOOLCHAIN }}-all-${{ hashFiles('Cargo.toml', 'Cargo.lock', '.cargo/**', 'tests-fuzz/**', 'src/**') }}
|
|
- name: Report fuzz cache lookup
|
|
shell: bash
|
|
run: |
|
|
{
|
|
printf '## Fuzz cache lookup\n\n'
|
|
printf -- '- Dependency cache: `%s`\n' "${{ steps.fuzz-dependencies-cache.outputs.cache-hit }}"
|
|
printf -- '- Prebuilt binary cache: `%s`\n' "${{ steps.fuzz-binaries.outputs.cache-hit }}"
|
|
} >>"${GITHUB_STEP_SUMMARY}"
|
|
- name: Set Rust Fuzz
|
|
if: steps.fuzz-binaries.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
env:
|
|
RUSTUP_TOOLCHAIN: ${{ env.FUZZ_RUST_TOOLCHAIN }}
|
|
run: |
|
|
cargo install cargo-fuzz --version "${CARGO_FUZZ_VERSION}" --locked
|
|
- name: Build fuzz target binaries
|
|
if: steps.fuzz-binaries.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
env:
|
|
RUSTUP_TOOLCHAIN: ${{ env.FUZZ_RUST_TOOLCHAIN }}
|
|
FUZZ_TARGETS: |
|
|
fuzz_create_database
|
|
fuzz_create_table
|
|
fuzz_alter_table
|
|
fuzz_insert
|
|
fuzz_create_logical_table
|
|
fuzz_alter_logical_table
|
|
fuzz_insert_logical_table
|
|
fuzz_repartition_table
|
|
fuzz_repartition_metric_table
|
|
fuzz_repartition_table_chaos
|
|
fuzz_remote_wal_logical_prune
|
|
fuzz_migrate_mito_regions
|
|
fuzz_migrate_metric_regions
|
|
fuzz_failover_mito_regions
|
|
fuzz_failover_metric_regions
|
|
FUZZ_UNSTABLE_TARGETS: unstable_fuzz_create_table_standalone
|
|
FUZZ_BIN_DIR: ${{ runner.temp }}/greptime-fuzz-binaries
|
|
run: |
|
|
set -euo pipefail
|
|
target_dir="$(cargo metadata --manifest-path tests-fuzz/Cargo.toml --no-deps --format-version 1 | jq -r '.target_directory')"
|
|
mkdir -p "${FUZZ_BIN_DIR}"
|
|
build_targets() {
|
|
local unstable="$1"
|
|
local targets="$2"
|
|
while IFS= read -r target; do
|
|
[[ -z "${target}" ]] && continue
|
|
args=(fuzz build "${target}" --fuzz-dir tests-fuzz -D -s none)
|
|
if [[ "${unstable}" == true ]]; then
|
|
args+=(--features unstable)
|
|
fi
|
|
cargo "${args[@]}"
|
|
binary="$(find "${target_dir}" -type f -path "*/debug/${target}" -perm -u+x -print -quit)"
|
|
if [[ -z "${binary}" ]]; then
|
|
echo "Unable to locate built fuzz target: ${target}" >&2
|
|
exit 1
|
|
fi
|
|
cp "${binary}" "${FUZZ_BIN_DIR}/${target}"
|
|
done <<<"${targets}"
|
|
}
|
|
build_targets false "${FUZZ_TARGETS}"
|
|
build_targets true "${FUZZ_UNSTABLE_TARGETS}"
|
|
- name: Save prebuilt fuzz binaries
|
|
if: steps.fuzz-binaries.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: ${{ runner.temp }}/greptime-fuzz-binaries
|
|
key: v1-fuzz-binaries-${{ env.CARGO_FUZZ_VERSION }}-${{ env.FUZZ_RUST_TOOLCHAIN }}-all-${{ hashFiles('Cargo.toml', 'Cargo.lock', '.cargo/**', 'tests-fuzz/**', 'src/**') }}
|
|
- name: Pack prebuilt fuzz binaries
|
|
shell: bash
|
|
run: |
|
|
tar -C "${{ runner.temp }}" -cf "${{ runner.temp }}/fuzz-target-binaries.tar" \
|
|
greptime-fuzz-binaries
|
|
- name: Upload prebuilt fuzz binaries
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fuzz-target-binaries
|
|
path: ${{ runner.temp }}/fuzz-target-binaries.tar
|
|
compression-level: 0
|
|
retention-days: 1
|
|
if-no-files-found: error
|
|
|
|
fuzztest:
|
|
if: ${{ !cancelled() && github.repository == 'GreptimeTeam/greptimedb' && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' && inputs.ci_command) || github.event_name == 'merge_group') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || inputs.fuzz_profile == 'standalone' || inputs.fuzz_profile == 'all') && needs.build.result == 'success' && needs['prepare-fuzz-targets'].result == 'success' && needs.scope.outputs.fuzz_standalone != 'false' }}
|
|
name: Fuzz Test (Standalone, ${{ matrix.group.name }})
|
|
needs: [build, prepare-fuzz-targets, scope]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 2
|
|
matrix:
|
|
group:
|
|
- name: "Database and regular table"
|
|
id: "database-and-regular-table"
|
|
targets: |
|
|
fuzz_create_database
|
|
fuzz_create_table
|
|
fuzz_alter_table
|
|
fuzz_insert
|
|
- name: "Logical table"
|
|
id: "logical-table"
|
|
targets: |
|
|
fuzz_create_logical_table
|
|
fuzz_alter_logical_table
|
|
fuzz_insert_logical_table
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- name: Download prebuilt fuzz binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: fuzz-target-binaries
|
|
path: ${{ runner.temp }}
|
|
- name: Unpack and verify prebuilt fuzz binaries
|
|
uses: ./.github/actions/restore-fuzz-binaries
|
|
with:
|
|
directory: ${{ runner.temp }}
|
|
targets: ${{ matrix.group.targets }}
|
|
- name: Download pre-built binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bins
|
|
path: .
|
|
- name: Unzip binaries
|
|
run: |
|
|
tar -xvf ./bins.tar.gz
|
|
rm ./bins.tar.gz
|
|
- name: Run GreptimeDB
|
|
run: |
|
|
mkdir -p /tmp/greptime-fuzz-runtime
|
|
./bins/greptime standalone start >/tmp/greptime-fuzz-runtime/greptime.log 2>&1 &
|
|
- name: Fuzz Test
|
|
uses: ./.github/actions/fuzz-test
|
|
env:
|
|
RUSTUP_TOOLCHAIN: ${{ env.FUZZ_RUST_TOOLCHAIN }}
|
|
GT_MYSQL_ADDR: 127.0.0.1:4002
|
|
FUZZ_SERVICE_LOG: /tmp/greptime-fuzz-runtime/greptime.log
|
|
with:
|
|
targets: ${{ matrix.group.targets }}
|
|
group: ${{ matrix.group.id }}
|
|
max-total-time: 120
|
|
fail-fast: 'true'
|
|
prebuilt-binaries-dir: ${{ runner.temp }}/greptime-fuzz-binaries
|
|
- name: Collect setup failure artifacts
|
|
if: ${{ failure() && !cancelled() }}
|
|
shell: bash
|
|
env:
|
|
FUZZ_COLLECT_CLUSTER_ARTIFACTS: 'false'
|
|
FUZZ_SERVICE_LOG: /tmp/greptime-fuzz-runtime/greptime.log
|
|
FUZZ_GROUP: ${{ matrix.group.id }}
|
|
run: |
|
|
if [[ ! -f /tmp/greptime-fuzz-artifacts/manifest.json ]]; then
|
|
.github/scripts/collect-fuzz-target-artifacts.sh \
|
|
setup /tmp/greptime-fuzz-artifacts/targets/setup || true
|
|
fi
|
|
- name: Upload fuzz test artifacts
|
|
if: ${{ failure() && !cancelled() }}
|
|
uses: ./.github/actions/upload-fuzz-artifacts
|
|
with:
|
|
artifact-name: fuzz-standalone-${{ matrix.group.id }}
|
|
|
|
unstable-fuzztest:
|
|
if: ${{ !cancelled() && github.repository == 'GreptimeTeam/greptimedb' && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' && inputs.ci_command) || github.event_name == 'merge_group') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || inputs.fuzz_profile == 'standalone' || inputs.fuzz_profile == 'all') && needs['build-greptime-ci'].result == 'success' && needs['prepare-fuzz-targets'].result == 'success' && needs.scope.outputs.fuzz_unstable != 'false' }}
|
|
name: Unstable Fuzz Test
|
|
needs: [build-greptime-ci, prepare-fuzz-targets, scope]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- name: Download prebuilt fuzz binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: fuzz-target-binaries
|
|
path: ${{ runner.temp }}
|
|
- name: Unpack and verify prebuilt fuzz binaries
|
|
uses: ./.github/actions/restore-fuzz-binaries
|
|
with:
|
|
directory: ${{ runner.temp }}
|
|
targets: unstable_fuzz_create_table_standalone
|
|
- name: Download pre-built binary
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bin
|
|
path: .
|
|
- name: Unzip binary
|
|
run: |
|
|
tar -xvf ./bin.tar.gz
|
|
rm ./bin.tar.gz
|
|
- name: Run Fuzz Test
|
|
uses: ./.github/actions/fuzz-test
|
|
env:
|
|
RUSTUP_TOOLCHAIN: ${{ env.FUZZ_RUST_TOOLCHAIN }}
|
|
GT_MYSQL_ADDR: 127.0.0.1:4002
|
|
GT_FUZZ_BINARY_PATH: ./bin/greptime
|
|
GT_FUZZ_INSTANCE_ROOT_DIR: /tmp/greptime-fuzz-artifacts/targets/unstable_fuzz_create_table_standalone/service/instance/
|
|
with:
|
|
targets: unstable_fuzz_create_table_standalone
|
|
group: unstable-fuzz-create-table
|
|
max-total-time: 120
|
|
unstable: 'true'
|
|
fail-fast: 'true'
|
|
prebuilt-binaries-dir: ${{ runner.temp }}/greptime-fuzz-binaries
|
|
- name: Collect setup failure artifacts
|
|
if: ${{ failure() && !cancelled() }}
|
|
shell: bash
|
|
env:
|
|
FUZZ_COLLECT_CLUSTER_ARTIFACTS: 'false'
|
|
FUZZ_GROUP: unstable-fuzz-create-table
|
|
run: |
|
|
if [[ ! -f /tmp/greptime-fuzz-artifacts/manifest.json ]]; then
|
|
.github/scripts/collect-fuzz-target-artifacts.sh \
|
|
setup /tmp/greptime-fuzz-artifacts/targets/setup || true
|
|
fi
|
|
- name: Upload fuzz test artifacts
|
|
if: ${{ failure() && !cancelled() }}
|
|
uses: ./.github/actions/upload-fuzz-artifacts
|
|
with:
|
|
artifact-name: fuzz-unstable-standalone
|
|
|
|
build-greptime-ci:
|
|
if: ${{ !cancelled() && github.repository == 'GreptimeTeam/greptimedb' && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' && inputs.ci_command && inputs.fuzz_profile != 'none') || github.event_name == 'merge_group') && needs.scope.outputs.build_ci_needed != 'false' }}
|
|
name: Build GreptimeDB binary (profile-CI)
|
|
needs: [scope]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest ]
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: protoc@3.23.4
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
- name: Build Profile-CI Cache
|
|
id: build-greptime-ci-cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
# Shares across multiple jobs
|
|
shared-key: "build-greptime-ci"
|
|
cache-all-crates: "true"
|
|
cache-workspace-crates: "true"
|
|
save-if: ${{ github.event_name == 'pull_request' }}
|
|
- name: Report profile-CI cache lookup
|
|
shell: bash
|
|
run: |
|
|
{
|
|
printf '## Build profile-CI cache lookup\n\n'
|
|
printf -- '- Dependency cache: `%s`\n' "${{ steps.build-greptime-ci-cache.outputs.cache-hit }}"
|
|
} >>"${GITHUB_STEP_SUMMARY}"
|
|
- name: Install cargo-gc-bin
|
|
shell: bash
|
|
run: |
|
|
started_epoch="$(date +%s)"
|
|
cargo install cargo-gc-bin --force
|
|
elapsed_secs=$(( $(date +%s) - started_epoch ))
|
|
printf -- '- cargo-gc-bin install: **%ss**\n' "${elapsed_secs}" >>"${GITHUB_STEP_SUMMARY}"
|
|
- name: Build greptime binary
|
|
shell: bash
|
|
# `cargo gc` will invoke `cargo build` with specified args
|
|
run: |
|
|
started_epoch="$(date +%s)"
|
|
cargo gc --profile ci -- --bin greptime --features "pg_kvbackend,mysql_kvbackend"
|
|
elapsed_secs=$(( $(date +%s) - started_epoch ))
|
|
printf -- '- Profile-CI binary build: **%ss**\n' "${elapsed_secs}" >>"${GITHUB_STEP_SUMMARY}"
|
|
- name: Pack greptime binary
|
|
shell: bash
|
|
run: |
|
|
mkdir bin && \
|
|
mv ./target/ci/greptime bin
|
|
- name: Print greptime binaries info
|
|
run: ls -lh bin
|
|
- name: Upload artifacts
|
|
uses: ./.github/actions/upload-artifacts
|
|
with:
|
|
artifacts-dir: bin
|
|
version: current
|
|
|
|
distributed-fuzztest:
|
|
if: ${{ !cancelled() && github.repository == 'GreptimeTeam/greptimedb' && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' && inputs.ci_command) || github.event_name == 'merge_group') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || inputs.fuzz_profile == 'distributed' || inputs.fuzz_profile == 'all') && needs['build-greptime-ci'].result == 'success' && needs['prepare-fuzz-targets'].result == 'success' && needs.scope.outputs.fuzz_distributed != 'false' }}
|
|
name: Fuzz Test (Distributed, ${{ matrix.mode.name }}, ${{ matrix.group.name }})
|
|
runs-on: ubuntu-latest
|
|
needs: [build-greptime-ci, prepare-fuzz-targets, scope]
|
|
timeout-minutes: 60
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 4
|
|
matrix:
|
|
group:
|
|
- name: "Database and regular table"
|
|
id: "database-and-regular-table"
|
|
targets: |
|
|
fuzz_create_database
|
|
fuzz_create_table
|
|
fuzz_alter_table
|
|
fuzz_insert
|
|
- name: "Logical table"
|
|
id: "logical-table"
|
|
targets: |
|
|
fuzz_create_logical_table
|
|
fuzz_alter_logical_table
|
|
fuzz_insert_logical_table
|
|
mode:
|
|
- name: "Remote WAL"
|
|
id: "remote-wal"
|
|
minio: true
|
|
kafka: true
|
|
values: "with-remote-wal.yaml"
|
|
include:
|
|
- group:
|
|
name: "Repartition"
|
|
id: "repartition"
|
|
targets: |
|
|
fuzz_repartition_table
|
|
fuzz_repartition_metric_table
|
|
mode:
|
|
name: "Local WAL"
|
|
id: "local-wal"
|
|
minio: true
|
|
kafka: false
|
|
values: "with-minio-repartition-gc.yaml"
|
|
- group:
|
|
name: "Logical pruning"
|
|
id: "logical-pruning"
|
|
targets: "fuzz_remote_wal_logical_prune"
|
|
mode:
|
|
name: "Remote WAL logical pruning"
|
|
id: "remote-wal-logical-pruning"
|
|
minio: true
|
|
kafka: true
|
|
values: "with-remote-wal-logical-prune.yaml"
|
|
kafkaWalHelper: true
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- name: Setup Kind
|
|
uses: ./.github/actions/setup-kind
|
|
- if: matrix.mode.minio
|
|
name: Setup Minio
|
|
uses: ./.github/actions/setup-minio
|
|
- if: matrix.mode.kafka
|
|
name: Setup Kafka cluster
|
|
uses: ./.github/actions/setup-kafka-cluster
|
|
- name: Setup Etcd cluster
|
|
uses: ./.github/actions/setup-etcd-cluster
|
|
# Only the Kafka WAL helper needs the Rust toolchain.
|
|
- if: matrix.mode.kafkaWalHelper
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: protoc@3.23.4
|
|
- if: matrix.mode.kafkaWalHelper
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache: false
|
|
- if: matrix.mode.kafkaWalHelper
|
|
name: Kafka WAL Helper Cache
|
|
id: kafka-wal-helper-cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
prefix-key: "v1-kafka-wal-helper"
|
|
shared-key: "kafka-wal-helper"
|
|
workspaces: ". -> target"
|
|
cache-targets: "true"
|
|
cache-all-crates: "true"
|
|
save-if: ${{ github.event_name == 'pull_request' }}
|
|
- if: matrix.mode.kafkaWalHelper
|
|
name: Report Kafka WAL helper cache lookup
|
|
shell: bash
|
|
run: |
|
|
{
|
|
printf '## Kafka WAL helper cache lookup\n\n'
|
|
printf -- '- Dependency cache: `%s`\n' "${{ steps.kafka-wal-helper-cache.outputs.cache-hit }}"
|
|
} >>"${GITHUB_STEP_SUMMARY}"
|
|
- name: Download prebuilt fuzz binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: fuzz-target-binaries
|
|
path: ${{ runner.temp }}
|
|
- name: Unpack and verify prebuilt fuzz binaries
|
|
uses: ./.github/actions/restore-fuzz-binaries
|
|
with:
|
|
directory: ${{ runner.temp }}
|
|
targets: ${{ matrix.group.targets }}
|
|
# Downloads ci image
|
|
- name: Download pre-built binariy
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bin
|
|
path: .
|
|
- name: Unzip binary
|
|
run: |
|
|
tar -xvf ./bin.tar.gz
|
|
rm ./bin.tar.gz
|
|
- name: Build and push GreptimeDB image
|
|
uses: ./.github/actions/build-and-push-ci-image
|
|
- if: matrix.mode.kafkaWalHelper
|
|
name: Build Kafka WAL helper binary
|
|
shell: bash
|
|
run: |
|
|
started_epoch="$(date +%s)"
|
|
cargo build --bin kafka_wal_helper
|
|
elapsed_secs=$(( $(date +%s) - started_epoch ))
|
|
printf -- '- Kafka WAL helper build: **%ss**\n' "${elapsed_secs}" >>"${GITHUB_STEP_SUMMARY}"
|
|
mkdir -p amd64
|
|
cp target/debug/kafka_wal_helper amd64/kafka_wal_helper
|
|
- if: matrix.mode.kafkaWalHelper
|
|
name: Build and push Kafka WAL helper image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./docker/ci/ubuntu/Dockerfile.kafka-wal-helper
|
|
push: true
|
|
tags: localhost:5001/greptime/kafka-wal-helper:latest
|
|
build-args: |
|
|
TARGETARCH=amd64
|
|
TARGET_BIN=kafka_wal_helper
|
|
- name: Wait for etcd
|
|
run: |
|
|
kubectl wait \
|
|
--for=condition=Ready \
|
|
pod -l app.kubernetes.io/instance=etcd \
|
|
--timeout=120s \
|
|
-n etcd-cluster
|
|
- if: matrix.mode.minio
|
|
name: Wait for minio
|
|
run: |
|
|
kubectl wait \
|
|
--for=condition=Ready \
|
|
pod -l app=minio \
|
|
--timeout=120s \
|
|
-n minio
|
|
- if: matrix.mode.kafka
|
|
name: Wait for kafka
|
|
run: |
|
|
kubectl wait \
|
|
--for=condition=Ready \
|
|
pod -l app.kubernetes.io/instance=kafka \
|
|
--timeout=180s \
|
|
-n kafka-cluster
|
|
- if: matrix.mode.kafkaWalHelper
|
|
name: Setup Kafka WAL helper
|
|
shell: bash
|
|
run: |
|
|
kubectl -n kafka-cluster apply \
|
|
-f .github/actions/setup-greptimedb-cluster/kafka-wal-helper.yaml
|
|
|
|
kubectl rollout status deployment/kafka-wal-helper \
|
|
--timeout=120s \
|
|
-n kafka-cluster
|
|
- name: Print etcd info
|
|
shell: bash
|
|
run: kubectl get all --show-labels -n etcd-cluster
|
|
# Setup cluster for test
|
|
- name: Setup GreptimeDB cluster
|
|
uses: ./.github/actions/setup-greptimedb-cluster
|
|
with:
|
|
image-registry: localhost:5001
|
|
values-filename: ${{ matrix.mode.values }}
|
|
- name: Port forward (mysql)
|
|
run: |
|
|
kubectl port-forward service/my-greptimedb-frontend 4002:4002 -n my-greptimedb&
|
|
- if: matrix.mode.kafkaWalHelper
|
|
name: Port forward Kafka WAL helper
|
|
run: |
|
|
kubectl port-forward service/kafka-wal-helper 8080:8080 -n kafka-cluster&
|
|
- if: matrix.mode.kafka
|
|
name: Check Kafka readiness
|
|
shell: bash
|
|
run: |
|
|
.github/scripts/wait-kafka-ready.sh
|
|
- name: Fuzz Test
|
|
uses: ./.github/actions/fuzz-test
|
|
env:
|
|
RUSTUP_TOOLCHAIN: ${{ env.FUZZ_RUST_TOOLCHAIN }}
|
|
GT_MYSQL_ADDR: 127.0.0.1:4002
|
|
GT_KAFKA_WAL_HELPER_URL: http://127.0.0.1:8080
|
|
GT_KAFKA_ADDR: kafka.kafka-cluster.svc.cluster.local:9092
|
|
GT_WAL_TOPIC_PREFIX: greptimedb_wal_topic
|
|
GT_WAL_NUM_TOPICS: 3
|
|
GT_FUZZ_OVERRIDE_DELETE_AFTER_SECS: 300
|
|
with:
|
|
targets: ${{ matrix.group.targets }}
|
|
group: ${{ matrix.group.id }}
|
|
max-total-time: ${{ matrix.mode.kafkaWalHelper && 600 || 120 }}
|
|
fail-fast: 'true'
|
|
collect-cluster-artifacts: 'true'
|
|
prebuilt-binaries-dir: ${{ runner.temp }}/greptime-fuzz-binaries
|
|
- name: Collect setup failure artifacts
|
|
if: ${{ failure() && !cancelled() }}
|
|
shell: bash
|
|
env:
|
|
FUZZ_COLLECT_CLUSTER_ARTIFACTS: 'true'
|
|
GT_FUZZ_NS: my-greptimedb
|
|
GT_FUZZ_CLUSTER: my-greptimedb
|
|
GT_MONITOR_HTTP_LOCAL_PORT: 14000
|
|
FUZZ_GROUP: ${{ matrix.group.id }}
|
|
run: |
|
|
if [[ ! -f /tmp/greptime-fuzz-artifacts/manifest.json ]]; then
|
|
timeout --signal=TERM --kill-after=10s 180s \
|
|
.github/scripts/collect-fuzz-target-artifacts.sh \
|
|
setup /tmp/greptime-fuzz-artifacts/targets/setup || true
|
|
fi
|
|
- name: Upload fuzz test artifacts
|
|
if: ${{ failure() && !cancelled() }}
|
|
uses: ./.github/actions/upload-fuzz-artifacts
|
|
with:
|
|
artifact-name: fuzz-distributed-${{ matrix.mode.id }}-${{ matrix.group.id }}
|
|
- name: Delete cluster
|
|
if: success()
|
|
shell: bash
|
|
run: |
|
|
kind delete cluster
|
|
docker stop $(docker ps -a -q)
|
|
docker rm $(docker ps -a -q)
|
|
docker system prune -f
|
|
|
|
distributed-fuzztest-with-chaos:
|
|
if: ${{ !cancelled() && github.repository == 'GreptimeTeam/greptimedb' && ((github.event_name == 'pull_request' && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' && inputs.ci_command) || github.event_name == 'merge_group') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || inputs.fuzz_profile == 'chaos' || inputs.fuzz_profile == 'all') && needs['build-greptime-ci'].result == 'success' && needs['prepare-fuzz-targets'].result == 'success' && needs.scope.outputs.fuzz_chaos != 'false' }}
|
|
name: Fuzz Test with Chaos (Distributed, ${{ matrix.mode.name }}, ${{ matrix.group.name }})
|
|
runs-on: ubuntu-latest
|
|
needs: [build-greptime-ci, prepare-fuzz-targets, scope]
|
|
timeout-minutes: 60
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 4
|
|
matrix:
|
|
group:
|
|
- name: "Migration"
|
|
id: "migration"
|
|
targets: |
|
|
fuzz_migrate_mito_regions
|
|
fuzz_migrate_metric_regions
|
|
- name: "Failover"
|
|
id: "failover"
|
|
targets: |
|
|
fuzz_failover_mito_regions
|
|
fuzz_failover_metric_regions
|
|
mode:
|
|
- name: "Remote WAL"
|
|
id: "remote-wal"
|
|
minio: true
|
|
kafka: true
|
|
values: "with-remote-wal.yaml"
|
|
include:
|
|
- group:
|
|
name: "Migration"
|
|
id: "migration"
|
|
targets: |
|
|
fuzz_migrate_mito_regions
|
|
fuzz_migrate_metric_regions
|
|
mode:
|
|
name: "Local WAL"
|
|
id: "local-wal"
|
|
minio: true
|
|
kafka: false
|
|
values: "with-minio.yaml"
|
|
- group:
|
|
name: "Repartition"
|
|
id: "repartition"
|
|
targets: "fuzz_repartition_table_chaos"
|
|
mode:
|
|
name: "Local WAL repartition chaos"
|
|
id: "local-wal-repartition-chaos"
|
|
minio: true
|
|
kafka: false
|
|
values: "with-minio-repartition-gc.yaml"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- name: Setup Kind
|
|
uses: ./.github/actions/setup-kind
|
|
- name: Setup Chaos Mesh
|
|
uses: ./.github/actions/setup-chaos
|
|
- if: matrix.mode.minio
|
|
name: Setup Minio
|
|
uses: ./.github/actions/setup-minio
|
|
- if: matrix.mode.kafka
|
|
name: Setup Kafka cluster
|
|
uses: ./.github/actions/setup-kafka-cluster
|
|
- name: Setup Etcd cluster
|
|
uses: ./.github/actions/setup-etcd-cluster
|
|
- name: Download prebuilt fuzz binaries
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: fuzz-target-binaries
|
|
path: ${{ runner.temp }}
|
|
- name: Unpack and verify prebuilt fuzz binaries
|
|
uses: ./.github/actions/restore-fuzz-binaries
|
|
with:
|
|
directory: ${{ runner.temp }}
|
|
targets: ${{ matrix.group.targets }}
|
|
# Downloads ci image
|
|
- name: Download pre-built binariy
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: bin
|
|
path: .
|
|
- name: Unzip binary
|
|
run: |
|
|
tar -xvf ./bin.tar.gz
|
|
rm ./bin.tar.gz
|
|
- name: Build and push GreptimeDB image
|
|
uses: ./.github/actions/build-and-push-ci-image
|
|
- name: Wait for etcd
|
|
run: |
|
|
kubectl wait \
|
|
--for=condition=Ready \
|
|
pod -l app.kubernetes.io/instance=etcd \
|
|
--timeout=120s \
|
|
-n etcd-cluster
|
|
- if: matrix.mode.minio
|
|
name: Wait for minio
|
|
run: |
|
|
kubectl wait \
|
|
--for=condition=Ready \
|
|
pod -l app=minio \
|
|
--timeout=120s \
|
|
-n minio
|
|
- if: matrix.mode.kafka
|
|
name: Wait for kafka
|
|
run: |
|
|
kubectl wait \
|
|
--for=condition=Ready \
|
|
pod -l app.kubernetes.io/instance=kafka \
|
|
--timeout=180s \
|
|
-n kafka-cluster
|
|
- name: Print etcd info
|
|
shell: bash
|
|
run: kubectl get all --show-labels -n etcd-cluster
|
|
# Setup cluster for test
|
|
- name: Setup GreptimeDB cluster
|
|
uses: ./.github/actions/setup-greptimedb-cluster
|
|
with:
|
|
image-registry: localhost:5001
|
|
values-filename: ${{ matrix.mode.values }}
|
|
enable-region-failover: ${{ matrix.mode.kafka }}
|
|
- name: Port forward (mysql)
|
|
run: |
|
|
kubectl port-forward service/my-greptimedb-frontend 4002:4002 -n my-greptimedb&
|
|
- if: matrix.mode.kafka
|
|
name: Check Kafka readiness
|
|
shell: bash
|
|
run: |
|
|
.github/scripts/wait-kafka-ready.sh
|
|
- name: Fuzz Test
|
|
uses: ./.github/actions/fuzz-test
|
|
env:
|
|
RUSTUP_TOOLCHAIN: ${{ env.FUZZ_RUST_TOOLCHAIN }}
|
|
GT_MYSQL_ADDR: 127.0.0.1:4002
|
|
with:
|
|
targets: ${{ matrix.group.targets }}
|
|
group: ${{ matrix.group.id }}
|
|
max-total-time: 120
|
|
fail-fast: 'true'
|
|
collect-cluster-artifacts: 'true'
|
|
prebuilt-binaries-dir: ${{ runner.temp }}/greptime-fuzz-binaries
|
|
- name: Collect setup failure artifacts
|
|
if: ${{ failure() && !cancelled() }}
|
|
shell: bash
|
|
env:
|
|
FUZZ_COLLECT_CLUSTER_ARTIFACTS: 'true'
|
|
GT_FUZZ_NS: my-greptimedb
|
|
GT_FUZZ_CLUSTER: my-greptimedb
|
|
GT_MONITOR_HTTP_LOCAL_PORT: 14000
|
|
FUZZ_GROUP: ${{ matrix.group.id }}
|
|
run: |
|
|
if [[ ! -f /tmp/greptime-fuzz-artifacts/manifest.json ]]; then
|
|
timeout --signal=TERM --kill-after=10s 180s \
|
|
.github/scripts/collect-fuzz-target-artifacts.sh \
|
|
setup /tmp/greptime-fuzz-artifacts/targets/setup || true
|
|
fi
|
|
- name: Upload fuzz test artifacts
|
|
if: ${{ failure() && !cancelled() }}
|
|
uses: ./.github/actions/upload-fuzz-artifacts
|
|
with:
|
|
artifact-name: fuzz-distributed-chaos-${{ matrix.mode.id }}-${{ matrix.group.id }}
|
|
- name: Delete cluster
|
|
if: success()
|
|
shell: bash
|
|
run: |
|
|
kind delete cluster
|
|
docker stop $(docker ps -a -q)
|
|
docker rm $(docker ps -a -q)
|
|
docker system prune -f
|