Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore(ci): consolidate pull request checks into one workflow (#21435)

Danny Xu9a841ca576ec
diff --git a/.github/workflows/backend-tests-default.yml b/.github/workflows/backend-tests-default.yml
deleted file mode 100644
index a15fdb234c..0000000000
--- a/.github/workflows/backend-tests-default.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-name: Backend Tests
-
-on:
- pull_request:
- branches:
- - 'main'
- - 'release/*.*.*'
- paths-ignore:
- - 'backend/**'
- - 'go.mod'
- - 'proto/**/*.go'
- - 'action/**'
-
-permissions: {}
-
-jobs:
- go-tests:
- runs-on: ubuntu-latest
- steps:
- - run: 'echo "Not required"'
diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml
deleted file mode 100644
index 84b93fdd8b..0000000000
--- a/.github/workflows/backend-tests.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-name: Backend Tests
-
-on:
- pull_request:
- branches:
- - 'main'
- - 'release/*.*.*'
- paths:
- - 'backend/**'
- - 'go.mod'
- - 'proto/**/*.go'
- - 'action/**'
-
-permissions:
- contents: read
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-jobs:
- go-tests:
- runs-on: self-hosted
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v7
- - uses: actions/setup-go@v7
- with:
- go-version: '1.27.1'
- cache: false # Caching is slow.
- - name: Verify go.mod is tidy
- run: |
- go mod tidy
- git diff --exit-code
- - name: Run all tests
- # go test runs packages in command-line order. backend/tests is the
- # longest package by far, so it goes first instead of after the ~130
- # packages that sort before it alphabetically.
- run: go test -p=8 -timeout 30m -ldflags "-w -s" -v ./backend/tests ./backend/api/v1 ./backend/... ./action/... | tee test.log; exit ${PIPESTATUS[0]}
- - name: Pretty print tests running time
- # grep: filter out lines like "--- PASS: Test (15.04s)"
- # sed: remove unnecessary characters
- # awk: re-format lines to "PASS: Test (15.04s)"
- # sort: cut into columns by delimiter ' ' (single space) and sort by column 3 (test time in seconds) as numeric type in reverse order (largest comes first)
- # awk: accumulate sum by test time in seconds
- run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}'
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000000..328e581fb7
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,179 @@
+name: CI
+
+on:
+ pull_request:
+ branches:
+ - 'main'
+ - 'release/*.*.*'
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ detect-changed-files:
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ outputs:
+ go: ${{ steps.detect.outputs.go }}
+ frontend: ${{ steps.detect.outputs.frontend }}
+ proto: ${{ steps.detect.outputs.proto }}
+ steps:
+ # HEAD is the pull request's merge commit; its first parent is the base branch.
+ - uses: actions/checkout@v7
+ with:
+ fetch-depth: 2
+ sparse-checkout: .github
+ - name: Detect which areas changed
+ id: detect
+ run: |
+ files=$(git diff --name-only --no-renames HEAD^1 HEAD)
+ changed() { grep -qE "$1" <<<"$files" && echo true || echo false; }
+ go=$(changed '^(backend/|action/|proto/.*\.go$|go\.(mod|sum)$|\.golangci\.yaml$|\.github/workflows/ci\.yml$)')
+ # The frontend gate's `prepare` script also reads these backend files.
+ frontend=$(changed '^(frontend/|backend/enterprise/plan\.yaml$|backend/common/permission/permission\.yaml$|backend/api/mcp/gen/openapi\.yaml$|scripts/check_link_test\.go$|\.github/workflows/ci\.yml$)')
+ proto=$(changed '^(proto/|\.github/workflows/ci\.yml$)')
+ printf 'go=%s\nfrontend=%s\nproto=%s\n' "$go" "$frontend" "$proto" >> "$GITHUB_OUTPUT"
+ echo "Changed areas: go=$go, frontend=$frontend, proto=$proto. Checks for an unchanged area are skipped, and all-checks-passed counts a skipped check as passing." | tee -a "$GITHUB_STEP_SUMMARY"
+
+ go-tests:
+ needs: detect-changed-files
+ if: needs.detect-changed-files.outputs.go == 'true'
+ runs-on: self-hosted
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-go@v7
+ with:
+ go-version: '1.27.1'
+ cache: false # Caching is slow.
+ - name: Verify go.mod is tidy
+ run: |
+ go mod tidy
+ git diff --exit-code
+ - name: Run all tests
+ # go test runs packages in command-line order. backend/tests is the
+ # longest package by far, so it goes first instead of after the ~130
+ # packages that sort before it alphabetically.
+ run: go test -p=8 -timeout 30m -ldflags "-w -s" -v ./backend/tests ./backend/api/v1 ./backend/... ./action/... | tee test.log; exit ${PIPESTATUS[0]}
+ - name: Pretty print tests running time
+ # grep: filter out lines like "--- PASS: Test (15.04s)"
+ # sed: remove unnecessary characters
+ # awk: re-format lines to "PASS: Test (15.04s)"
+ # sort: cut into columns by delimiter ' ' (single space) and sort by column 3 (test time in seconds) as numeric type in reverse order (largest comes first)
+ # awk: accumulate sum by test time in seconds
+ run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}'
+
+ golangci-lint:
+ needs: detect-changed-files
+ if: needs.detect-changed-files.outputs.go == 'true'
+ runs-on: self-hosted
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-go@v7
+ with:
+ go-version: '1.27.1'
+ cache: false # Caching is slow.
+ - name: Install golangci-lint
+ uses: golangci/golangci-lint-action@v9
+ with:
+ # renovate: datasource=github-releases depName=golangci/golangci-lint
+ version: v2.13.2
+ install-only: true
+ skip-cache: true
+ - name: Verify Go version compatibility
+ run: |
+ GO_MAJOR_MINOR=$(go env GOVERSION | sed 's/go//' | cut -d. -f1-2)
+ LINT_GO=$(golangci-lint version --json 2>/dev/null | jq -r '.go // empty' || true)
+ if [ -z "$LINT_GO" ]; then
+ echo "Skipping compatibility check: unable to read golangci-lint Go version"
+ exit 0
+ fi
+ LINT_MAJOR_MINOR=$(echo "$LINT_GO" | sed 's/go//' | cut -d. -f1-2)
+ if [ "$GO_MAJOR_MINOR" != "$LINT_MAJOR_MINOR" ]; then
+ echo "::error::Go version mismatch: setup-go provides go${GO_MAJOR_MINOR} but golangci-lint was built with go${LINT_MAJOR_MINOR}. Update golangci-lint to a version built with go${GO_MAJOR_MINOR}."
+ exit 1
+ fi
+ - name: golangci-lint
+ env:
+ # Go's default GOGC=100 collects every time a ~5 GB live heap doubles, which
+ # is the wrong policy for a batch run. Collecting near a target instead is
+ # cheaper on CPU, wall and peak RSS alike. GOMEMLIMIT is a soft limit over
+ # Go-managed memory, not a guaranteed RSS ceiling, but it holds in practice
+ # here: 10.17 GB peak measured, against 11.05 GB with the default.
+ GOGC: "off"
+ GOMEMLIMIT: 10GiB
+ run: golangci-lint run --verbose -j 8 --timeout 30m --max-same-issues=30 --allow-parallel-runners
+
+ frontend-tests:
+ needs: detect-changed-files
+ if: needs.detect-changed-files.outputs.frontend == 'true'
+ runs-on: self-hosted
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-node@v7
+ with:
+ node-version: '24.18.1'
+ # The runner's pnpm store persists between runs, so the Actions
+ # cache adds nothing and downloading it is slow.
+ cache: ''
+ - uses: pnpm/setup@v2
+ with:
+ version: '11.17.0'
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+ working-directory: frontend
+ # Single gate, identical to what contributors run locally. The stages
+ # it runs are listed in frontend/scripts/run-gate.mjs.
+ - name: Test
+ run: pnpm test
+ working-directory: frontend
+ - uses: actions/setup-go@v7
+ with:
+ go-version: '1.27.1'
+ cache: false # Caching is slow.
+ - name: Validate links
+ run: go test -timeout 600s -v ./scripts/...
+
+ lint-protos:
+ needs: detect-changed-files
+ if: needs.detect-changed-files.outputs.proto == 'true'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ pull-requests: write
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ fetch-depth: 0
+ - name: buf
+ uses: bufbuild/buf-action@v1
+ with:
+ input: "proto"
+ breaking: false
+ token: ${{ secrets.BUF_TOKEN }}
+
+ # The only check the main ruleset requires, so every job that must pass
+ # belongs in `needs`.
+ all-checks-passed:
+ needs: [detect-changed-files, go-tests, golangci-lint, frontend-tests, lint-protos]
+ # always() on the job and its step: a cancelled run must fail this check, not skip it.
+ if: always()
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - name: Fail if any job failed or was cancelled
+ if: always()
+ env:
+ NEEDS: ${{ toJSON(needs) }}
+ run: |
+ jq -r 'to_entries[] | "- \(.key): \(.value.result)"' <<<"$NEEDS" | tee -a "$GITHUB_STEP_SUMMARY"
+ failed=$(jq -r 'to_entries[] | select(.value.result == "failure" or .value.result == "cancelled") | .key' <<<"$NEEDS")
+ for job in $failed; do echo "::error::$job did not pass"; done
+ [ -z "$failed" ] || exit 1
diff --git a/.github/workflows/frontend-tests-default.yml b/.github/workflows/frontend-tests-default.yml
deleted file mode 100644
index 2b5952db3e..0000000000
--- a/.github/workflows/frontend-tests-default.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
-name: Frontend Tests
-
-on:
- pull_request:
- branches:
- - 'main'
- - 'release/*.*.*'
- paths-ignore:
- - 'frontend/**'
-
-permissions: {}
-
-jobs:
- frontend-tests:
- runs-on: ubuntu-latest
- steps:
- - run: 'echo "Not required"'
diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.yml
deleted file mode 100644
index 139f15b6a3..0000000000
--- a/.github/workflows/frontend-tests.yml
+++ /dev/null
@@ -1,40 +0,0 @@
-name: Frontend Tests
-
-on:
- pull_request:
- branches:
- - main
- - 'release/*.*.*'
- paths:
- - 'frontend/**'
-
-permissions:
- contents: read
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-jobs:
- frontend-tests:
- runs-on: self-hosted
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v7
- - uses: actions/setup-node@v7
- with:
- node-version: '24.18.1'
- # The runner's pnpm store persists between runs, so the Actions
- # cache adds nothing and downloading it is slow.
- cache: ''
- - uses: pnpm/setup@v2
- with:
- version: '11.17.0'
- - name: Install dependencies
- run: pnpm install --frozen-lockfile
- working-directory: frontend
- # Single gate, identical to what contributors run locally. The stages
- # it runs are listed in frontend/scripts/run-gate.mjs.
- - name: Test
- run: pnpm test
- working-directory: frontend
diff --git a/.github/workflows/golangci-lint-default.yml b/.github/workflows/golangci-lint-default.yml
deleted file mode 100644
index 3e6d201ea6..0000000000
--- a/.github/workflows/golangci-lint-default.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
-name: golangci-lint
-
-on:
- pull_request:
- branches:
- - 'main'
- - 'release/*.*.*'
- paths-ignore:
- - 'backend/**'
- - 'action/**'
- - 'go.mod'
- - 'proto/**/*.go'
-
-permissions: {}
-
-jobs:
- golangci-lint:
- runs-on: ubuntu-latest
- steps:
- - run: 'echo "Not required"'
diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
deleted file mode 100644
index 2967cece12..0000000000
--- a/.github/workflows/golangci-lint.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-name: golangci-lint
-
-on:
- pull_request:
- branches:
- - 'main'
- - 'release/*.*.*'
- paths:
- - 'backend/**'
- - 'action/**'
- - 'go.mod'
- - 'proto/**/*.go'
- - '.golangci.yaml'
-
-permissions:
- contents: read
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-jobs:
- golangci-lint:
- runs-on: self-hosted
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v7
- - uses: actions/setup-go@v7
- with:
- go-version: '1.27.1'
- cache: false # Caching is slow.
- - name: Install golangci-lint
- uses: golangci/golangci-lint-action@v9
- with:
- # renovate: datasource=github-releases depName=golangci/golangci-lint
- version: v2.13.2
- install-only: true
- skip-cache: true
- - name: Verify Go version compatibility
- run: |
- GO_MAJOR_MINOR=$(go env GOVERSION | sed 's/go//' | cut -d. -f1-2)
- LINT_GO=$(golangci-lint version --json 2>/dev/null | jq -r '.go // empty' || true)
- if [ -z "$LINT_GO" ]; then
- echo "Skipping compatibility check: unable to read golangci-lint Go version"
- exit 0
- fi
- LINT_MAJOR_MINOR=$(echo "$LINT_GO" | sed 's/go//' | cut -d. -f1-2)
- if [ "$GO_MAJOR_MINOR" != "$LINT_MAJOR_MINOR" ]; then
- echo "::error::Go version mismatch: setup-go provides go${GO_MAJOR_MINOR} but golangci-lint was built with go${LINT_MAJOR_MINOR}. Update golangci-lint to a version built with go${GO_MAJOR_MINOR}."
- exit 1
- fi
- - name: golangci-lint
- env:
- # Go's default GOGC=100 collects every time a ~5 GB live heap doubles, which
- # is the wrong policy for a batch run. Collecting near a target instead is
- # cheaper on CPU, wall and peak RSS alike. GOMEMLIMIT is a soft limit over
- # Go-managed memory, not a guaranteed RSS ceiling, but it holds in practice
- # here: 10.17 GB peak measured, against 11.05 GB with the default.
- GOGC: "off"
- GOMEMLIMIT: 10GiB
- run: golangci-lint run --verbose -j 8 --timeout 30m --max-same-issues=30 --allow-parallel-runners
\ No newline at end of file
diff --git a/.github/workflows/proto-linter-default.yml b/.github/workflows/proto-linter-default.yml
deleted file mode 100644
index 663f24e2ad..0000000000
--- a/.github/workflows/proto-linter-default.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-name: Proto linter
-
-on:
- pull_request:
- branches:
- - 'main'
- paths-ignore:
- - 'proto/**'
-
-permissions: {}
-
-jobs:
- lint-protos:
- runs-on: ubuntu-latest
- steps:
- - run: 'echo "Not required"'
diff --git a/.github/workflows/proto-linter.yml b/.github/workflows/proto-linter.yml
deleted file mode 100644
index 1bf367cefa..0000000000
--- a/.github/workflows/proto-linter.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Proto linter
-
-on:
- pull_request:
- branches:
- - 'main'
- paths:
- - 'proto/**'
-
-permissions:
- contents: read
- pull-requests: write
-
-jobs:
- lint-protos:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v7
- with:
- fetch-depth: 0
- - name: buf
- uses: bufbuild/buf-action@v1
- with:
- input: "proto"
- breaking: false
- token: ${{ secrets.BUF_TOKEN }}
diff --git a/.github/workflows/test_link.yml b/.github/workflows/test_link.yml
deleted file mode 100644
index 26a057677d..0000000000
--- a/.github/workflows/test_link.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: Release Test Link
-
-on:
- workflow_dispatch:
- pull_request:
- branches:
- - 'main'
- paths:
- - 'frontend/**'
-
-permissions:
- contents: read
-
-jobs:
- link-tests:
- runs-on: self-hosted
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@v7
- - uses: actions/setup-go@v7
- with:
- go-version: '1.27.1'
- cache: false # Caching is slow.
- - name: Validate links
- run: go test -timeout 600s -v ./scripts/... | tee test.log; exit ${PIPESTATUS[0]}
diff --git a/.github/workflows/test_link_default.yml b/.github/workflows/test_link_default.yml
deleted file mode 100644
index 54eb0c9b02..0000000000
--- a/.github/workflows/test_link_default.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-name: Release Test Link
-
-on:
- workflow_dispatch:
- pull_request:
- branches:
- - 'main'
- paths-ignore:
- - 'frontend/**'
-
-permissions: {}
-
-jobs:
- go-tests:
- runs-on: ubuntu-latest
- steps:
- - run: 'echo "Not required"'
diff --git a/docs/design/devbox-and-ci-runner.md b/docs/design/devbox-and-ci-runner.md
index b121e77356..15e1d0e448 100644
--- a/docs/design/devbox-and-ci-runner.md
+++ b/docs/design/devbox-and-ci-runner.md
@@ -255,9 +255,9 @@ and `node_modules` — which is right for anything inside a working copy.
### c. GitHub runners
Two accounts, two job slots, one systemd template. A pull request touching both
-backend and frontend schedules five self-hosted jobs -- one each from `backend-tests`,
-`golangci-lint` and `test_link`, two from `frontend-tests` -- so three of them queue,
-before counting any other repository in the org. That is deliberate: jobs queue, they
+backend and frontend schedules three self-hosted jobs from `ci.yml` -- `go-tests`,
+`golangci-lint` and `frontend-tests` -- so one of them queues, before counting any
+other repository in the org. That is deliberate: jobs queue, they
do not fail. It began as four slots, five cores and 8 GB each, and that oversubscribed
the box: a Go build or a frontend build uses every core it can find, and four at once
pushed the load average past 60 on 20 vCPUs; the one runner hang seen so far happened
diff --git a/docs/design/v1-api-audit-2026-09.md b/docs/design/v1-api-audit-2026-09.md
index 2a051272a2..3915508b16 100644
--- a/docs/design/v1-api-audit-2026-09.md
+++ b/docs/design/v1-api-audit-2026-09.md
@@ -104,7 +104,7 @@ not a gate. The house pattern that already works for behavior is the descriptor-
`TestAllowMissingCreatePermission` — and A1 and A3 below are two more of those.
The gate is the linter. `buf lint`'s BASIC profile, the only check CI runs
-(`.github/workflows/proto-linter.yml:22`), sees none of the 575, which is how they accumulated. A
+(`.github/workflows/ci.yml:155`), sees none of the 575, which is how they accumulated. A
ratchet — run `api-linter --output-format json`, compare the count against `main`, fail on
increase — is one workflow step and holds the line while the 211 are burned down; once they are,
`--set-exit-status` with the suppressions in place becomes the gate.
diff --git a/frontend/src/routes/auth/SigninPage.tsx b/frontend/src/routes/auth/SigninPage.tsx
index 0399d0647e..8a5408bf99 100644
--- a/frontend/src/routes/auth/SigninPage.tsx
+++ b/frontend/src/routes/auth/SigninPage.tsx
@@ -294,7 +294,7 @@ export function SigninPage(props: SigninPageProps) {
// with the localized text inside <terms>/<privacy> tags.
terms: (
<a
- href="https://www.bytebase.com/terms"
+ href="https://www.bytebase.com/legal/terms"
target="_blank"
rel="noopener noreferrer"
className="underline hover:text-control"
diff --git a/frontend/src/routes/auth/SignupPage.tsx b/frontend/src/routes/auth/SignupPage.tsx
index 7182322f44..2448debeff 100644
--- a/frontend/src/routes/auth/SignupPage.tsx
+++ b/frontend/src/routes/auth/SignupPage.tsx
@@ -192,7 +192,7 @@ export function SignupPage() {
components={{
terms: (
<a
- href="https://www.bytebase.com/terms?source=console"
+ href="https://www.bytebase.com/legal/terms?source=console"
className="text-accent"
/>
),
diff --git a/frontend/src/routes/workspace/PurchaseSection.tsx b/frontend/src/routes/workspace/PurchaseSection.tsx
index f48601b466..adf08cac26 100644
--- a/frontend/src/routes/workspace/PurchaseSection.tsx
+++ b/frontend/src/routes/workspace/PurchaseSection.tsx
@@ -536,7 +536,7 @@ export function PurchaseSection({ onRequireEnterprise }: PurchaseSectionProps) {
<span>
{t("subscription.purchase.accept-terms-prefix")}{" "}
<a
- href="https://www.bytebase.com/terms"
+ href="https://www.bytebase.com/legal/terms"
target="_blank"
rel="noopener noreferrer"
className="underline hover:text-main"