diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 85b7fece71..4bc3203639 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -14,6 +14,10 @@ tasks: - tests/core/cgo/generate_imported_dylib.sh build_targets: - "//..." + - "--" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_targets: - "//..." # Bzlmod tests require Bazel 6+ @@ -28,6 +32,10 @@ tasks: - "--config=incompatible" build_targets: - "//..." + - "--" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_targets: - "//..." debian11_zig_cc: @@ -67,6 +75,10 @@ tasks: - "--host_crosstool_top=@local_config_apple_cc//:toolchain" build_targets: - "//..." + - "--" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_flags: - "--apple_crosstool_top=@local_config_apple_cc//:toolchain" - "--crosstool_top=@local_config_apple_cc//:toolchain" @@ -78,6 +90,10 @@ tasks: - tests/core/cgo/generate_imported_dylib.sh build_targets: - "//..." + - "--" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_flags: # Some tests depend on this feature being disabled. However, because it's # enabled by default in the rbe_ubuntu1604 platform, we cannot simply remove @@ -243,6 +259,9 @@ tasks: - "-//tests/legacy/test_chdir:go_default_test" - "-//tests/legacy/test_rundir:go_default_test" - "-//tests/legacy/transitive_data:go_default_test" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_flags: - '--action_env=PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;C:\tools\msys64\mingw64\bin;C:\python3\Scripts\;C:\python3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\GooGet;C:\Program Files\Google\Compute Engine\metadata_scripts;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Google\Compute Engine\sysprep;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\tools\msys64\usr\bin;c:\openjdk\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\CMake\bin;c:\ninja;c:\bazel;c:\buildkite' # On Windows CI, bazel (bazelisk) needs %LocalAppData% to find the cache directory. diff --git a/tests/core/cross/BUILD.bazel b/tests/core/cross/BUILD.bazel index ec1799847c..44edfc8294 100644 --- a/tests/core/cross/BUILD.bazel +++ b/tests/core/cross/BUILD.bazel @@ -66,6 +66,30 @@ go_cross_binary( target = ":native_bin", ) +# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it). +# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo. +go_cross_binary( + name = "windows_go_cross_cgo", + platform = "@io_bazel_rules_go//go/toolchain:windows_amd64_cgo", + target = ":native_bin", +) + +# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it). +# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo. +go_cross_binary( + name = "linux_go_cross_cgo", + platform = "@io_bazel_rules_go//go/toolchain:linux_amd64_cgo", + target = ":native_bin", +) + +# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it). +# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo. +go_cross_binary( + name = "darwin_go_cross_cgo", + platform = "@io_bazel_rules_go//go/toolchain:darwin_amd64_cgo", + target = ":native_bin", +) + go_library( name = "platform_lib", srcs = select({