ci: Add check for protobuf formatting (#50418)

This adds more checks for the protobuf files to CI

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <anthony@zed.dev>
This commit is contained in:
Finn Evers 2026-03-01 13:18:09 +01:00 committed by GitHub
parent a66d37a448
commit 14358b711c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 1 deletions

View file

@ -700,6 +700,10 @@ jobs:
with:
input: crates/proto/proto/
against: https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/
- name: run_tests::check_postgres_and_protobuf_migrations::buf_lint
run: buf lint crates/proto/proto
- name: run_tests::check_postgres_and_protobuf_migrations::check_protobuf_formatting
run: buf format --diff --exit-code crates/proto/proto
timeout-minutes: 60
tests_pass:
needs:

View file

@ -2,3 +2,13 @@ version: v1
breaking:
use:
- WIRE
lint:
except:
# Since we use post_build instead of buf this doesn't matter
- PACKAGE_DIRECTORY_MATCH
# This is internal to Zed only so we don't enforce versions
- PACKAGE_VERSION_SUFFIX
# Style rules we don't enforce
- ENUM_VALUE_PREFIX
- ENUM_VALUE_UPPER_SNAKE_CASE
- ENUM_ZERO_VALUE_SUFFIX

View file

@ -16,4 +16,8 @@ if [[ -z "${GITHUB_ACTIONS+x}" ]]; then
which typos >/dev/null 2>&1 || exit 0
typos --config typos.toml
which buf >/dev/null 2>&1 || exit 0
buf lint crates/proto/proto
buf format --diff --exit-code crates/proto/proto
fi

View file

@ -533,6 +533,14 @@ pub(crate) fn check_postgres_and_protobuf_migrations() -> NamedJob {
.add_with(("against", "https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/"))
}
fn buf_lint() -> Step<Run> {
named::bash("buf lint crates/proto/proto")
}
fn check_protobuf_formatting() -> Step<Run> {
named::bash("buf format --diff --exit-code crates/proto/proto")
}
named::job(
release_job(&[])
.runs_on(runners::LINUX_DEFAULT)
@ -543,7 +551,9 @@ pub(crate) fn check_postgres_and_protobuf_migrations() -> NamedJob {
.add_step(steps::checkout_repo().with_full_history())
.add_step(ensure_fresh_merge())
.add_step(bufbuild_setup_action())
.add_step(bufbuild_breaking_action()),
.add_step(bufbuild_breaking_action())
.add_step(buf_lint())
.add_step(check_protobuf_formatting()),
)
}