pw_presubmit: Add coverage for bazel rust embedded
Bug: 267683501
Change-Id: I3d9982cee6eae03d1e781392d5a57cc7ef62b924
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/127414
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
diff --git a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
index 6bcd87f..ed3510f 100755
--- a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
+++ b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
@@ -429,7 +429,7 @@
endswith=(*format_code.C_FORMAT.extensions, '.bazel', '.bzl', 'BUILD')
)
def bazel_test(ctx: PresubmitContext) -> None:
- """Runs bazel test on each bazel compatible module."""
+ """Runs bazel test on the entire repo."""
build.bazel(
ctx,
'test',
@@ -440,10 +440,17 @@
@filter_paths(
- endswith=(*format_code.C_FORMAT.extensions, '.bazel', '.bzl', 'BUILD')
+ endswith=(
+ *format_code.C_FORMAT.extensions,
+ '.bazel',
+ '.bzl',
+ '.py',
+ '.rs',
+ 'BUILD',
+ )
)
def bazel_build(ctx: PresubmitContext) -> None:
- """Runs Bazel build on each Bazel compatible module."""
+ """Runs Bazel build for each supported platform."""
build.bazel(
ctx,
'build',
@@ -451,6 +458,25 @@
'//...',
)
+ # Mapping from Bazel platforms to targets which should be built for those
+ # platforms.
+ targets_for_platform = {
+ "//pw_build/platforms:lm3s6965evb": [
+ "//pw_rust/examples/embedded_hello:hello",
+ ],
+ "//pw_build/platforms:microbit": [
+ "//pw_rust/examples/embedded_hello:hello",
+ ],
+ }
+
+ for platform, targets in targets_for_platform.items():
+ build.bazel(
+ ctx,
+ 'build',
+ f'--platforms={platform}',
+ *targets,
+ )
+
def pw_transfer_integration_test(ctx: PresubmitContext) -> None:
"""Runs the pw_transfer cross-language integration test only.