diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 12a0dc2db1b6019e5e1e163f282f80e9bfcd0c66..96c763045cb75906e613744fcfb13764f617a278 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 93e819b2f771c2f2e3c032e6c50c0d126758ac19..37436d8d80f9435729d54da4326000be05b085f7 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 5c13b0b39cea3937a43ca54de074e5f65fae7c3b..617d99a5623e6406d1dc01247ea2f5b8e5c3b762 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 9c5529cc5361d9581b1bd59de5bfb4201298c692..4130e53f724847b3f1bef5bf083f782cc7e9e0dc 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()), ) }