Build unit tests in CI

This commit is contained in:
Jeremy 2024-06-19 17:16:18 -05:00
parent ce075b056f
commit c92eeca2c5
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
3 changed files with 8 additions and 8 deletions

View File

@ -177,7 +177,7 @@ def build(matrix):
f"-D{matrix['demangle']}=On",
"-DCPPTRACE_BACKTRACE_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/include/backtrace.h",
"-DCPPTRACE_BUILD_TESTING=On",
"-DCPPTRACE_IS_GH_ACTIONS=On",
"-DCPPTRACE_SKIP_UNIT=On",
f"-DBUILD_SHARED_LIBS={matrix['shared']}"
]
if matrix['symbols'] == "CPPTRACE_GET_SYMBOLS_WITH_LIBDL":
@ -200,7 +200,7 @@ def build(matrix):
f"-D{matrix['symbols']}=On",
f"-D{matrix['demangle']}=On",
"-DCPPTRACE_BUILD_TESTING=On",
"-DCPPTRACE_IS_GH_ACTIONS=On",
"-DCPPTRACE_SKIP_UNIT=On",
f"-DBUILD_SHARED_LIBS={matrix['shared']}"
]
if matrix["compiler"] == "g++":
@ -227,7 +227,7 @@ def build_full_or_auto(matrix):
f"-DCPPTRACE_WERROR_BUILD=On",
f"-DCPPTRACE_BACKTRACE_PATH=/usr/lib/gcc/x86_64-linux-gnu/10/include/backtrace.h",
"-DCPPTRACE_BUILD_TESTING=On",
"-DCPPTRACE_IS_GH_ACTIONS=On",
"-DCPPTRACE_SKIP_UNIT=On",
f"-DBUILD_SHARED_LIBS={matrix['shared']}"
]
if matrix["config"] != "":
@ -247,7 +247,7 @@ def build_full_or_auto(matrix):
f"-DCPPTRACE_USE_EXTERNAL_ZSTD=On",
f"-DCPPTRACE_WERROR_BUILD=On",
"-DCPPTRACE_BUILD_TESTING=On",
"-DCPPTRACE_IS_GH_ACTIONS=On",
"-DCPPTRACE_SKIP_UNIT=On",
f"-DBUILD_SHARED_LIBS={matrix['shared']}"
]
if matrix["config"] != "":

View File

@ -166,7 +166,7 @@ option(CPPTRACE_VCPKG "" OFF)
option(CPPTRACE_SANITIZER_BUILD "" OFF)
option(CPPTRACE_WERROR_BUILD "" OFF)
option(CPPTRACE_POSITION_INDEPENDENT_CODE "" ON)
option(CPPTRACE_IS_GH_ACTIONS "" OFF)
option(CPPTRACE_SKIP_UNIT "" OFF)
option(CPPTRACE_USE_EXTERNAL_GTEST "" OFF)
mark_as_advanced(
@ -177,6 +177,6 @@ mark_as_advanced(
CPPTRACE_WERROR_BUILD
CPPTRACE_CONAN
CPPTRACE_VCPKG
CPPTRACE_IS_GH_ACTIONS
CPPTRACE_SKIP_UNIT
CPPTRACE_USE_EXTERNAL_GTEST
)

View File

@ -37,7 +37,7 @@ if(UNIX)
endif()
# primarily a workaround for github actions issue https://github.com/actions/runner-images/issues/8659
if(NOT CPPTRACE_IS_GH_ACTIONS)
if(NOT CPPTRACE_SKIP_UNIT)
if(CPPTRACE_USE_EXTERNAL_GTEST)
find_package(GTest)
else()
@ -60,6 +60,6 @@ if(NOT CPPTRACE_IS_GH_ACTIONS)
)
target_compile_features(unittest PRIVATE cxx_std_20)
target_link_libraries(unittest PRIVATE ${target_name} GTest::gtest_main GTest::gmock_main)
target_compile_options(unittest PRIVATE ${warning_options} -Wno-pedantic)
target_compile_options(unittest PRIVATE ${warning_options} $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-pedantic -Wno-attributes>)
add_test(NAME unittest COMMAND unittest)
endif()