This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 581a81125 chore(CI): Reduce the target size when build on GitHub
actions (#2086)
581a81125 is described below
commit 581a811256cc33d300b5f8e0e3a1e1ae2fe17756
Author: Yingchun Lai <[email protected]>
AuthorDate: Fri Aug 2 15:52:58 2024 +0800
chore(CI): Reduce the target size when build on GitHub actions (#2086)
The GitHub action runners for free plan is very limit, it's easy to exceed
the disk space.
This patch adds some build and link flags to reduce the target size to
ensure
the actions can be completed without disk exhaust issues.
Now the release packge is reduced from about 2,600,468,480 bytes to
686,325,578
bytes, and the ASAN package can be built completly now.
---
cmake_modules/BaseFunctions.cmake | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/cmake_modules/BaseFunctions.cmake
b/cmake_modules/BaseFunctions.cmake
index 33c819fbb..9b784dc44 100644
--- a/cmake_modules/BaseFunctions.cmake
+++ b/cmake_modules/BaseFunctions.cmake
@@ -193,12 +193,20 @@ endfunction()
function(dsn_setup_compiler_flags)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDSN_BUILD_TYPE=Debug)
- add_definitions(-g)
else()
- add_definitions(-g)
add_definitions(-O2)
add_definitions(-DDSN_BUILD_TYPE=Release)
endif()
+
+ if("$ENV{GITHUB_ACTION}" STREQUAL "" OR APPLE)
+ add_definitions(-g)
+ else()
+ # Reduce the target size when build on GitHub actions and non-macOS.
+ message(WARNING "Running GitHub actions, the target size will be reduced!")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -ffunction-sections
-fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-s
-Wl,--gc-sections")
+ endif()
+
cmake_host_system_information(RESULT BUILD_HOSTNAME QUERY HOSTNAME)
add_definitions(-DDSN_BUILD_HOSTNAME=${BUILD_HOSTNAME})
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]