Skip to content

Commit

Permalink
repo: Add buf linting
Browse files Browse the repository at this point in the history
initially just for unused imports

Fix cncf#45

Signed-off-by: Ryan Northey <[email protected]>
  • Loading branch information
phlax committed Jun 24, 2022
1 parent 1e77728 commit 4c0bf1a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ def xds_api_dependencies():
"bazel_gazelle",
locations = REPOSITORY_LOCATIONS,
)
xds_http_archive(
"com_github_bufbuild_buf",
locations = REPOSITORY_LOCATIONS,
build_file_content = BUF_BUILD_CONTENT,
tags = ["manual"],
)
xds_http_archive(
"com_envoyproxy_protoc_gen_validate",
locations = REPOSITORY_LOCATIONS,
Expand All @@ -31,3 +37,16 @@ def xds_api_dependencies():
# TODO(roth): Remove once all callers are updated to use the new name.
def udpa_api_dependencies():
xds_api_dependencies()

BUF_BUILD_CONTENT = """
package(
default_visibility = ["//visibility:public"],
)
filegroup(
name = "buf",
srcs = [
"@com_github_bufbuild_buf//:bin/buf",
],
)
"""
5 changes: 5 additions & 0 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ REPOSITORY_LOCATIONS = dict(
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
urls = ["https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz"],
),
com_github_bufbuild_buf = dict(
sha256 = "826ad701db09805eb425723ad3ea0c13ce7ca8353d6a1fb473399db915dafdf9",
strip_prefix = "buf",
urls = ["https://github.com/bufbuild/buf/releases/download/v1.4.0/buf-Linux-x86_64.tar.gz"],
),
com_envoyproxy_protoc_gen_validate = dict(
sha256 = "c695fc5a2e5a1b52904cd8a58ce7a1c3a80f7f50719496fd606e551685c01101",
strip_prefix = "protoc-gen-validate-0.6.1",
Expand Down
3 changes: 3 additions & 0 deletions ci/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

set -e

bazel run @com_github_bufbuild_buf//:bin/buf lint -- --path xds
bazel run @com_github_bufbuild_buf//:bin/buf lint -- --path udpa

bazel test --config=ci //...

rm -rf go/xds go/udpa
Expand Down

0 comments on commit 4c0bf1a

Please sign in to comment.