[CI] Add clang-cl build to CI (#36840)

This adds a clang-cl Windows build to the set of Github presubmit jobs. It builds the codebase with strict warnings enabled, including thread annotation checks, and the rest of diagnostics we've been missing on Windows.

Here's [a successful run](https://btx.cloud.google.com/invocations/448792b6-3cff-4987-975a-af5e19526fc0/targets/grpc%2Fcore%2Fpull_request%2Fwindows%2Fgrpc_basictests_c/log) of the script (hijacking the C basic tests kokoro job, ignore that bit)

Closes #36840

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36840 from drfloob:kokoro-grpc-win-clangcl f15c8c5626
PiperOrigin-RevId: 641330117
pull/36844/head
AJ Heller 6 months ago committed by Copybara-Service
parent 4f3fba65fb
commit b1c3b5ddfe
  1. 3
      bazel/copts.bzl
  2. 48
      tools/internal_ci/windows/grpc_build_clang_cl.bat
  3. 25
      tools/internal_ci/windows/pull_request/grpc_build_clang_cl.cfg

@ -110,6 +110,7 @@ GRPC_LLVM_WINDOWS_WARNING_FLAGS = GRPC_LLVM_WARNING_FLAGS + [
# TODO(hork): clean up EE offenses
"-Wno-missing-field-initializers",
"-Wno-non-virtual-dtor",
"-Wno-thread-safety-reference-return",
# TODO(ctiller): offense: dump_args. signed to unsigned
"-Wno-sign-conversion",
@ -145,9 +146,11 @@ GRPC_LLVM_WINDOWS_WARNING_FLAGS = GRPC_LLVM_WARNING_FLAGS + [
"-Wno-suggest-override",
"-Wno-documentation",
"-Wno-documentation-unknown-command",
"-Wno-unsafe-buffer-usage",
### possibly bad warnings for this codebase
"-Wno-covered-switch-default",
"-Wno-switch-default",
"-Wno-switch-enum",
"-Wno-c99-extensions",
"-Wno-unused-private-field", # GRPC_UNUSED does not appear to work for private fields

@ -0,0 +1,48 @@
@rem Copyright 2024 gRPC authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Avoid slow finalization after the script has exited.
@rem See the script's prologue for info on the correct invocation pattern.
setlocal EnableDelayedExpansion
IF "%cd%"=="T:\src" (
call %~dp0\..\..\..\tools\internal_ci\helper_scripts\move_src_tree_and_respawn_itself.bat %0
echo respawn script has finished with exitcode !errorlevel!
exit /b !errorlevel!
)
endlocal
@rem enter repo root
cd /d %~dp0\..\..\..
echo "!TIME!: Preparing for the Windows build"
call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1
@rem Install clang-cl
echo "!TIME!: Installing llvm"
choco install -y llvm --version=18.1.6
set BAZEL_LLVM="C:\Program Files\LLVM"
clang-cl --version
@rem Install bazel
@rem Side effect of the tools/bazel script is that it downloads the correct version of bazel binary.
echo "!TIME!: Installing bazel"
mkdir C:\bazel
bash -c "tools/bazel --version && cp tools/bazel-*.exe /c/bazel/bazel.exe"
set PATH=C:\bazel;%PATH%
bazel --version
echo "!TIME!: Running the bazel build"
bazel build --config=clang-cl --config=windows_opt --build_tag_filters=-no_windows :all src/core:all
echo "!TIME!: Job Finished"

@ -0,0 +1,25 @@
# Copyright 2024 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Config file for the internal CI (in protobuf text format)
# Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/windows/grpc_build_clang_cl.bat"
timeout_mins: 120
action {
define_artifacts {
regex: "**/*sponge_log.*"
regex: "github/grpc/reports/**"
}
}
Loading…
Cancel
Save