Skip to content

Commit cd06356

Browse files
committed
build: build app tests by default
Build and run the app tests in the depends CI job, use the minimal QPA platform, and import the static Qt minimal and QML plugins needed by the test binaries.
1 parent e7e68f9 commit cd06356

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

.github/workflows/artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: MacOS Install Deps
3131
if: contains(matrix.os, 'macos')
3232
run: |
33-
brew install ccache boost pkgconf libevent qt@6 qrencode coreutils llvm
33+
brew install ccache boost pkgconf qt@6 qrencode coreutils llvm
3434
llvm_prefix="$(brew --prefix llvm)"
3535
echo "CC=${llvm_prefix}/bin/clang" >> "$GITHUB_ENV"
3636
echo "CXX=${llvm_prefix}/bin/clang++" >> "$GITHUB_ENV"

.github/workflows/depends-build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,18 @@ jobs:
143143
cmake -S . -B "${BUILD_DIR}" -G Ninja \
144144
-DCMAKE_BUILD_TYPE=Release \
145145
-DCMAKE_TOOLCHAIN_FILE="${PWD}/bitcoin/depends/${HOST}/toolchain.cmake" \
146-
-DBUILD_APP_TESTS=OFF \
146+
-DBUILD_APP_TESTS=ON \
147147
-DBUILD_GUI=ON \
148148
-DENABLE_WALLET=ON \
149149
-DENABLE_IPC=OFF
150150
151-
- name: Build bitcoin-core-app
151+
- name: Build
152152
run: |
153-
cmake --build "${BUILD_DIR}" --target bitcoin-core-app --parallel "${JOBS}"
153+
cmake --build "${BUILD_DIR}" --parallel "${JOBS}"
154+
155+
- name: Run app tests
156+
run: |
157+
ctest --test-dir "${BUILD_DIR}" --output-on-failure --parallel "${JOBS}"
154158
155159
- name: Upload depends logs
156160
uses: actions/upload-artifact@v4

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ target_link_libraries(bitcoin-core-app
193193
)
194194
qt6_import_qml_plugins(bitcoin-core-app)
195195

196-
option(BUILD_APP_TESTS "Build unit tests for the app" OFF)
196+
option(BUILD_APP_TESTS "Build tests for the app" ON)
197197
if(BUILD_APP_TESTS)
198198
include(CTest)
199199
enable_testing()

test/CMakeLists.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ target_link_libraries(bitcoinqml_unit_tests
7272
Qt6::Widgets
7373
)
7474

75-
add_test(NAME bitcoinqml_unit_tests COMMAND bitcoinqml_unit_tests -platform offscreen)
75+
add_test(NAME bitcoinqml_unit_tests COMMAND bitcoinqml_unit_tests -platform minimal)
7676

7777
qt6_add_resources(QMLTESTS_QRC_CPP ${QML_QRC} qml/bitcoin_qmltests.qrc)
7878

@@ -103,4 +103,19 @@ target_include_directories(bitcoinqml_qmltests
103103
${CMAKE_CURRENT_SOURCE_DIR}/..
104104
)
105105

106-
add_test(NAME bitcoinqml_qmltests COMMAND bitcoinqml_qmltests -platform offscreen)
106+
add_test(NAME bitcoinqml_qmltests COMMAND bitcoinqml_qmltests -platform minimal)
107+
108+
get_target_property(qt_lib_type Qt6::Core TYPE)
109+
if(qt_lib_type STREQUAL "STATIC_LIBRARY")
110+
qt6_import_plugins(bitcoinqml_unit_tests INCLUDE Qt6::QMinimalIntegrationPlugin)
111+
qt6_import_plugins(bitcoinqml_qmltests INCLUDE Qt6::QMinimalIntegrationPlugin)
112+
qt6_import_qml_plugins(bitcoinqml_qmltests)
113+
target_link_libraries(bitcoinqml_qmltests PRIVATE
114+
Qt6::qtquickdialogsplugin
115+
)
116+
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.5)
117+
target_link_libraries(bitcoinqml_qmltests PRIVATE Qt6::qtqmlcoreplugin)
118+
else()
119+
target_link_libraries(bitcoinqml_qmltests PRIVATE Qt6::qmlsettingsplugin)
120+
endif()
121+
endif()

0 commit comments

Comments
 (0)