From 2b391f233c8f82360fa6ed9065cb97cfc5133107 Mon Sep 17 00:00:00 2001 From: aiuto Date: Tue, 24 Oct 2023 18:11:32 -0400 Subject: [PATCH] Use rules_cc to try to clean up CI runs which are failing on gcc (#764) * try useing rules_cc to clean up CI runs which are failing on gcc" * use their toolchains * add rules_cc so the tests run * do not do distro tests on rolling macos * only tests tests/... for rolling_macos --- .bazelci/tests.yml | 6 +++++- MODULE.bazel | 1 + WORKSPACE | 12 ++++++++++++ examples/rich_structure/WORKSPACE | 14 ++++++++++++++ examples/rich_structure/src/client/BUILD | 1 + examples/rich_structure/src/server/BUILD | 1 + tests/BUILD | 1 + 7 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.bazelci/tests.yml b/.bazelci/tests.yml index 953283d6..2ff66a20 100644 --- a/.bazelci/tests.yml +++ b/.bazelci/tests.yml @@ -91,9 +91,13 @@ tasks: <<: *rolling rolling_macos: name: rolling_macos - <<: *macos # It seems there is no rolling Bazel for macos. + platform: macos bazel: last_green + <<: *common + test_targets: + - "//tests/..." + - "-//tests/rpm/..." rolling_windows: name: rolling_windows <<: *windows diff --git a/MODULE.bazel b/MODULE.bazel index 7bb5bf96..cafcf5ed 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -13,3 +13,4 @@ bazel_dep(name = "rules_python", version = "0.10.2") # Only for development bazel_dep(name = "platforms", version = "0.0.5", dev_dependency = True) bazel_dep(name = "stardoc", version = "0.5.3", dev_dependency = True) +bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True) diff --git a/WORKSPACE b/WORKSPACE index cd5eca75..ac3faecb 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -71,3 +71,15 @@ http_archive( load("@bazel_stardoc//:setup.bzl", "stardoc_repositories") stardoc_repositories() + +http_archive( + name = "rules_cc", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], + sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", + strip_prefix = "rules_cc-0.0.9", +) +load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains") + +rules_cc_dependencies() + +rules_cc_toolchains() diff --git a/examples/rich_structure/WORKSPACE b/examples/rich_structure/WORKSPACE index e2cdda30..d693538b 100644 --- a/examples/rich_structure/WORKSPACE +++ b/examples/rich_structure/WORKSPACE @@ -14,6 +14,8 @@ workspace(name = "rich_structure") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + local_repository( name = "rules_pkg", path = "../..", @@ -22,3 +24,15 @@ local_repository( load("@rules_pkg//pkg:deps.bzl", "rules_pkg_dependencies") rules_pkg_dependencies() + +http_archive( + name = "rules_cc", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], + sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", + strip_prefix = "rules_cc-0.0.9", +) +load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains") + +rules_cc_dependencies() + +rules_cc_toolchains() diff --git a/examples/rich_structure/src/client/BUILD b/examples/rich_structure/src/client/BUILD index 28a84d53..9d9f5459 100644 --- a/examples/rich_structure/src/client/BUILD +++ b/examples/rich_structure/src/client/BUILD @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "pkg_mklink") load("@rules_pkg//pkg:tar.bzl", "pkg_tar") load("//:foo_defs.bzl", "shared_object_path_selector") diff --git a/examples/rich_structure/src/server/BUILD b/examples/rich_structure/src/server/BUILD index aaf93837..bf6bcb56 100644 --- a/examples/rich_structure/src/server/BUILD +++ b/examples/rich_structure/src/server/BUILD @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "pkg_mkdirs") load("@rules_pkg//pkg:tar.bzl", "pkg_tar") load("//:foo_defs.bzl", "shared_object_path_selector") diff --git a/tests/BUILD b/tests/BUILD index 07b993a5..c22b12c4 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -13,6 +13,7 @@ # limitations under the License. # -*- coding: utf-8 -*- +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("@rules_python//python:defs.bzl", "py_test") load(":my_package_name.bzl", "my_package_naming") load(":path_test.bzl", "path_tests")