chore(ci): merge main and preserve helper tooling tests

Signed-off-by: WenyXu <wenymedia@gmail.com>
This commit is contained in:
WenyXu
2026-10-29 07:56:44 +00:00
172 changed files with 14721 additions and 4351 deletions
+19 -36
View File
@@ -71,45 +71,28 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
- uses: ./.github/actions/github-script-tests
scope-rules:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
name: CI Scope Rules
# Same runner image as the `scope` job in integration.yml: if the rules file
# stops parsing there, the gate silently runs every job, so this check exists
# to fail the pull request instead.
runs-on: ubuntu-slim
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
node-version: 24
- name: Run Node GitHub script tests
run: node --test .github/scripts/query-regression-comment.test.cjs
- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Run check-version script tests
run: uv run --no-project python .github/scripts/check-version-test.py
- name: Run release Linux architecture tests
run: python3 .github/scripts/release-linux-architectures-test.py
- name: Run previous-release-tag script tests
run: python3 .github/scripts/previous-release-tag-test.py
- name: Run enterprise license check tests
run: python3 scripts/check-enterprise-license-test.py
- name: Run fuzz orchestration script tests
run: .github/scripts/run-fuzz-targets-test.sh
- name: Run CI comment-command tests
run: python3 .github/scripts/tests/test_ci_slash.py
- name: Run metric snapshot benchmark tests
run: python3 -m unittest discover -s .github/scripts/tests -p 'test_metric_snapshot*.py'
- name: Run query-regression Python tooling tests
run: |
python3 tests/perf/test_query_regression_runner_compaction_toctou.py
python3 tests/perf/test_query_regression_runner_otlp_trace_load.py
python3 tests/perf/test_query_regression_summary_otlp.py
python3 tests/perf/test_query_regression_case_selection.py
python3 tests/perf/test_query_regression_helpers.py
python3 tests/perf/test_query_regression_nightly_refs.py
python3 tests/perf/test_query_regression_slash.py
python3 tests/perf/test_aliyun_ecs_runner_scripts.py
python3 tests/perf/test_ci_runner_scripts.py
python3 tests/perf/test_agent_observability_summary.py
python3 tests/perf/test_tracesbench_summary.py
persist-credentials: false
- name: Show the interpreter
run: python3 -VV
- name: Validate .github/ci/scope-rules.toml
run: python3 .github/ci/ci_scope_rules.py --check-paths
check:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
if: ${{ needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
needs: [github-script-tests]
name: Check
runs-on: ${{ matrix.os }}
strategy:
+145 -46
View File
@@ -21,7 +21,7 @@ on:
default: false
type: boolean
fuzz_profile:
description: Fuzz profile selected by /ci fuzz
description: Fuzz profile for a manual run or /ci fuzz
required: false
default: none
type: choice
@@ -42,8 +42,71 @@ concurrency:
cancel-in-progress: true
jobs:
build:
github-script-tests:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
name: GitHub Script Tests (Integration CI)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/github-script-tests
# 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: ${{ needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
needs: [github-script-tests]
name: Build GreptimeDB binaries
runs-on: ${{ matrix.os }}
strategy:
@@ -104,9 +167,9 @@ jobs:
version: current
sqlness:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
if: ${{ needs['github-script-tests'].result == 'success' && 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
needs: [github-script-tests, build]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -116,28 +179,12 @@ jobs:
- name: "Basic"
opts: ""
kafka: false
postgres: false
mysql: false
- name: "Remote WAL"
opts: "-w kafka -k 127.0.0.1:9092"
kafka: true
postgres: false
mysql: false
- name: "PostgreSQL KvBackend"
opts: "--setup-pg postgresql://greptimedb:admin@127.0.0.1:5432/postgres"
kafka: false
postgres: true
mysql: false
- name: "MySQL KvBackend"
opts: "--setup-mysql mysql://greptimedb:admin@127.0.0.1:3306/mysql"
kafka: false
postgres: false
mysql: true
- name: "Flat format"
opts: "--enable-flat-format"
kafka: false
postgres: false
mysql: false
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
@@ -149,16 +196,6 @@ jobs:
working-directory: tests-integration/fixtures
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait kafka
- 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:
@@ -183,10 +220,68 @@ jobs:
/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() && needs['github-script-tests'].result == 'success' && 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: [github-script-tests, 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: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
if: ${{ !cancelled() && needs['github-script-tests'].result == 'success' && 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: build
needs: [github-script-tests, scope, build]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
@@ -254,9 +349,9 @@ jobs:
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) }}
if: ${{ needs['github-script-tests'].result == 'success' && 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
needs: [github-script-tests, build]
uses: ./.github/workflows/run-multi-lang-tests.yml
with:
artifact-name: bins
@@ -279,9 +374,9 @@ jobs:
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)))) }}
if: ${{ needs['github-script-tests'].result == 'success' && 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
needs: [github-script-tests, build]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@@ -318,9 +413,12 @@ jobs:
path: /tmp/sqlness-compat*
retention-days: 3
# Fuzz runs on opening a ready PR, marking it ready, manual dispatch, and
# the scheduled main run. Synchronize events keep the core integration tests.
prepare-fuzz-targets:
if: ${{ 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 == 'pull_request' || inputs.fuzz_profile != 'none') }}
if: ${{ !cancelled() && needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action == 'opened' || github.event.action == 'ready_for_review')) || (github.event_name == 'workflow_dispatch' && (inputs.fuzz_profile != 'none'))) && needs.scope.outputs.any_fuzz != 'false' }}
name: Prepare Fuzz Targets
needs: [github-script-tests, scope]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
@@ -433,9 +531,9 @@ jobs:
if-no-files-found: error
fuzztest:
if: ${{ 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 == 'pull_request' || inputs.fuzz_profile == 'standalone' || inputs.fuzz_profile == 'all') }}
if: ${{ !cancelled() && needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action == 'opened' || github.event.action == 'ready_for_review')) || (github.event_name == 'workflow_dispatch' && (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]
needs: [github-script-tests, build, prepare-fuzz-targets, scope]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
@@ -514,9 +612,9 @@ jobs:
artifact-name: fuzz-standalone-${{ matrix.group.id }}
unstable-fuzztest:
if: ${{ 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 == 'pull_request' || inputs.fuzz_profile == 'standalone' || inputs.fuzz_profile == 'all') }}
if: ${{ !cancelled() && needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action == 'opened' || github.event.action == 'ready_for_review')) || (github.event_name == 'workflow_dispatch' && (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]
needs: [github-script-tests, build-greptime-ci, prepare-fuzz-targets, scope]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
@@ -574,8 +672,9 @@ jobs:
artifact-name: fuzz-unstable-standalone
build-greptime-ci:
if: ${{ 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')) }}
if: ${{ !cancelled() && needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action == 'opened' || github.event.action == 'ready_for_review')) || (github.event_name == 'workflow_dispatch' && (inputs.fuzz_profile != 'none'))) && needs.scope.outputs.build_ci_needed != 'false' }}
name: Build GreptimeDB binary (profile-CI)
needs: [github-script-tests, scope]
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -634,10 +733,10 @@ jobs:
version: current
distributed-fuzztest:
if: ${{ 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 == 'pull_request' || inputs.fuzz_profile == 'distributed' || inputs.fuzz_profile == 'all') }}
if: ${{ !cancelled() && needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action == 'opened' || github.event.action == 'ready_for_review')) || (github.event_name == 'workflow_dispatch' && (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]
needs: [github-script-tests, build-greptime-ci, prepare-fuzz-targets, scope]
timeout-minutes: 60
strategy:
fail-fast: false
@@ -873,10 +972,10 @@ jobs:
docker system prune -f
distributed-fuzztest-with-chaos:
if: ${{ 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 == 'pull_request' || inputs.fuzz_profile == 'chaos' || inputs.fuzz_profile == 'all') }}
if: ${{ !cancelled() && needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action == 'opened' || github.event.action == 'ready_for_review')) || (github.event_name == 'workflow_dispatch' && (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]
needs: [github-script-tests, build-greptime-ci, prepare-fuzz-targets, scope]
timeout-minutes: 60
strategy:
fail-fast: false
+142
View File
@@ -0,0 +1,142 @@
# Setup and behavior: .github/nightly-merge.md
name: Nightly Merge
on:
pull_request_target:
types: [opened, edited, reopened]
schedule:
# Hourly from 02:10 through 08:10 Asia/Shanghai (UTC+8), inclusive.
# GitHub may delay scheduled runs.
- cron: '10 0,18-23 * * *'
workflow_dispatch:
inputs:
dry_run:
description: List eligible PRs without adding them to the merge queue
type: boolean
default: true
permissions: {}
jobs:
sync-label:
if: github.repository == 'GreptimeTeam/greptimedb' && github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
# PR label mutations require pull-request write permission.
pull-requests: write
issues: write
concurrency:
group: nightly-merge-label-${{ github.event.pull_request.number }}
cancel-in-progress: false
steps:
# No checkout: PR contents are untrusted data, never executable code.
- uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number: issue_number });
const checkbox = /^- \[([ xX])\] Merge during the nightly window <!-- nightly-merge -->\s*$/m.exec(pr.body || '');
// PRs without the template manage their opt-in through the label.
if (!checkbox) return;
const selected = checkbox[1].toLowerCase() === 'x';
const label = 'merge nightly';
const labeled = pr.labels.some(item => item.name === label);
if (selected && !labeled) {
await github.rest.issues.addLabels({ owner, repo, issue_number, labels: [label] });
} else if (!selected && labeled) {
await github.rest.issues.removeLabel({ owner, repo, issue_number, name: label });
}
enqueue:
if: github.repository == 'GreptimeTeam/greptimedb' && github.event_name != 'pull_request_target'
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency:
group: nightly-merge-enqueue
cancel-in-progress: false
steps:
# Reuses the automation credential used by backport and compat updates.
# A PAT (or App token) lets subsequent merge_group workflows run.
- uses: actions/github-script@v7
env:
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
script: |
const { owner, repo } = context.repo;
const dryRun = process.env.DRY_RUN === 'true';
const candidates = await github.paginate(github.rest.issues.listForRepo, {
owner, repo, state: 'open', labels: 'merge nightly',
sort: 'created', direction: 'asc', per_page: 100
});
const rows = [];
let enqueued = 0;
for (const candidate of candidates) {
if (!candidate.pull_request || enqueued >= 5) continue;
const number = candidate.number;
try {
// Fetch current labels and PR state, not the earlier list snapshot.
const { data: current } = await github.rest.pulls.get({ owner, repo, pull_number: number });
if (current.state !== 'open' || current.draft || current.base.ref !== 'main' ||
!current.labels.some(label => label.name === 'merge nightly')) {
rows.push([String(number), 'Skipped: not opted in, draft, closed, or not targeting main']);
continue;
}
const { repository: { pullRequest: pr } } = await github.graphql(`
query($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
id headRefOid reviewDecision mergeStateStatus
mergeQueueEntry { id }
autoMergeRequest { enabledAt }
}
}
}`, { owner, repo, number });
if (pr.mergeQueueEntry || pr.autoMergeRequest ||
pr.reviewDecision !== 'APPROVED' || pr.mergeStateStatus !== 'CLEAN') {
rows.push([String(number), 'Skipped: already queued/auto-merge enabled, or not approved and clean']);
continue;
}
let cursor = null;
let unresolved = false;
do {
const { repository: { pullRequest: { reviewThreads } } } = await github.graphql(`
query($owner: String!, $repo: String!, $number: Int!, $cursor: String) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
reviewThreads(first: 100, after: $cursor) {
nodes { isResolved }
pageInfo { hasNextPage endCursor }
}
}
}
}`, { owner, repo, number, cursor });
unresolved = reviewThreads.nodes.some(thread => !thread.isResolved);
cursor = reviewThreads.pageInfo.hasNextPage ? reviewThreads.pageInfo.endCursor : null;
} while (cursor && !unresolved);
if (unresolved) {
rows.push([String(number), 'Skipped: unresolved review threads']);
continue;
}
if (!dryRun) {
// GitHub enforces branch rules; never bypass or enable auto-merge.
await github.graphql(`
mutation($id: ID!, $sha: GitObjectID!) {
enqueuePullRequest(input: {pullRequestId: $id, expectedHeadOid: $sha}) {
mergeQueueEntry { id }
}
}`, { id: pr.id, sha: pr.headRefOid });
}
enqueued++;
rows.push([String(number), dryRun ? 'Would enqueue' : 'Enqueued']);
} catch (error) {
core.warning(`PR #${number}: ${error.message}`);
rows.push([String(number), 'Failed: see workflow logs']);
core.setFailed('Some PRs could not be processed; see workflow logs.');
}
}
for (const [number, result] of rows) core.info(`PR #${number}: ${result}`);
await core.summary.addHeading(dryRun ? 'Nightly merge (dry run)' : 'Nightly merge')
.addTable([['PR', 'Result'], ...rows]).write();
+23 -48
View File
@@ -31,6 +31,17 @@ concurrency:
cancel-in-progress: true
jobs:
github-script-tests:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
name: GitHub Script Tests (Rust CI)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/github-script-tests
fmt:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
name: Rustfmt
@@ -50,7 +61,8 @@ jobs:
run: make fmt-check
clippy:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
if: ${{ needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
needs: [github-script-tests]
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 60
@@ -94,7 +106,9 @@ jobs:
run: make check-udeps
check-riscv64:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
# Keep platform coverage on the weekday schedule and allow manual checks.
if: ${{ needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
needs: [github-script-tests]
name: Check riscv64 build
runs-on: ubuntu-latest
timeout-minutes: 90
@@ -120,7 +134,9 @@ jobs:
run: cargo check --locked --workspace --all-targets --features servers/dashboard --target riscv64gc-unknown-linux-gnu
check-windows:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
# Keep platform coverage on the weekday schedule and allow manual checks.
if: ${{ needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
needs: [github-script-tests]
name: Check Windows build
runs-on: windows-2022
timeout-minutes: 60
@@ -148,48 +164,6 @@ jobs:
env:
RUSTFLAGS: "-D warnings"
test-windows:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false) }}
name: Test Windows
runs-on: windows-2022
timeout-minutes: 90
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
RUSTFLAGS: "-D warnings -C linker=lld-link"
RUST_BACKTRACE: 1
RUST_MIN_STACK: 8388608 # 8MB
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/setup-cyborg
- uses: taiki-e/install-action@v2
with:
tool: protoc@3.23.4
- uses: KyleMayes/install-llvm-action@v1
with:
version: "14.0"
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-windows"
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install Cargo Nextest
uses: taiki-e/install-action@nextest
- name: Install WSL distribution
uses: Vampire/setup-wsl@v2
with:
distribution: Ubuntu-22.04
- name: Run Windows tests
run: cargo nextest run --locked --workspace -F dashboard --no-fail-fast
conflict-check:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
name: Check for conflict
@@ -202,10 +176,10 @@ jobs:
uses: olivernybroe/action-conflict-finder@v4.0
test:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && github.event_name != 'merge_group' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
if: ${{ needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && github.event_name != 'merge_group' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || github.run_attempt > 1) }}
runs-on: ubuntu-22.04-arm
timeout-minutes: 60
needs: [conflict-check, clippy, fmt, check-udeps]
needs: [github-script-tests, conflict-check, clippy, fmt, check-udeps]
steps:
- uses: actions/checkout@v4
with:
@@ -258,7 +232,8 @@ jobs:
UNITTEST_LOG_DIR: "__unittest_logs"
coverage:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && github.event_name == 'merge_group' }}
if: ${{ needs['github-script-tests'].result == 'success' && github.repository == 'GreptimeTeam/greptimedb' && github.event_name == 'merge_group' }}
needs: [github-script-tests]
runs-on: ubuntu-22.04-8-cores
timeout-minutes: 60
steps: