Skip to content

Commit

Permalink
Hopefully fixed ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilInTheGaps committed Sep 24, 2023
1 parent eefed03 commit e809a1a
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 30 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ jobs:
- name: Tests
run: |
cd build
cp ..\..\Qt\Tools\OpenSSLv3\Win_x64\bin\*.dll .\tests\RelWithDebInfo\
cp .\cget\**\*.dll .\tests\RelWithDebInfo\
ls tests
ls tests\RelWithDebInfo
cp ..\..\Qt\Tools\OpenSSLv3\Win_x64\bin\*.dll .\bin\RelWithDebInfo\
cp .\cget\**\*.dll .\bin\RelWithDebInfo\
ls bin
ls bin\RelWithDebInfo
ctest -C RelWithDebInfo --verbose
- name: Upload debug symbols
Expand Down Expand Up @@ -195,6 +195,7 @@ jobs:
- name: Make
run: |
export QT_QPA_PLATFORM="offscreen"
cd build
cmake --build . -j2
Expand Down Expand Up @@ -325,6 +326,7 @@ jobs:
- name: Run build-wrapper
run: |
export QT_QPA_PLATFORM="offscreen"
cd build
cmake .. -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=AppDir/usr -DIS_RUNNING_IN_CI=ON -DENABLE_CODE_COVERAGE=ON
build-wrapper-linux-x86-64 --out-dir bw-output cmake --build . -j2
Expand Down
44 changes: 27 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19)
cmake_minimum_required(VERSION 3.26)

project(gm-companion LANGUAGES CXX)

Expand Down Expand Up @@ -27,6 +27,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# set external lib dir
set(EXTERNAL_LIB_DIR ${CMAKE_SOURCE_DIR}/thirdparty)

# put all executables into one directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)

find_package(Qt6 COMPONENTS Core Gui Quick QuickControls2 Qml Multimedia Network DBus Concurrent Core5Compat LinguistTools Test REQUIRED)
find_package(QuaZip-Qt6 REQUIRED)
find_package(QtKeychain REQUIRED)
Expand All @@ -50,7 +53,18 @@ cmake_print_variables(IS_RUNNING_IN_CI)

message(STATUS "Build directory: ${CMAKE_CURRENT_BINARY_DIR}")

enable_testing(true)
enable_testing()

# Code Coverage
if (ENABLE_CODE_COVERAGE)
include(CodeCoverage)

# turn off optimization for non-skewed coverage reports
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")

append_coverage_compiler_flags()
endif()

include(AddPoppler)
include(AddTagLib)
Expand All @@ -60,35 +74,31 @@ include(AddHttpStatusCodes)
include(AddMarkdownLib)
include(AddO2)

# Disable Unity Builds for sentry
# Disable Unity Builds for sentry and gtest
set(UNITY_BUILD_TEMP ${CMAKE_UNITY_BUILD})
set(CMAKE_UNITY_BUILD OFF)

set(SENTRY_ENABLE_INSTALL ON)
add_subdirectory(thirdparty/sentry-native)
set(CMAKE_UNITY_BUILD ${UNITY_BUILD_TEMP})

add_subdirectory(thirdparty/qml-icon-fonts)

# Code Coverage
if (ENABLE_CODE_COVERAGE)
include(CodeCoverage)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory(thirdparty/googletest)

# turn off optimization for non-skewed coverage reports
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
# Re-enable Unity Builds
set(CMAKE_UNITY_BUILD ${UNITY_BUILD_TEMP})

append_coverage_compiler_flags()
endif()
add_subdirectory(thirdparty/qml-icon-fonts)

if (WIN32)
add_compile_definitions(WIN32_LEAN_AND_MEAN NOMINMAX)

# copy dlls to bin directory
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CGET_PREFIX}/bin ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CGET_PREFIX}/lib ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE})
endif()

add_subdirectory(src)
add_subdirectory(app)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory(thirdparty/googletest)
add_subdirectory(tests)

feature_summary(WHAT ALL)
2 changes: 1 addition & 1 deletion cmake/AddO2.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.19)

# check if submodules are updated
if(NOT EXISTS ${EXTERNAL_LIB_DIR}/o2/CMakeLists.txt)
Expand Down
3 changes: 0 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ add_definitions(-DGTEST_LANGUAGE_CXX14)

find_package(Threads REQUIRED)

set(TEST_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})

add_subdirectory(testhelper)
add_subdirectory(common)
add_subdirectory(filesystem)
Expand Down Expand Up @@ -66,5 +64,4 @@ target_link_libraries(test_src PUBLIC

target_precompile_headers(test_src REUSE_FROM common)

set_target_properties(test_src PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TEST_OUTPUT_DIR})
gtest_discover_tests(test_src)
1 change: 0 additions & 1 deletion tests/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ target_link_libraries(test_common PRIVATE

target_precompile_headers(test_common REUSE_FROM common)

set_target_properties(test_common PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TEST_OUTPUT_DIR})
gtest_discover_tests(test_common)
5 changes: 2 additions & 3 deletions tests/filesystem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ set(SOURCES
testnextcloudaccess.cpp
)

#if (ENABLE_EXTRA_TESTS)
if (ENABLE_EXTRA_TESTS)
set_source_files_properties(testgoogledriveaccess.cpp PROPERTIES
SKIP_UNITY_BUILD_INCLUSION TRUE
)

list(APPEND SOURCES
testgoogledriveaccess.cpp
)
#endif()
endif()

qt_add_executable(test_filesystem ${SOURCES})

Expand All @@ -44,5 +44,4 @@ target_link_libraries(test_filesystem PUBLIC

target_precompile_headers(test_filesystem REUSE_FROM common)

set_target_properties(test_filesystem PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TEST_OUTPUT_DIR})
gtest_discover_tests(test_filesystem)
1 change: 0 additions & 1 deletion tests/services/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ target_link_libraries(test_services PRIVATE

target_precompile_headers(test_services REUSE_FROM common)

set_target_properties(test_services PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TEST_OUTPUT_DIR})
gtest_discover_tests(test_services)

0 comments on commit e809a1a

Please sign in to comment.