Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] repo: Add buf linting #47

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

envoy setup is tagged manual - might want to do the same

)
"""
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
15 changes: 15 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: envoyproxy
repository: protoc-gen-validate
commit: dc09a417d27241f7b069feae2cd74a0e
- remote: buf.build
owner: gogo
repository: protobuf
commit: 4df00b267f944190a229ce3695781e99
- remote: buf.build
owner: googleapis
repository: googleapis
commit: d1a849b8f8304950832335723096e954
8 changes: 8 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
deps:
- buf.build/envoyproxy/protoc-gen-validate
- buf.build/googleapis/googleapis:d1a849b8f8304950832335723096e954
- buf.build/gogo/protobuf
lint:
use:
- IMPORT_USED
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to figure how/where best to run this


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

rm -rf go/xds go/udpa
Expand Down