diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 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/proto timeout-minutes: 60 tests_pass: needs: diff --git a/crates/proto/proto/buf.yaml b/crates/proto/proto/buf.yaml index 93e819b2f77..37436d8d80f 100644 --- a/crates/proto/proto/buf.yaml +++ b/crates/proto/proto/buf.yaml @@ -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 diff --git a/script/clippy b/script/clippy index 5c13b0b39ce..617d99a5623 100755 --- a/script/clippy +++ b/script/clippy @@ -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 diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rs index 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 { + named::bash("buf lint crates/proto/proto") + } + + fn check_protobuf_formatting() -> Step { + 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()), ) }