diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml new file mode 100644 index 00000000..ea0a74fc --- /dev/null +++ b/.github/workflows/stage.yml @@ -0,0 +1,99 @@ +name: Build OPC UA module stagings + +on: + push: + schedule: + - cron: '0 2 * * 1' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + resolve: + name: Resolve the core commit + runs-on: ubuntu-latest + outputs: + core-ref: ${{ steps.core.outputs.ref }} + channel: ${{ steps.channel.outputs.channel }} + steps: + - uses: actions/checkout@v4 + + - uses: openDAQ/openDAQ-CI/.github/actions/resolve-channel@jira/TBBAS-3477-staging-check + id: channel + + - name: Read the pinned core ref + id: core + shell: bash + run: echo "ref=$(cat opendaq_ref)" >> "$GITHUB_OUTPUT" + + stage: + needs: resolve + name: OpcUaModules + permissions: + contents: read + packages: write + uses: openDAQ/openDAQ-CI/.github/workflows/stage.yml@jira/TBBAS-3439-multi-staging + with: + timeout: '[{"timeout-minutes": 180}]' + staging-pull: >- + [ + { "artifact": "core-windows-2022-x86_64-msvs-v143-release", "packages": [{ "path": "ghcr.io/openDAQ/test/staging/opendaq", "tag": "${{ needs.resolve.outputs.core-ref }}", "annotations": { "com.opendaq.custom.platform": "windows", "com.opendaq.settings.arch": "x86_64" } }] }, + { "artifact": "core-windows-2022-x86-msvs-v143-release", "packages": [{ "path": "ghcr.io/openDAQ/test/staging/opendaq", "tag": "${{ needs.resolve.outputs.core-ref }}", "annotations": { "com.opendaq.custom.platform": "windows", "com.opendaq.settings.arch": "x86" } }] }, + { "artifact": "core-manylinux_2_28-x86_64-ninja-gcc-release", "packages": [{ "path": "ghcr.io/openDAQ/test/staging/opendaq", "tag": "${{ needs.resolve.outputs.core-ref }}", "annotations": { "com.opendaq.custom.platform": "manylinux_2_28", "com.opendaq.settings.arch": "x86_64" } }] }, + { "artifact": "core-ubuntu-22.04-x86_64-ninja-gcc-release", "packages": [{ "path": "ghcr.io/openDAQ/test/staging/opendaq", "tag": "${{ needs.resolve.outputs.core-ref }}", "annotations": { "com.opendaq.custom.platform": "linux", "com.opendaq.settings.arch": "x86_64" } }] }, + { "artifact": "core-ubuntu-22.04-armv8-ninja-gcc-release", "packages": [{ "path": "ghcr.io/openDAQ/test/staging/opendaq", "tag": "${{ needs.resolve.outputs.core-ref }}", "annotations": { "com.opendaq.custom.platform": "linux", "com.opendaq.settings.arch": "armv8" } }] }, + { "artifact": "core-macos-26-x86_64-ninja-appleclang-release","packages": [{ "path": "ghcr.io/openDAQ/test/staging/opendaq", "tag": "${{ needs.resolve.outputs.core-ref }}", "annotations": { "com.opendaq.custom.platform": "macos", "com.opendaq.settings.arch": "x86_64" } }] }, + { "artifact": "core-macos-26-armv8-ninja-appleclang-release", "packages": [{ "path": "ghcr.io/openDAQ/test/staging/opendaq", "tag": "${{ needs.resolve.outputs.core-ref }}", "annotations": { "com.opendaq.custom.platform": "macos", "com.opendaq.settings.arch": "armv8" } }] } + ] + include-jobs: >- + [ + "windows-2022-x86_64-msvs-v143-release", + "windows-2022-x86-msvs-v143-release", + "manylinux_2_28-x86_64-ninja-gcc-release", + "ubuntu-22.04-x86_64-ninja-gcc-release", + "ubuntu-22.04-armv8-ninja-gcc-release", + "macos-26-x86_64-ninja-appleclang-release", + "macos-26-armv8-ninja-appleclang-release" + ] + packages: >- + [ + { "match-jobs": ["windows-2022-x86_64-msvs-v143-release"], "artifacts": [{ "name": "core-windows-2022-x86_64-msvs-v143-release", "dir": "staging-deps" }] }, + { "match-jobs": ["windows-2022-x86-msvs-v143-release"], "artifacts": [{ "name": "core-windows-2022-x86-msvs-v143-release", "dir": "staging-deps" }] }, + { "match-jobs": ["manylinux_2_28-x86_64-ninja-gcc-release"], "artifacts": [{ "name": "core-manylinux_2_28-x86_64-ninja-gcc-release", "dir": "staging-deps" }] }, + { "match-jobs": ["ubuntu-22.04-x86_64-ninja-gcc-release"], "artifacts": [{ "name": "core-ubuntu-22.04-x86_64-ninja-gcc-release", "dir": "staging-deps" }] }, + { "match-jobs": ["ubuntu-22.04-armv8-ninja-gcc-release"], "artifacts": [{ "name": "core-ubuntu-22.04-armv8-ninja-gcc-release", "dir": "staging-deps" }] }, + { "match-jobs": ["macos-26-x86_64-ninja-appleclang-release"],"artifacts": [{ "name": "core-macos-26-x86_64-ninja-appleclang-release", "dir": "staging-deps" }] }, + { "match-jobs": ["macos-26-armv8-ninja-appleclang-release"], "artifacts": [{ "name": "core-macos-26-armv8-ninja-appleclang-release", "dir": "staging-deps" }] } + ] + cmake-presets: >- + [ + { + "match-jobs": ["*"], + "configure-preset": "stage", + "cache-variables": + { + "CMAKE_PREFIX_PATH": "${sourceDir}/staging-deps;${sourceDir}/staging-deps/opt/opendaq" + } + }, + { + "match-jobs": ["macos-*"], + "cache-variables": {"CMAKE_OSX_DEPLOYMENT_TARGET": "10.15"} + } + ] + cpack-presets: >- + [ + { + "match-jobs": ["*"], + "stagings": [{"name": "opcua"}] + } + ] + staging-push: >- + [ + { + "path": "ghcr.io/${{ github.repository_owner }}/${{ needs.resolve.outputs.channel }}/staging/opcua-modules", + "artifacts": ["staging-*/opcua"], + "tags": ["latest"] + } + ] diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df94b39..63075436 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ set(REPO_OPTION_PREFIX DAQMODULES_OPCUA) list(APPEND CMAKE_MESSAGE_CONTEXT ${REPO_NAME}) add_subdirectory(cmake) +# Names the install components of the modules: openDAQ__Runtime / _Development +set(SDK_NAME "${OPENDAQ_SDK_NAME}") + opendaq_read_file_contents("${CMAKE_CURRENT_LIST_DIR}/module_version" module_version) opendaq_get_version_major_minor_patch("${module_version}" ${REPO_OPTION_PREFIX}_VERSION) @@ -85,3 +88,7 @@ add_subdirectory(external/boost) add_subdirectory(external) add_subdirectory(shared) add_subdirectory(modules) + +if (PROJECT_IS_TOP_LEVEL) + include(cmake/Packing.cmake) +endif() diff --git a/CMakePresets.json b/CMakePresets.json index 7cb57754..a875a993 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -224,6 +224,18 @@ "cacheVariables": { "DAQMODULES_OPCUA_ENABLE_TESTS": "ON" } + }, + { + "name": "stage", + "hidden": true, + "cacheVariables": { + "DAQMODULES_OPCUA_ENABLE_CLIENT": "ON", + "DAQMODULES_OPCUA_ENABLE_SERVER": "ON", + "DAQMODULES_OPCUA_ENABLE_GENERIC_CLIENT": "OFF", + "DAQMODULES_OPCUA_ENABLE_EXAMPLE_APP": "OFF", + "DAQMODULES_OPCUA_ENABLE_TESTS": "OFF", + "CPACK_COMPONENTS_ALL": "openDAQ_opcua_client_module_Runtime;openDAQ_opcua_server_module_Runtime" + } } ], "testPresets": [ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 9a35aa9b..6c7fd46f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -8,7 +8,7 @@ include(FetchContent) FetchContent_Declare( opendaq-cmake-utils GIT_REPOSITORY https://github.com/openDAQ/opendaq-cmake-utils.git - GIT_TAG v1.0.1 + GIT_TAG ci/staging GIT_PROGRESS ON ) FetchContent_MakeAvailable(opendaq-cmake-utils) diff --git a/cmake/Packing.cmake b/cmake/Packing.cmake new file mode 100644 index 00000000..77dd5a5a --- /dev/null +++ b/cmake/Packing.cmake @@ -0,0 +1,53 @@ +## +## CPack configuration for the OPC UA modules +## + +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +set(CPACK_PACKAGE_VENDOR "openDAQ d.o.o.") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "openDAQ OPC UA client and server modules") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://opendaq.io/") +set(CPACK_PACKAGE_CONTACT "info@opendaq.io") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) + +set(CPACK_VERBATIM_VARIABLES ON) +set(CPACK_THREADS 0) + +set(CPACK_GENERATOR TGZ) +set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) + +if(NOT CPACK_PACKAGE_DIRECTORY) + set(CPACK_PACKAGE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/_packages") +endif() + +## +## Package filename and staging metadata +## +## Format: opcua-modules-[-]----- +## Composed by opendaq-cmake-utils, the same way core names its packages. +## + +set(CPACK_OPENDAQ_META_PACKAGE_NAME "opcua-modules") + +execute_process(COMMAND git -C "${CMAKE_CURRENT_SOURCE_DIR}" rev-parse --short=7 HEAD + OUTPUT_VARIABLE _PACKING_SHORT_SHA + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) +if(_PACKING_SHORT_SHA) + set(CPACK_OPENDAQ_META_PACKAGE_VERSION_SUFFIX "-${_PACKING_SHORT_SHA}") +endif() + +opendaq_detect_settings() +opendaq_detect_package() +opendaq_compose_package_triplet() +opendaq_compose_package_file_name() + +# Let each cpack run name the package it produces (-D CPACK_OPENDAQ_META_PACKAGE_NAME=...). +set(CPACK_PROJECT_CONFIG_FILE "${CPACK_OPENDAQ_PROJECT_CONFIG}") + +include(CPack) diff --git a/opendaq_ref b/opendaq_ref index 881016eb..0d7a81b2 100644 --- a/opendaq_ref +++ b/opendaq_ref @@ -1 +1 @@ -e6f13d80fa7c64697e5549fc1d897b03ad813415 +64ab85c594f0ad5fef169c84ae24bda251540f38