-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Speed up CI builds with ccache (seeded from develop) #16385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
1d6e22d
d68a7cd
2243156
e1e2ebe
c2bf441
9b8d22a
4bb9225
95caef2
bd615db
12004a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| ROOTDIR="$(dirname "$0")/../.." | ||
| ROOTDIR="$(realpath "$(dirname "$0")/../..")" | ||
r0qs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # shellcheck source=scripts/common.sh | ||
| source "${ROOTDIR}/scripts/common.sh" | ||
|
|
||
|
|
@@ -16,7 +16,17 @@ cd build | |
|
|
||
| [[ -n $COVERAGE && -z $CIRCLE_TAG ]] && CMAKE_OPTIONS="$CMAKE_OPTIONS -DCOVERAGE=ON" | ||
|
|
||
| export CCACHE_DIR="$HOME/.ccache" | ||
| export CCACHE_BASEDIR="$ROOTDIR" | ||
| export CCACHE_NOHASHDIR=1 | ||
| CMAKE_OPTIONS="${CMAKE_OPTIONS:-} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already have ccache detection in place, I’m wondering whether it would be better to let CMake handle this automatically and remove
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We would probably need to add
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kinda like that it's explicit. Never understood why we need this
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha sure. We can keep it as it is then, and don't change the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never change the cake config |
||
| mkdir -p "$CCACHE_DIR" | ||
|
|
||
| # shellcheck disable=SC2086 | ||
| cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" $CMAKE_OPTIONS | ||
|
|
||
| ccache -z | ||
|
|
||
| cmake --build . | ||
|
|
||
| ccache -s | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,9 +18,18 @@ function generate_protobuf_bindings | |
| function build_fuzzers | ||
| { | ||
| cd "${BUILDDIR}" | ||
| cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" -DCCACHE=OFF \ | ||
| -DCMAKE_TOOLCHAIN_FILE="${ROOTDIR}"/cmake/toolchains/libfuzzer.cmake | ||
| export CCACHE_DIR="$HOME/.ccache" | ||
| export CCACHE_BASEDIR="$ROOTDIR" | ||
| export CCACHE_NOHASHDIR=1 | ||
| CMAKE_OPTIONS="${CMAKE_OPTIONS:-} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that for |
||
| mkdir -p "$CCACHE_DIR" | ||
| # shellcheck disable=SC2086 | ||
| cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" \ | ||
| -DCMAKE_TOOLCHAIN_FILE="${ROOTDIR}"/cmake/toolchains/libfuzzer.cmake \ | ||
| $CMAKE_OPTIONS | ||
| ccache -z | ||
| make ossfuzz ossfuzz_proto ossfuzz_abiv2 -j 4 | ||
| ccache -s | ||
| } | ||
|
|
||
| generate_protobuf_bindings | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,22 +6,49 @@ prerelease_source="${1:-ci}" | |
| ROOTDIR="$(realpath "$(dirname "$0")/../../")" | ||
| FORCE_RELEASE="${FORCE_RELEASE:-}" | ||
| CIRCLE_TAG="${CIRCLE_TAG:-}" | ||
| CMAKE_VS_GLOBALS_ARG=() | ||
|
|
||
| cd "$ROOTDIR" | ||
| "${ROOTDIR}/scripts/prerelease_suffix.sh" "$prerelease_source" "$CIRCLE_TAG" > prerelease.txt | ||
|
|
||
| export CCACHE_DIR="$HOME/.ccache" | ||
| export CCACHE_BASEDIR="$ROOTDIR" | ||
| export CCACHE_NOHASHDIR=1 | ||
| export CCACHE_COMPILERTYPE=msvc | ||
| VSWHERE="${VSWHERE:-C:/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe}" | ||
| VS_INSTALL="$("$VSWHERE" -latest -products "*" \ | ||
| -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \ | ||
| -property installationPath | tr -d '\r')" | ||
| VCTOOLS_VERSION="$(tr -d '\r' < "$VS_INSTALL/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt")" | ||
| CCACHE_COMPILER="$VS_INSTALL/VC/Tools/MSVC/$VCTOOLS_VERSION/bin/Hostx64/x64/cl.exe" | ||
| CCACHE_COMPILER="${CCACHE_COMPILER//\\//}" | ||
| export CCACHE_COMPILER | ||
| PATH="$ROOTDIR/deps/ccache:$(dirname "$CCACHE_COMPILER"):$PATH" | ||
| export PATH | ||
| # Use a Windows-style path for Visual Studio globals. | ||
| WIN_PWD="$(pwd -W)" | ||
| # Visual Studio generator doesn't use compiler launchers; use ccache masquerade. | ||
| # See https://github.com/ccache/ccache/wiki/MS-Visual-Studio | ||
| CMAKE_VS_GLOBALS="CLToolPath=${WIN_PWD}/deps/ccache;UseMultiToolTask=true" | ||
| CMAKE_VS_GLOBALS_ARG=(-DCMAKE_VS_GLOBALS="$CMAKE_VS_GLOBALS") | ||
|
Comment on lines
+32
to
+33
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be done by cmake? See: https://github.com/ccache/ccache/wiki/MS-Visual-Studio#usage-with-cmake Maybe we can add that you our cmake ccache config. |
||
| mkdir -p "$CCACHE_DIR" | ||
|
|
||
| mkdir -p build/ | ||
| cd build/ | ||
|
|
||
| # NOTE: Using an array to force Bash to do wildcard expansion | ||
| boost_dir=("${ROOTDIR}/deps/boost/lib/cmake/Boost-"*) | ||
|
|
||
| "${ROOTDIR}/deps/cmake/bin/cmake" \ | ||
| # shellcheck disable=SC2086 | ||
| "${ROOTDIR}/deps/cmake/bin/cmake" \ | ||
| -G "Visual Studio 16 2019" \ | ||
| -DBoost_DIR="${boost_dir[*]}" \ | ||
| -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded \ | ||
| -DCMAKE_INSTALL_PREFIX="${ROOTDIR}/uploads/" \ | ||
| "${CMAKE_VS_GLOBALS_ARG[@]}" \ | ||
| ${CMAKE_OPTIONS:-} \ | ||
| .. | ||
| ccache -z | ||
| MSBuild.exe solidity.sln \ | ||
| -property:Configuration=Release \ | ||
| -maxCpuCount:10 \ | ||
|
|
@@ -31,3 +58,4 @@ MSBuild.exe solidity.sln \ | |
| -j 10 \ | ||
| --target install \ | ||
| --config Release | ||
| ccache -s | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.