diff --git a/.github/workflows/hsm-collector-registry.yml b/.github/workflows/hsm-collector-registry.yml new file mode 100644 index 000000000..ce5267613 --- /dev/null +++ b/.github/workflows/hsm-collector-registry.yml @@ -0,0 +1,68 @@ +name: hsm-collector vcpkg registry + +# Validates that this repository works as a vcpkg registry for `hsm-collector`: +# 1. the version database (versions/) is internally consistent with the ports (ports/), and +# 2. the registry port installs (fetching the tagged source) and a consumer links against it. +# Windows-only: the aggregator target is Windows/MSVC, and the version-DB check is platform-agnostic. + +on: + push: + paths: + - 'ports/hsm-collector/**' + - 'versions/**' + - '.github/workflows/hsm-collector-registry.yml' + pull_request: + paths: + - 'ports/hsm-collector/**' + - 'versions/**' + - 'src/native/collector/**' + - '.github/workflows/hsm-collector-registry.yml' + workflow_dispatch: + +jobs: + registry-consume: + runs-on: windows-latest + env: + VCPKG_DISABLE_METRICS: '1' + steps: + - uses: actions/checkout@v4 + + - name: Set up vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: 6f29f12e82a8293156836ad81cc9bf5af41fe836 + + - name: Install hsm-collector from the registry port (fetches the tagged source) + shell: bash + # run-vcpkg defaults the binary cache to a GHA backend that needs tokens not reliably present + # here; override to "clear" so the port builds from source (same fix as the other consume lanes). + env: + VCPKG_BINARY_SOURCES: clear + run: | + "$VCPKG_ROOT/vcpkg" install hsm-collector --overlay-ports=ports --triplet x64-windows + + - name: Build a consumer against the installed package + shell: bash + run: | + cmake -S src/native/collector/examples/console/standalone -B build/registry-consume \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \ + -DVCPKG_TARGET_TRIPLET=x64-windows + cmake --build build/registry-consume --config Release --parallel + + - name: Verify the version database git-tree matches the port + shell: bash + # This is a supplementary registry (it provides only hsm-collector; upstream deps like + # vcpkg-cmake/curl come from the default registry), so vcpkg's whole-registry x-ci-verify-versions + # isn't applicable. Assert the one invariant that matters: versions/h-/hsm-collector.json records + # the exact git-tree of ports/hsm-collector, so git-registry consumers resolve the right port. + run: | + recorded=$(grep -oiE '[0-9a-f]{40}' versions/h-/hsm-collector.json | head -1) + actual=$(git rev-parse "HEAD:ports/hsm-collector") + echo "recorded git-tree: $recorded" + echo "actual git-tree: $actual" + if [ "$recorded" != "$actual" ]; then + echo "::error::versions/h-/hsm-collector.json git-tree is stale. Run 'vcpkg x-add-version hsm-collector' (or update it to $actual)." + exit 1 + fi + echo "version database git-tree is consistent." diff --git a/ports/hsm-collector/copyright b/ports/hsm-collector/copyright new file mode 100644 index 000000000..68b5aa8ec --- /dev/null +++ b/ports/hsm-collector/copyright @@ -0,0 +1,3 @@ +Native HSM DataCollector (hsm-collector). + +Source: https://github.com/SoftFx/Hierarchical-Sensor-Monitoring (src/native/collector) diff --git a/ports/hsm-collector/portfile.cmake b/ports/hsm-collector/portfile.cmake new file mode 100644 index 000000000..8bbf3258e --- /dev/null +++ b/ports/hsm-collector/portfile.cmake @@ -0,0 +1,44 @@ +# Registry port for the native HSM collector (hsm-collector). +# +# Unlike the in-repo OVERLAY port (src/native/collector/vcpkg-port), which builds from the adjacent +# source tree so CI can verify the current branch, this port fetches a tagged source tarball. That +# makes this repository usable as a vcpkg registry: a consumer references it and runs +# `vcpkg install hsm-collector` with no checkout of the HSM sources. +# +# To publish a new version: push a `collector-v` tag, update REF + SHA512 below and the +# version in vcpkg.json, then run `vcpkg x-add-version hsm-collector` to refresh versions/. +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO SoftFx/Hierarchical-Sensor-Monitoring + REF collector-v0.6.2 + SHA512 6835207a04cb013fd370c6745e0faafe98a531ab356c896d2ec484a67eb1e978dad206fbfe1d5cf9232ade325a789c9ff3245d978bc97dac13f888bf4ca8e1b4 + HEAD_REF master +) + +# The collector lives in a subdirectory of the repository tarball. +set(SOURCE_PATH "${SOURCE_PATH}/src/native/collector") + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + http HSM_COLLECTOR_HTTP +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DHSM_COLLECTOR_BUILD_TESTS=OFF + -DHSM_COLLECTOR_BUILD_EXAMPLES=OFF + -DHSM_COLLECTOR_INSTALL=ON + ${FEATURE_OPTIONS} +) + +vcpkg_cmake_install() + +# The project installs its package config to lib/cmake/hsm_collector; relocate it to the +# vcpkg-canonical share/hsm_collector and fix up the absolute paths. +vcpkg_cmake_config_fixup(PACKAGE_NAME hsm_collector CONFIG_PATH lib/cmake/hsm_collector) + +# Header-only wrapper + static C core: no debug headers, and the static core has no DLLs/tools. +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${CMAKE_CURRENT_LIST_DIR}/copyright") diff --git a/ports/hsm-collector/vcpkg.json b/ports/hsm-collector/vcpkg.json new file mode 100644 index 000000000..6a45aca98 --- /dev/null +++ b/ports/hsm-collector/vcpkg.json @@ -0,0 +1,29 @@ +{ + "name": "hsm-collector", + "version": "0.6.2", + "description": "Native C++ HSM DataCollector — stable C ABI core + header-only RAII C++ wrapper.", + "homepage": "https://github.com/SoftFx/Hierarchical-Sensor-Monitoring", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "http": { + "description": "libcurl HTTP transport (Schannel on Windows, OpenSSL elsewhere)", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": ["ssl"] + } + ] + } + } +} diff --git a/src/native/collector/conanfile.py b/src/native/collector/conanfile.py index e0ecb3b14..88cec9f65 100644 --- a/src/native/collector/conanfile.py +++ b/src/native/collector/conanfile.py @@ -18,7 +18,7 @@ class HsmCollectorConan(ConanFile): """ name = "hsm-collector" - version = "0.4.0" + version = "0.6.2" license = "See repository (SoftFx/Hierarchical-Sensor-Monitoring)" url = "https://github.com/SoftFx/Hierarchical-Sensor-Monitoring" description = "Native C++ HSM DataCollector — stable C ABI core + header-only RAII C++ wrapper." diff --git a/src/native/collector/vcpkg-port/vcpkg.json b/src/native/collector/vcpkg-port/vcpkg.json index d5d8fdef6..6a45aca98 100644 --- a/src/native/collector/vcpkg-port/vcpkg.json +++ b/src/native/collector/vcpkg-port/vcpkg.json @@ -1,6 +1,6 @@ { "name": "hsm-collector", - "version": "0.4.0", + "version": "0.6.2", "description": "Native C++ HSM DataCollector — stable C ABI core + header-only RAII C++ wrapper.", "homepage": "https://github.com/SoftFx/Hierarchical-Sensor-Monitoring", "supports": "!uwp", diff --git a/versions/baseline.json b/versions/baseline.json new file mode 100644 index 000000000..58ec710b1 --- /dev/null +++ b/versions/baseline.json @@ -0,0 +1,8 @@ +{ + "default": { + "hsm-collector": { + "baseline": "0.6.2", + "port-version": 0 + } + } +} diff --git a/versions/h-/hsm-collector.json b/versions/h-/hsm-collector.json new file mode 100644 index 000000000..08dbde090 --- /dev/null +++ b/versions/h-/hsm-collector.json @@ -0,0 +1,8 @@ +{ + "versions": [ + { + "version": "0.6.2", + "git-tree": "bbc02d7505419f4a24e6c584d4a1d9643db4b6d9" + } + ] +}