diff --git a/.github/workflows/BuildPR.yml b/.github/workflows/BuildPR.yml index c5b1e0de..d399e8ef 100644 --- a/.github/workflows/BuildPR.yml +++ b/.github/workflows/BuildPR.yml @@ -124,6 +124,8 @@ jobs: run: scripts/linux/install.sh - name: Build project run: scripts/linux/build.sh + - name: Run tests + run: ctest --test-dir build/qdlt - name: Make artifact executable run: chmod -R +x build/dist - name: Archive artifact diff --git a/qdlt/CMakeLists.txt b/qdlt/CMakeLists.txt index 4ee1e017..80fa297d 100644 --- a/qdlt/CMakeLists.txt +++ b/qdlt/CMakeLists.txt @@ -123,6 +123,7 @@ endforeach() find_package(GTest) # configure unit tests only if gtest found on the system if (GTest_FOUND) + message(STATUS "Tests enabled") enable_testing() add_subdirectory(tests) endif() diff --git a/qdlt/tests/CMakeLists.txt b/qdlt/tests/CMakeLists.txt index 13b400a4..beccd1f3 100644 --- a/qdlt/tests/CMakeLists.txt +++ b/qdlt/tests/CMakeLists.txt @@ -8,3 +8,8 @@ target_link_libraries( qdlt ) +add_test( + NAME test_tools + COMMAND $ +) + diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 42ce0dca..3c36089b 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -9,6 +9,9 @@ BUILD_DIR="${SRC_DIR}/build" INSTALL_DIR="${BUILD_DIR}/install" APP_DIR_NAME="DLTViewer" +NPROC=$(nproc) +echo Nb of cpus: ${NPROC} + rm -rf "${APP_DIR_NAME}" rm -rf "${SRC_DIR}/build" mkdir -p "${BUILD_DIR}" @@ -16,7 +19,7 @@ cd "${BUILD_DIR}" echo Build with QMake qmake ../BuildDltViewer.pro -make +make -j ${NPROC} echo Cleanup rm -rf "${INSTALL_DIR}" @@ -37,7 +40,7 @@ cmake -G Ninja \ -DDLT_RESOURCE_INSTALLATION_PATH="${APP_DIR_NAME}/usr/share" \ -DDLT_PLUGIN_INSTALLATION_PATH="${APP_DIR_NAME}/usr/bin/plugins" \ "${SRC_DIR}" -cmake --build "${BUILD_DIR}" -v +cmake --build "${BUILD_DIR}" -j ${NPROC} -v # External CPack generator calls "cmake --install" and "linuxdeploy" # diff --git a/scripts/linux/install.sh b/scripts/linux/install.sh index dc6c2e1d..6bff11ea 100755 --- a/scripts/linux/install.sh +++ b/scripts/linux/install.sh @@ -23,7 +23,7 @@ sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt update sudo apt install -y git cmake build-essential ninja-build \ qt515declarative qt515serialport qt515charts-no-lgpl qt515svg \ - libgtk2.0-dev libgl-dev gcc-11 g++-11 + libgtk2.0-dev libgl-dev gcc-11 g++-11 libgtest-dev sudo update-alternatives --remove-all cpp sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11 --slave /usr/bin/cpp cpp /usr/bin/cpp-11