activate ccache for selected win builds (#28735)

pull/29077/head
Jan Tattermusch 3 years ago committed by GitHub
parent 707aad777d
commit 24dfe21cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      cmake/ccache.cmake
  2. 8
      tools/internal_ci/helper_scripts/prepare_build_windows.bat
  3. 21
      tools/internal_ci/helper_scripts/prepare_ccache.bat
  4. 5
      tools/internal_ci/windows/grpc_build_artifacts.bat
  5. 5
      tools/internal_ci/windows/grpc_run_tests_matrix.bat

@ -20,6 +20,18 @@ if ($ENV{GRPC_BUILD_ENABLE_CCACHE})
message(STATUS "Will use ccache as compiler launcher: ${gRPC_CCACHE_BINARY}") message(STATUS "Will use ccache as compiler launcher: ${gRPC_CCACHE_BINARY}")
set(CMAKE_C_COMPILER_LAUNCHER ${gRPC_CCACHE_BINARY}) set(CMAKE_C_COMPILER_LAUNCHER ${gRPC_CCACHE_BINARY})
set(CMAKE_CXX_COMPILER_LAUNCHER ${gRPC_CCACHE_BINARY}) set(CMAKE_CXX_COMPILER_LAUNCHER ${gRPC_CCACHE_BINARY})
# avoid conflicts when multiple processes try to write to PDB files. Instead make debug info part of object files.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif()
else() else()
message(STATUS "Build will not use ccache (ccache binary not found).") message(STATUS "Build will not use ccache (ccache binary not found).")
endif() endif()

@ -42,10 +42,16 @@ netsh interface ip add dnsservers "Local Area Connection 8" 8.8.4.4 index=3
@rem Install nasm (required for boringssl assembly optimized build as boringssl no long supports yasm) @rem Install nasm (required for boringssl assembly optimized build as boringssl no long supports yasm)
@rem Downloading from GCS should be very reliables when on a GCP VM. @rem Downloading from GCS should be very reliables when on a GCP VM.
mkdir C:\nasm mkdir C:\nasm
curl -sSL -o C:\nasm\nasm.exe https://storage.googleapis.com/grpc-build-helper/nasm-2.15.05/nasm.exe || goto :error curl -sSL --fail -o C:\nasm\nasm.exe https://storage.googleapis.com/grpc-build-helper/nasm-2.15.05/nasm.exe || goto :error
set PATH=C:\nasm;%PATH% set PATH=C:\nasm;%PATH%
nasm nasm
@rem Install ccache
mkdir C:\ccache
curl -sSL --fail -o C:\ccache\ccache.exe https://storage.googleapis.com/grpc-build-helper/ccache-4.6-windows-64/ccache.exe || goto :error
set PATH=C:\ccache;%PATH%
ccache --version
@rem Only install C# dependencies if we are running C# tests @rem Only install C# dependencies if we are running C# tests
If "%PREPARE_BUILD_INSTALL_DEPS_CSHARP%" == "true" ( If "%PREPARE_BUILD_INSTALL_DEPS_CSHARP%" == "true" (
@rem C# prerequisites: Install dotnet SDK @rem C# prerequisites: Install dotnet SDK

@ -0,0 +1,21 @@
@rem Copyright 2022 The 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 Call this script to configure ccache (compiler cache to speed up builds)
@rem Allow use of ccache in builds that support that.
set GRPC_BUILD_ENABLE_CCACHE=true
@rem Redis instance housed in grpc-testing cloud project serves as the main compiler cache
set CCACHE_SECONDARY_STORAGE=redis://10.76.145.84:6379

@ -28,9 +28,14 @@ cd /d %~dp0\..\..\..
set PREPARE_BUILD_INSTALL_DEPS_PYTHON=true set PREPARE_BUILD_INSTALL_DEPS_PYTHON=true
call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1 call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1
call tools/internal_ci/helper_scripts/prepare_ccache.bat || exit /b 1
python tools/run_tests/task_runner.py -f artifact windows %TASK_RUNNER_EXTRA_FILTERS% -j 4 --inner_jobs 4 python tools/run_tests/task_runner.py -f artifact windows %TASK_RUNNER_EXTRA_FILTERS% -j 4 --inner_jobs 4
set RUNTESTS_EXITCODE=%errorlevel% set RUNTESTS_EXITCODE=%errorlevel%
@rem show ccache stats
ccache --show-stats
bash tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh bash tools/internal_ci/helper_scripts/store_artifacts_from_moved_src_tree.sh
exit /b %RUNTESTS_EXITCODE% exit /b %RUNTESTS_EXITCODE%

@ -35,6 +35,8 @@ If Not "%RUN_TESTS_FLAGS%"=="%RUN_TESTS_FLAGS:python=%" (
) )
call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1 call tools/internal_ci/helper_scripts/prepare_build_windows.bat || exit /b 1
call tools/internal_ci/helper_scripts/prepare_ccache.bat || exit /b 1
@rem TODO(https://github.com/grpc/grpc/issues/28011): Remove once Windows Kokoro workers' @rem TODO(https://github.com/grpc/grpc/issues/28011): Remove once Windows Kokoro workers'
@rem Python installs have been upgraded. Currently, removing this line will cause @rem Python installs have been upgraded. Currently, removing this line will cause
@rem run_tests.py to fail to spawn test subprocesses. @rem run_tests.py to fail to spawn test subprocesses.
@ -43,4 +45,7 @@ python3 tools/run_tests/start_port_server.py || exit /b 1
python3 tools/run_tests/run_tests_matrix.py %RUN_TESTS_FLAGS% python3 tools/run_tests/run_tests_matrix.py %RUN_TESTS_FLAGS%
set RUNTESTS_EXITCODE=%errorlevel% set RUNTESTS_EXITCODE=%errorlevel%
@rem show ccache stats
ccache --show-stats
exit /b %RUNTESTS_EXITCODE% exit /b %RUNTESTS_EXITCODE%

Loading…
Cancel
Save