Skip to content

Commit 1d7a729

Browse files
frigus02copybara-github
authored andcommitted
Add and fix Bazel tests
PiperOrigin-RevId: 636821161
1 parent 3b2aeda commit 1d7a729

File tree

3 files changed

+19
-61
lines changed

3 files changed

+19
-61
lines changed

.github/workflows/ubuntu-build.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15-
build:
15+
cmake:
1616
runs-on: ubuntu-22.04
17-
name: ubuntu-build
1817
steps:
1918
- name: Show env
2019
run: env
@@ -46,3 +45,15 @@ jobs:
4645
shell: bash
4746
run: |
4847
cmake --build build -j$(nproc)
48+
49+
bazel:
50+
runs-on: ubuntu-22.04
51+
steps:
52+
- uses: actions/checkout@v3
53+
- uses: bazel-contrib/[email protected]
54+
with:
55+
bazelisk-cache: true
56+
disk-cache: ${{ github.workflow }}
57+
repository-cache: true
58+
- run: BAZEL_CXXOPTS="-std=c++17" bazel test //...
59+
- run: BAZEL_CXXOPTS="-std=c++20" bazel test //...

pybind11_protobuf/tests/BUILD

+1-30
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ cc_proto_library(
109109
deps = [":we-love-dashes_proto"],
110110
)
111111

112-
py_proto_library(
113-
name = "we-love-dashes_py_pb2",
114-
deps = [":we-love-dashes_proto"],
115-
)
116-
117112
# Tests for enum_type_caster
118113

119114
pybind_extension(
@@ -371,32 +366,8 @@ pybind_extension(
371366
py_test(
372367
name = "we_love_dashes_cc_only_test",
373368
srcs = ["we_love_dashes_cc_only_test.py"],
369+
data = [":we_love_dashes_cc_only_module.so"],
374370
deps = [
375-
":we_love_dashes_cc_only_module",
376-
"@com_google_absl_py//absl/testing:absltest",
377-
"@com_google_protobuf//:protobuf_python",
378-
requirement("absl_py"),
379-
],
380-
)
381-
382-
py_test(
383-
name = "we_love_dashes_cc_and_py_in_deps_test",
384-
srcs = ["we_love_dashes_cc_and_py_in_deps_test.py"],
385-
deps = [
386-
":we_love_dashes_cc_only_module",
387-
":we-love-dashes_py_pb2",
388-
"@com_google_absl_py//absl/testing:absltest",
389-
"@com_google_protobuf//:protobuf_python",
390-
requirement("absl_py"),
391-
],
392-
)
393-
394-
py_test(
395-
name = "we_love_dashes_py_only_test",
396-
srcs = ["we_love_dashes_py_only_test.py"],
397-
deps = [
398-
":pass_proto2_message_module",
399-
":we-love-dashes_py_pb2",
400371
"@com_google_absl_py//absl/testing:absltest",
401372
"@com_google_protobuf//:protobuf_python",
402373
requirement("absl_py"),

scripts/build_and_run_tests.sh

+5-29
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,8 @@ echo "Building and testing in $PWD using 'python' (version $PYVERSION)."
2121

2222
bazel clean --expunge # Force a dep update
2323

24-
# Currently only a subset of tests build. The next one to fix is protobuf_test
25-
BAZEL_CXXOPTS="-std=c++17" bazel test --test_output=errors \
26-
pybind11_protobuf/tests:extension_test \
27-
pybind11_protobuf/tests:message_test \
28-
pybind11_protobuf/tests:pass_by_test \
29-
pybind11_protobuf/tests:proto_enum_test \
30-
pybind11_protobuf/tests:wrapped_proto_module_test --enable_bzlmod
31-
32-
BAZEL_CXXOPTS="-std=c++20" bazel test --test_output=errors \
33-
pybind11_protobuf/tests:extension_test \
34-
pybind11_protobuf/tests:message_test \
35-
pybind11_protobuf/tests:pass_by_test \
36-
pybind11_protobuf/tests:proto_enum_test \
37-
pybind11_protobuf/tests:wrapped_proto_module_test --enable_bzlmod
38-
39-
# Currently only a subset of tests build. The next one to fix is protobuf_test
40-
BAZEL_CXXOPTS="-std=c++17" bazel test --test_output=errors \
41-
pybind11_protobuf/tests:extension_test \
42-
pybind11_protobuf/tests:message_test \
43-
pybind11_protobuf/tests:pass_by_test \
44-
pybind11_protobuf/tests:proto_enum_test \
45-
pybind11_protobuf/tests:wrapped_proto_module_test --noenable_bzlmod
46-
47-
BAZEL_CXXOPTS="-std=c++20" bazel test --test_output=errors \
48-
pybind11_protobuf/tests:extension_test \
49-
pybind11_protobuf/tests:message_test \
50-
pybind11_protobuf/tests:pass_by_test \
51-
pybind11_protobuf/tests:proto_enum_test \
52-
pybind11_protobuf/tests:wrapped_proto_module_test --noenable_bzlmod
24+
BAZEL_CXXOPTS="-std=c++17" bazel test ... --test_output=errors "$@" --enable_bzlmod
25+
BAZEL_CXXOPTS="-std=c++20" bazel test ... --test_output=errors "$@" --enable_bzlmod
26+
27+
BAZEL_CXXOPTS="-std=c++17" bazel test ... --test_output=errors "$@" --noenable_bzlmod
28+
BAZEL_CXXOPTS="-std=c++20" bazel test ... --test_output=errors "$@" --noenable_bzlmod

0 commit comments

Comments
 (0)