Skip to content

Commit e446229

Browse files
authored
fix(bazel): fix bazel build and add presubmit (#1479)
* chore(ci): add bazel build for proto_library * add missing checkout * add .bazeliskrc * fix rules_proto in WORKSPACE * fix bazel build * add new line to .bazeliskrc * add new line to workflow yaml * update deps * add rc explanation comment
1 parent 4847b10 commit e446229

5 files changed

Lines changed: 39 additions & 13 deletions

File tree

.bazeliskrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# See https://github.com/bazelbuild/bazelisk
2+
# Should match https://github.com/googleapis/googleapis/blob/master/.bazeliskrc
3+
USE_BAZEL_VERSION=6.3.0

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ build --protocopt=--include_source_info
33

44
# Required because showcase protos include proto3_optional fields
55
build --protocopt=--experimental_allow_proto3_optional
6+
7+
# New boringssl requires C++14
8+
# Copied from googleapis.
9+
build --repo_env=BAZEL_CXXOPTS="-std=c++14"

.github/workflows/ci.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ jobs:
105105
run: go test ./...
106106
- name: Run server coverage
107107
run: go test ./server/... -coverprofile=coverage.txt -covermode=atomic
108-
# Disabled indefinitely.
109-
# - uses: codecov/codecov-action@v1
110-
# with:
111-
# files: ./coverage.txt
112-
# flags: unittests
113108
probes:
114109
needs: regenerate
115110
runs-on: ubuntu-latest
@@ -217,3 +212,16 @@ jobs:
217212
repo: context.repo.repo,
218213
labels: ['automerge']
219214
})
215+
bazel_build_protos:
216+
runs-on: ubuntu-latest
217+
steps:
218+
- uses: actions/checkout@v4
219+
- uses: bazel-contrib/[email protected]
220+
with:
221+
# Avoid downloading Bazel every time.
222+
bazelisk-cache: true
223+
# Store build cache per workflow.
224+
disk-cache: ${{ github.workflow }}
225+
# Share repository cache between workflows.
226+
repository-cache: true
227+
- run: bazelisk build //schema/google/showcase/v1beta1:showcase_proto

WORKSPACE.bazel

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,28 @@ http_archive(
4242
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
4343
protobuf_deps()
4444

45+
http_archive(
46+
name = "bazel_features",
47+
sha256 = "06f02b97b6badb3227df2141a4b4622272cdcd2951526f40a888ab5f43897f14",
48+
strip_prefix = "bazel_features-1.9.0",
49+
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.9.0/bazel_features-v1.9.0.tar.gz",
50+
)
51+
load("@bazel_features//:deps.bzl", "bazel_features_deps")
52+
bazel_features_deps()
53+
4554
##
4655
# rules_proto for the proto_library rule
4756
#
4857
http_archive(
49-
name = "rules_proto",
50-
sha256 = "6a0b76595cb8bb97cec085c6b45c24337d30615d636f4941225c05f017690b6f",
51-
strip_prefix = "rules_proto-25c8af9d56980df7732b2f8639c5d43ef878a6f7",
52-
urls = [
53-
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/25c8af9d56980df7732b2f8639c5d43ef878a6f7.tar.gz",
54-
"https://github.com/bazelbuild/rules_proto/archive/25c8af9d56980df7732b2f8639c5d43ef878a6f7.tar.gz",
55-
],
58+
name = "rules_proto",
59+
sha256 = "71fdbed00a0709521ad212058c60d13997b922a5d01dbfd997f0d57d689e7b67",
60+
# Using a release candidate because the latest stable release is too old for
61+
# our needs, and we want to stay closer to the latest without pinning to a
62+
# specific commit.
63+
strip_prefix = "rules_proto-6.0.0-rc2",
64+
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc2/rules_proto-6.0.0-rc2.tar.gz",
5665
)
57-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
66+
67+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies","rules_proto_toolchains")
5868
rules_proto_dependencies()
5969
rules_proto_toolchains()

schema/google/showcase/v1beta1/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ proto_library(
3939
"@com_google_googleapis//google/longrunning:operations_proto",
4040
"@com_google_googleapis//google/rpc:status_proto",
4141
"@com_google_googleapis//google/rpc:error_details_proto",
42+
"@com_google_protobuf//:any_proto",
4243
"@com_google_protobuf//:duration_proto",
4344
"@com_google_protobuf//:empty_proto",
4445
"@com_google_protobuf//:field_mask_proto",

0 commit comments

Comments
 (0)