Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ci: Add check for protobuf formatting (#50418)
Finn Evers14358b711c9d
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.ymlindex 12a0dc2db1b..96c763045cb 100644--- a/.github/workflows/run_tests.yml+++ b/.github/workflows/run_tests.yml@@ -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/prototimeout-minutes: 60tests_pass:needs:diff --git a/crates/proto/proto/buf.yaml b/crates/proto/proto/buf.yamlindex 93e819b2f77..37436d8d80f 100644--- a/crates/proto/proto/buf.yaml+++ b/crates/proto/proto/buf.yaml@@ -2,3 +2,13 @@ version: v1breaking: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_SUFFIXdiff --git a/script/clippy b/script/clippyindex 5c13b0b39ce..617d99a5623 100755--- a/script/clippy+++ b/script/clippy@@ -16,4 +16,8 @@ if [[ -z "${GITHUB_ACTIONS+x}" ]]; thenwhich typos >/dev/null 2>&1 || exit 0typos --config typos.toml++ which buf >/dev/null 2>&1 || exit 0+ buf lint crates/proto/proto+ buf format --diff --exit-code crates/proto/protofidiff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rsindex 9c5529cc536..4130e53f724 100644--- a/tooling/xtask/src/tasks/workflows/run_tests.rs+++ b/tooling/xtask/src/tasks/workflows/run_tests.rs@@ -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()),)}