Skip to content

Commit 6640339

Browse files
committed
Close coverage gap in CI script, ensuring all targets built from another Bazel workspace.
Details: - In Bazel, it is possible and not uncommon that a project builds from its own workspace, but fails to build when depended on from another workspace. - We have an example project in example/using-bzlmod that we build in our CI script to ensure both direct and transitive builds work. - Despite this, in bazelbuild/bazel-central-registry#7594, P4Runtime did not build even though our CI script passed. - The gap: our example project exercises some, but not all @p4runtime targets in a transitive fashion. - The solution: run bazel build @p4runtime//... from the example workspace to close the gap. - The proof: I reproduced the issue seen in bazelbuild/bazel-central-registry#7594 in #591. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com>
1 parent 82083b4 commit 6640339

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.github/workflows/bazel-build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ jobs:
6262
format: X
6363

6464
- name: Build proto/
65-
run: cd proto && bazel build //... && bazel test //...
65+
run: bazel build //... && bazel test //...
6666

6767
- name: Build bazel/example/using-bzlmod/
68-
run: cd bazel/example/using-bzlmod && bazel build //...
68+
run: |
69+
cd bazel/example/using-bzlmod
70+
bazel build @p4runtime//...
71+
bazel build //...
6972
7073
- name: Save end time
7174
# Always save the end time so we can calculate the build duration.

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ bazel_dep(name = "googleapis-python", version = "1.0.0")
1717
bazel_dep(name = "googleapis-grpc-cc", version = "1.0.0")
1818
bazel_dep(name = "grpc", version = "1.76.0")
1919
bazel_dep(name = "protobuf", version = "33.5")
20-
bazel_dep(name = "rules_cc", version = "0.2.16")
20+
bazel_dep(name = "rules_cc", version = "0.2.17")
2121
bazel_dep(name = "rules_go", version = "0.60.0")
2222
bazel_dep(name = "rules_license", version = "1.0.0")
2323

2424
# Including this allows us to auto-format all Bazel files by running
2525
# ```
2626
# bazel run -- @buildifier_prebuilt//:buildifier -lint=fix -r $(bazel info workspace)
2727
# ```
28-
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.1", dev_dependency = True)
28+
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.2", dev_dependency = True)

bazel/example/using-bzlmod/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
bazel_dep(name = "p4runtime")
2-
bazel_dep(name = "protobuf", version = "29.1")
2+
bazel_dep(name = "protobuf", version = "33.5")
33
bazel_dep(name = "rules_cc", version = "0.2.16")
44

55
# In your own project, you will likely want to use `git_override` instead

0 commit comments

Comments
 (0)