diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36db3dfeb4..86b77b9cb3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,54 +1,59 @@ # This YAML recipe builds KStars with INDI support, then runs all tests -# Build dependencies are in packaged into image definition 'docker/Dockerfile' -# As of 202009, two-stage pipeline fails on propagation of artifact from stage build to stage test -# Probably because the upload uses a webdav REST API, and there are many large files in the list +# It uses both KDE CI and custom image until tests are stabilised in the KDE CI image +# Build dependencies for the custom image are packaged into image definition 'docker/Dockerfile' + +include: + - project: sysadmin/ci-utilities + file: + - /gitlab-templates/linux.yml + - /gitlab-templates/windows.yml + - /gitlab-templates/android.yml + # - /gitlab-templates/reuse-lint.yml + # - /gitlab-templates/flatpak.yml + +# Android CI is not ready yet +android_qt515: + allow_failure: true stages: - build - test #- test-unstable -image: tallfurryman/kstars-ci:0.12 - -variables: - CCACHE_BASEDIR: "$CI_PROJECT_DIR" - QT_TEST_TIMEOUT_FUNCTION: "600" - QT_QPA_PLATFORM: "eglfs" - # In order to be cached successfully, the ccache folder must reside *inside* $CI_PROJECT_DIR - CCACHE_DIR: "$CI_PROJECT_DIR/.ccache" - -# We cache the ccache folder -cache: - key: "CCACHE-DB-$CI_PROJECT_ID" - paths: - - "${CCACHE_DIR}" - # Unfortunately, cache:when is not available in the KDE version of gitlab - # Impact: we need a first build to succeed before the cache is available on the runner for further builds - # when: - # - always - -.build_recipe: &build_recipe - - add-apt-repository --remove ppa:mutlaqja/indinightly - - add-apt-repository ppa:mutlaqja/ppa - - apt update - - apt -y --no-install-recommends install libindi1 libindi-dev libindi-data indi-bin xplanet gsc phd2 libstellarsolver libstellarsolver-dev - - mkdir -p kstars-build - - cd kstars-build - - cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. -DCCACHE_SUPPORT=ON -DBUILD_TESTING=${BUILD_TESTING:-OFF} -DBUILD_DOC=${BUILD_DOC:-OFF} - - ninja -j8 all install +# This is the custom build we use until tests are operational in the KDE CI image +.custom_build: + interruptible: true + image: tallfurryman/kstars-ci:0.12 + variables: + CCACHE_BASEDIR: "$CI_PROJECT_DIR" + QT_TEST_TIMEOUT_FUNCTION: "600" + QT_QPA_PLATFORM: "eglfs" + CCACHE_DIR: "$CI_PROJECT_DIR/.ccache" + cache: + key: "CCACHE-DB-$CI_PROJECT_ID" + paths: [ "${CCACHE_DIR}" ] + when: always + before_script: + - du -hs "${CCACHE_DIR}" || mkdir -p "${CCACHE_DIR}" + - add-apt-repository --remove ppa:mutlaqja/indinightly + - add-apt-repository ppa:mutlaqja/ppa + - apt update + - apt -y --no-install-recommends install libindi1 libindi-dev libindi-data indi-bin xplanet gsc phd2 libstellarsolver libstellarsolver-dev + - mkdir -p kstars-build + after_script: + - ccache -s +# Run the build and keep the ccache folder as a fail-fast build: stage: build - interruptible: true + extends: .custom_build only: - master - merge_requests - before_script: - - du -hs "${CCACHE_DIR}" || mkdir -p "${CCACHE_DIR}" script: - - *build_recipe - after_script: - - ccache -s + - cd kstars-build + - cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCCACHE_SUPPORT=ON -DBUILD_TESTING=OFF -DBUILD_DOC=OFF .. + - ninja -j8 all install # Run the full validation in one step, stable tests that must not fail # The artifacts take far too much time to propagate from one step to the other @@ -56,21 +61,23 @@ build: # Consolidate runner with build packages and build build-and-test-stable: stage: test - interruptible: true + extends: .custom_build + timeout: 3 hours only: - merge_requests variables: BUILD_TESTING: "ON" - before_script: - - *build_recipe script: + - cd kstars-build + - cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCCACHE_SUPPORT=ON -DBUILD_TESTING=ON -DBUILD_DOC=ON .. + - ninja -j8 all install - rm -rf Testing - mkdir -p /var/run/dbus - dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address - dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames - apt install -y --no-install-recommends dbus-x11 - export $(dbus-launch) - - dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames + - dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames - xvfb-run ctest -T test -L stable -LE unstable --output-on-failure after_script: - pwd @@ -109,7 +116,7 @@ build-and-test-stable: # reports: # junit: # ./junit_result.unstable.xml - +# # build-appimage: # stage: test # interruptible: true @@ -131,4 +138,4 @@ build-and-test-stable: # expire_in: 1 week # paths: # - 'kstars-build/*.AppImage*' - +# diff --git a/.kde-ci.yml b/.kde-ci.yml new file mode 100644 index 0000000000..0a972ae26c --- /dev/null +++ b/.kde-ci.yml @@ -0,0 +1,31 @@ +# SPDX-FileCopyrightText: 2024 Eric Dejouhanet +# SPDX-License-Identifier: GPL-2.0-or-later + +Dependencies: +- 'on': ['@all'] + 'require': + 'frameworks/extra-cmake-modules': '@stable' + 'frameworks/kconfig': '@stable' + 'frameworks/kguidaddons': '@stable' + 'frameworks/ki18n': '@stable' + 'frameworks/kplotting': '@stable' + +- 'on': ['Linux','Windows'] + 'require': + 'frameworks/breeze-icons': '@stable' + 'frameworks/kcrash': '@stable' + 'frameworks/kdoctools': '@stable' + 'frameworks/kinit': '@stable' + 'frameworks/knewstuff': '@stable' + 'frameworks/knotifications': '@stable' + 'frameworks/knotifyconfig': '@stable' + 'frameworks/kxmlgui': '@stable' + +#- 'on': ['Android'] +# 'require': + +Options: + in-source-build: False + setup-dbus-session: True + setup-x-environment: True + cmake-options: --trace-expand --debug-find diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c30da5b4f..b993de19b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,9 +196,9 @@ endif () MACRO_BOOL_TO_01(INDI_FOUND HAVE_INDI) set_package_properties(INDI PROPERTIES DESCRIPTION "Astronomical instrumentation control" URL "https://www.indilib.org" TYPE OPTIONAL PURPOSE "Support for controlling astronomical devices on Linux with KStars.") -if (INDI_FOUND AND NOT ANDROID) +if (NOT ANDROID) find_package(StellarSolver REQUIRED 2.2) -endif(INDI_FOUND AND NOT ANDROID) +endif(NOT ANDROID) MACRO_BOOL_TO_01(StellarSolver_FOUND HAVE_STELLARSOLVER) find_package(Nova) @@ -297,7 +297,16 @@ endif () # Add security (hardening flags) IF (UNIX OR APPLE OR ANDROID) - SET(SEC_COMP_FLAGS "-D_FORTIFY_SOURCE=2 -fstack-protector-all -Wcast-align -fPIE") + SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -fstack-protector-all -Wcast-align -fPIE") + # This is ill-defined, but I searched for a solution for quite a long time to no avail + # - FORTIFY_SOURCE generates a warning when there is no code optimization, and warnings will become errors at some point + # - Checking the build type in CMakeLists.txt is a bad practice, it is better to use generator expressions when importing targets + # - CMake modules do not expand cmake generator expressions when testing for a system/compiler feature + # - Testing CMAKE_BUILD_TYPE does not work well with multi-configuration generators, but those do not fill CMAKE_BUILD_TYPE + # - The "right" way to write this is "$<$>:-D_FORTIFY_SOURCE=2>", but it fails the build configuration + IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -D_FORTIFY_SOURCE=2") + ENDIF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") IF (NOT ANDROID AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT APPLE) SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -Wa,--noexecstack") ENDIF () diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt index 07ebafa040..74791fa1d5 100644 --- a/kstars/CMakeLists.txt +++ b/kstars/CMakeLists.txt @@ -12,6 +12,7 @@ endif () if (NOT ANDROID) find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIR}) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) find_package(Threads REQUIRED) endif () @@ -179,7 +180,6 @@ if (INDI_FOUND) ekos/auxiliary/buildfilteroffsets.ui ekos/auxiliary/opslogs.ui ekos/auxiliary/serialportassistant.ui - ekos/auxiliary/stellarsolverprofileeditor.ui ekos/auxiliary/darklibrary.ui ekos/auxiliary/opticaltrains.ui ekos/auxiliary/ledstatuswidget.ui @@ -221,9 +221,6 @@ if (INDI_FOUND) ekos/auxiliary/tabledelegate.cpp ekos/auxiliary/opslogs.cpp ekos/auxiliary/rotatorutils.cpp - ekos/auxiliary/stellarsolverprofileeditor.cpp - ekos/auxiliary/stellarsolverprofile.cpp - ekos/auxiliary/solverutils.cpp ekos/auxiliary/serialportassistant.cpp ekos/auxiliary/portselector.cpp ekos/auxiliary/ledstatuswidget.cpp @@ -438,6 +435,16 @@ if (CFITSIO_FOUND) fitsviewer/fitsstretchui.ui fitsviewer/opsfits.ui ) + set (ekos_SRCS + ${ekos_SRCS} + ekos/auxiliary/stellarsolverprofileeditor.cpp + ekos/auxiliary/stellarsolverprofile.cpp + ekos/auxiliary/solverutils.cpp + ) + set (ekosui_SRCS + ${ekosui_SRCS} + ekos/auxiliary/stellarsolverprofileeditor.ui + ) include_directories(${CFITSIO_INCLUDE_DIR}) endif(CFITSIO_FOUND) @@ -1301,6 +1308,10 @@ IF (NOT ANDROID) target_link_libraries(KStarsLib KF5::NotifyConfig) endif(KF5NotifyConfig_FOUND) + if (StellarSolver_FOUND) + target_link_libraries(KStarsLib StellarSolver::stellarsolver) + endif(StellarSolver_FOUND) + if(NOT WIN32) target_link_libraries(KStarsLib m) endif(NOT WIN32) @@ -1357,8 +1368,6 @@ if(INDI_FOUND) ## Android: Requires INDI Qt5 Client built for Android if (NOT ANDROID) target_link_libraries(KStarsLib ${CMAKE_THREAD_LIBS_INIT}) - # StellarSolver - target_link_libraries(KStarsLib StellarSolver::stellarsolver) endif () if(WIN32 OR ANDROID)