port of RPM building and gitea workflows (#1601)
Build and Deploy on local RHEL9 / build (push) Successful in 2m0s
Build on RHEL9 docker image / build (push) Successful in 3m57s
Build on RHEL8 docker image / build (push) Successful in 5m7s
Build and Deploy on local RHEL8 / build (push) Successful in 5m14s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m43s
Run Simulator Tests on local RHEL8 / build (push) Successful in 24m4s

This commit is contained in:
Erik Fröjdh
2026-10-06 20:09:56 +02:00
committed by GitHub
parent 3ed9d0a07b
commit bf6c5f2c8a
18 changed files with 298 additions and 78 deletions
+97
View File
@@ -0,0 +1,97 @@
name: Build RPMs on RHEL8 docker image
on:
workflow_dispatch:
inputs:
deploy:
description: "Upload the RPMs to the Gitea package registry"
type: boolean
default: false
permissions:
contents: read
jobs:
build:
runs-on: "ubuntu-latest"
container:
image: gitea.psi.ch/detectors/rhel8-detectors-dev
steps:
- name: Clone repository
run: |
git lfs install --skip-smudge
echo Cloning ${{ github.ref_name }}
git clone https://${{secrets.GITHUB_TOKEN}}@gitea.psi.ch/${{ github.repository }}.git --branch=${{ github.ref_name }} .
- name: Install build dependencies
run: |
dnf -y install rpm-build qt5-qtbase-devel qt5-qtsvg-devel \
libpng-devel zlib-devel expat-devel libtiff-devel
- name: Build with versioned binaries
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DSLS_USE_GUI=ON \
-DSLS_USE_MOENCH=ON \
-DSLS_INSTALL_VERSIONED_BINARIES=ON
cmake --build build -j 2
- name: Build RPMs
run: |
cpack --config build/CPackConfig.cmake -G RPM \
-D 'CPACK_COMPONENTS_ALL=cli;receiver;zmq;gui' -B build/rpms
- name: Inspect RPMs
run: |
for rpm in build/rpms/*.rpm; do
echo "::group::$rpm"
rpm -qpi "$rpm"
rpm -qpl "$rpm"
rpm -qpR "$rpm"
echo "::endgroup::"
done
- name: Install RPMs and check versioned binaries
run: |
VERSION=$(cat VERSION)
dnf -y install build/rpms/*.rpm
for component in cli receiver zmq gui; do
rpm -q slsdetectorpackage-${VERSION}-${component}
done
for exe in sls_detector_get sls_detector_put slsReceiver \
slsMultiReceiver slsFrameSynchronizer moench03ZmqProcess slsDetectorGui; do
test -x /usr/bin/${exe}-${VERSION}
test ! -e /usr/bin/${exe}
done
sls_detector_get-${VERSION} --version
slsReceiver-${VERSION} --version
- name: Upload RPMs to Gitea
if: ${{ inputs.deploy }}
env:
SERVICE: ${{ secrets.SERVICE }}
run: |
url=https://gitea.psi.ch/api/packages/${{ github.repository_owner }}/rpm/el8
upload() {
curl --silent --show-error --output /tmp/upload-response \
--write-out "%{http_code}" \
--user "detectors-gitea:${SERVICE}" \
--upload-file "$1" "$url/upload"
}
for rpm in build/rpms/*.rpm; do
echo "Uploading $rpm"
code=$(upload "$rpm")
if [ "$code" = 409 ]; then
echo "Already in the registry, replacing"
curl --silent --show-error --fail -X DELETE \
--user "detectors-gitea:${SERVICE}" \
"$url/package/$(rpm -qp --queryformat '%{NAME}/%{VERSION}-%{RELEASE}/%{ARCH}' "$rpm")"
code=$(upload "$rpm")
fi
if [ "$code" != 201 ]; then
echo "Upload failed with HTTP $code"
cat /tmp/upload-response
exit 1
fi
done
+93
View File
@@ -0,0 +1,93 @@
name: Build RPMs on RHEL9 docker image
on:
workflow_dispatch:
inputs:
deploy:
description: "Upload the RPMs to the Gitea package registry"
type: boolean
default: false
permissions:
contents: read
jobs:
build:
runs-on: "ubuntu-latest"
container:
image: gitea.psi.ch/detectors/rhel9-detectors-dev
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
dnf -y install rpm-build qt5-qtbase-devel qt5-qtsvg-devel \
libpng-devel zlib-devel expat-devel libtiff-devel
- name: Build with versioned binaries
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DSLS_USE_GUI=ON \
-DSLS_USE_MOENCH=ON \
-DSLS_INSTALL_VERSIONED_BINARIES=ON
cmake --build build -j 2
- name: Build RPMs
run: |
cpack --config build/CPackConfig.cmake -G RPM \
-D 'CPACK_COMPONENTS_ALL=cli;receiver;zmq;gui' -B build/rpms
- name: Inspect RPMs
run: |
for rpm in build/rpms/*.rpm; do
echo "::group::$rpm"
rpm -qpi "$rpm"
rpm -qpl "$rpm"
rpm -qpR "$rpm"
echo "::endgroup::"
done
- name: Install RPMs and check versioned binaries
run: |
VERSION=$(cat VERSION)
dnf -y install build/rpms/*.rpm
for component in cli receiver zmq gui; do
rpm -q slsdetectorpackage-${VERSION}-${component}
done
for exe in sls_detector_get sls_detector_put slsReceiver \
slsMultiReceiver slsFrameSynchronizer moench03ZmqProcess slsDetectorGui; do
test -x /usr/bin/${exe}-${VERSION}
test ! -e /usr/bin/${exe}
done
sls_detector_get-${VERSION} --version
slsReceiver-${VERSION} --version
- name: Upload RPMs to Gitea
if: ${{ inputs.deploy }}
env:
SERVICE: ${{ secrets.SERVICE }}
run: |
url=https://gitea.psi.ch/api/packages/${{ github.repository_owner }}/rpm/el9
upload() {
curl --silent --show-error --output /tmp/upload-response \
--write-out "%{http_code}" \
--user "detectors-gitea:${SERVICE}" \
--upload-file "$1" "$url/upload"
}
for rpm in build/rpms/*.rpm; do
echo "Uploading $rpm"
code=$(upload "$rpm")
if [ "$code" = 409 ]; then
echo "Already in the registry, replacing"
curl --silent --show-error --fail -X DELETE \
--user "detectors-gitea:${SERVICE}" \
"$url/package/$(rpm -qp --queryformat '%{NAME}/%{VERSION}-%{RELEASE}/%{ARCH}' "$rpm")"
code=$(upload "$rpm")
fi
if [ "$code" != 201 ]; then
echo "Upload failed with HTTP $code"
cat /tmp/upload-response
exit 1
fi
done
+15 -4
View File
@@ -22,6 +22,7 @@ endif()
include(cmake/project_version.cmake)
include(cmake/SlsAddFlag.cmake)
include(cmake/helpers.cmake)
include(cmake/SlsInstallExecutable.cmake)
find_package(Threads REQUIRED)
@@ -234,7 +235,7 @@ option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
option(SLS_USE_JUNGFRAU "compile post processing for Jungfrau" OFF)
option(SLS_USE_MATTERHORN "compile matterhorn server" OFF)
option(SLS_INSTALL_VERSIONED_BINARIES "Add version number to binaries on install" OFF) #Needed for multi version RPM
option(SLS_INSTALL_VERSIONED_BINARIES "Add version number to installed executables and RPM package names" OFF)
option(SLS_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
#Convenience option to switch off defaults when building Moench binaries only
@@ -520,14 +521,18 @@ set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DAQ software for PSI developed detectors")
# RPM-specific settings
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME)
if(SLS_INSTALL_VERSIONED_BINARIES)
string(APPEND CPACK_RPM_PACKAGE_NAME "-${PROJECT_VERSION}")
endif()
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_FILE_NAME
"${PROJECT_NAME_LOWER}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm")
set(CPACK_RPM_PACKAGE_LICENSE "LGPL-3.0")
set(CPACK_RPM_PACKAGE_GROUP "Applications/System")
set(CPACK_RPM_PACKAGE_RELEASE 1)
# Adds %{?dist} to the RPM Release field
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_RPM_COMPONENT_INSTALL ON)
@@ -537,4 +542,10 @@ set(CPACK_RPM_GUI_PACKAGE_REQUIRES
#control which RPMs are generated
set(CPACK_COMPONENTS_ALL cli receiver zmq gui)
include(CPack)
# Keep the project version only once in filenames; RPM expands its metadata.
foreach(component IN LISTS CPACK_COMPONENTS_ALL)
string(TOUPPER "${component}" component_upper)
set(CPACK_RPM_${component_upper}_FILE_NAME
"${PROJECT_NAME_LOWER}-${component}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm")
endforeach()
include(CPack)
+30
View File
@@ -0,0 +1,30 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2026 Contributors to the SLS Detector Package
function(sls_install_executable target)
cmake_parse_arguments(ARG "" "DESTINATION;COMPONENT;EXPORT" "" ${ARGN})
if(NOT ARG_DESTINATION)
set(ARG_DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
set(install_args DESTINATION "${ARG_DESTINATION}")
if(ARG_COMPONENT)
list(APPEND install_args COMPONENT "${ARG_COMPONENT}")
endif()
if(SLS_INSTALL_VERSIONED_BINARIES)
install(PROGRAMS "$<TARGET_FILE:${target}>"
${install_args}
RENAME "$<TARGET_FILE_BASE_NAME:${target}>-${PROJECT_VERSION}${CMAKE_EXECUTABLE_SUFFIX}"
)
else()
set(export_args)
if(ARG_EXPORT)
list(APPEND export_args EXPORT "${ARG_EXPORT}")
endif()
install(TARGETS ${target}
${export_args}
RUNTIME ${install_args}
)
endif()
endfunction()
+46
View File
@@ -240,6 +240,52 @@ Example cmake options Comment
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for cmk script option to hint library location. <zeromq for different slsDetectorPackage versions>`
3.2.3. Build RPM packages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
CPack builds separate RPMs for the command line tools (``cli``), receiver
executables (``receiver``), Moench processing tools (``zmq``), and GUI (``gui``).
Install ``rpm-build`` and the dependencies for the selected features, and build
on the target distribution or a matching container.
For example, to package the command line tools, receiver and GUI:
.. code-block:: bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr -DSLS_USE_GUI=ON \
-DSLS_INSTALL_VERSIONED_BINARIES=ON
cmake --build build -j4
cpack --config build/CPackConfig.cmake -G RPM \
-D 'CPACK_COMPONENTS_ALL=cli;receiver;gui' -B build
Select only components enabled in the build. Add ``-DSLS_USE_MOENCH=ON`` and
the ``zmq`` component to package the Moench tools.
``SLS_INSTALL_VERSIONED_BINARIES=ON`` includes the project version in the RPM
package names, for example ``slsdetectorpackage-10.1.0-cli`` and
``slsdetectorpackage-10.1.0-gui``. Installed executables also receive a version
suffix, such as ``sls_detector_get-10.1.0`` and ``slsDetectorGui-10.1.0``. This
allows RPMs for different project versions to be installed side by side.
RPM revisions of the same project version retain the same package names and
can be upgraded normally.
RPM filenames include the version once, for example
``slsdetectorpackage-cli-10.1.0-1.fc44.x86_64.rpm``. The package's internal name
remains ``slsdetectorpackage-10.1.0-cli`` and its RPM version remains ``10.1.0``.
The option also applies to Jungfrau processing tools and virtual detector
servers installed with ``cmake --install``. These are outside the current RPM
component selection. Executables in the build directory keep their original
names. With the option set to ``OFF`` (the default), installed executables and
RPM package names omit the project version.
The RPM components contain executables; Python bindings, libraries and headers
are not included. A full ``cmake --install`` still installs libraries and
headers at their usual paths, so use separate prefixes for full installations
of different versions.
3.3. Build on old distributions using conda
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -92,7 +92,5 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
set_property(TARGET ${exe} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
sls_install_executable(${exe} DESTINATION bin)
endforeach(exe ${JUNGFRAU_EXECUTABLES})
install(TARGETS ${JUNGFRAU_EXECUTABLES} DESTINATION bin)
@@ -92,19 +92,6 @@ foreach(exe ${MOENCH_EXECUTABLES})
set_property(TARGET ${exe} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
# Mainly for RPMs to enable side by side installations of different versions
if(SLS_INSTALL_VERSIONED_BINARIES)
install(PROGRAMS "$<TARGET_FILE:${exe}>"
DESTINATION bin
RENAME "$<TARGET_FILE_BASE_NAME:${exe}>-${PROJECT_VERSION}"
COMPONENT zmq
)
else()
install(TARGETS ${exe}
DESTINATION bin
COMPONENT zmq
)
endif()
sls_install_executable(${exe} DESTINATION bin COMPONENT zmq)
endforeach(exe ${MOENCH_EXECUTABLES})
+1 -5
View File
@@ -119,8 +119,4 @@ if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
set_property(TARGET slsDetectorGui PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
install(TARGETS slsDetectorGui
# EXPORT "${TARGETS_EXPORT_NAME}" #do not export gui
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT gui
)
sls_install_executable(slsDetectorGui COMPONENT gui)
@@ -44,6 +44,4 @@ set_target_properties(ctbDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS ctbDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(ctbDetectorServer_virtual)
@@ -38,9 +38,7 @@ set_target_properties(eigerDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS eigerDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(eigerDetectorServer_virtual)
configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY)
@@ -39,9 +39,7 @@ set_target_properties(gotthard2DetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS gotthard2DetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(gotthard2DetectorServer_virtual)
configure_file(config_gotthard2.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard2.txt COPYONLY)
configure_file(detid_gotthard2.txt ${CMAKE_BINARY_DIR}/bin/detid_gotthard2.txt COPYONLY)
@@ -41,9 +41,8 @@ set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
#target_compile_options(jungfrauDetectorServer_virtual PRIVATE -m32)
#target_link_options(jungfrauDetectorServer_virtual PRIVATE -m32)
install(TARGETS jungfrauDetectorServer_virtual
sls_install_executable(jungfrauDetectorServer_virtual
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(config_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/config_jungfrau.txt COPYONLY)
@@ -41,9 +41,7 @@ if(SLS_USE_SIMULATOR)
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS matterhornDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(matterhornDetectorServer_virtual)
endif() # maybe better to have a else if build with simulators on one always uses the virtual server in MatterhornApp
if(SLS_USE_MATTERHORN)
@@ -91,9 +89,7 @@ if(SLS_USE_MATTERHORN)
RUNTIME_OUTPUT_DIRECTORY ${RUNTIME_OUTPUT_DIRECTORY}
)
install(TARGETS matterhornDetectorServer
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(matterhornDetectorServer)
endif()
if(SLS_USE_TESTS)
@@ -37,9 +37,8 @@ set_target_properties(moenchDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS moenchDetectorServer_virtual
sls_install_executable(moenchDetectorServer_virtual
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(detid_moench.txt ${CMAKE_BINARY_DIR}/bin/detid_moench.txt COPYONLY)
@@ -41,9 +41,7 @@ set_target_properties(mythen3DetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS mythen3DetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(mythen3DetectorServer_virtual)
configure_file(DefaultPattern_mythen3.txt ${CMAKE_BINARY_DIR}/bin/DefaultPattern_mythen3.txt COPYONLY)
configure_file(detid_mythen3.txt ${CMAKE_BINARY_DIR}/bin/detid_mythen3.txt COPYONLY)
@@ -41,9 +41,7 @@ set_target_properties(xilinx_ctbDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS xilinx_ctbDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(xilinx_ctbDetectorServer_virtual)
configure_file(chip_config_xilinx.txt ${CMAKE_BINARY_DIR}/bin/chip_config_xilinx.txt COPYONLY)
configure_file(reset_chip_xilinx.txt ${CMAKE_BINARY_DIR}/bin/reset_chip_xilinx.txt COPYONLY)
+2 -14
View File
@@ -109,21 +109,9 @@ if(SLS_USE_TEXTCLIENT)
set_property(TARGET ${val1} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
# Mainly for RPMs to enable side by side installations of different versions
if(SLS_INSTALL_VERSIONED_BINARIES)
install(PROGRAMS "$<TARGET_FILE:${val1}>"
DESTINATION bin
RENAME "$<TARGET_FILE_BASE_NAME:${val1}>-${PROJECT_VERSION}"
COMPONENT cli
)
else()
install(TARGETS ${val1}
DESTINATION bin
COMPONENT cli
)
endif()
sls_install_executable(${val1} DESTINATION bin COMPONENT cli)
endforeach()
endif(SLS_USE_TEXTCLIENT)
+3 -13
View File
@@ -173,22 +173,12 @@ if (SLS_USE_RECEIVER_BINARIES)
slsMultiReceiver
slsFrameSynchronizer
)
if(SLS_INSTALL_VERSIONED_BINARIES)
message(STATUS "Versioned binaries will be installed")
foreach(target IN LISTS SLS_RECEIVER_BINARIES)
install(PROGRAMS "$<TARGET_FILE:${target}>"
DESTINATION ${CMAKE_INSTALL_BINDIR}
RENAME "$<TARGET_FILE_BASE_NAME:${target}>-${PROJECT_VERSION}"
COMPONENT receiver
)
endforeach()
else()
install(TARGETS ${SLS_RECEIVER_BINARIES}
foreach(target IN LISTS SLS_RECEIVER_BINARIES)
sls_install_executable(${target}
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT receiver
)
endif()
endforeach()