From 56d59fd57be1e6edaafd80cd6407528f4990c945 Mon Sep 17 00:00:00 2001 From: Aleksandr Kovalko Date: Tue, 12 May 2026 13:43:29 +0200 Subject: [PATCH] Add xrepo to install docs; tighten registry-test triggers geo-utils-cpp is now published in xmake-io/xmake-repo (PR #9942), so add an xrepo install section to README.md and docs/getting-started.md, a CI badge, and an `xrepo.yml` smoke-test workflow (Linux/macOS/Windows) mirroring `vcpkg.yml`. The consumer's xmake.lua sits next to its existing CMakeLists.txt so the same `main.cpp` is exercised by both stacks. Also tighten triggers on `vcpkg.yml` (and apply the same to `xrepo.yml`): both install the *released* package, not HEAD, so push/PR runs would produce a misleading green check. Reduce to `workflow_dispatch` + weekly cron, which is the only signal that actually catches registry/runner drift. --- .github/workflows/vcpkg.yml | 17 ++++----- .github/workflows/xrepo.yml | 71 +++++++++++++++++++++++++++++++++++++ README.md | 18 ++++++++++ docs/getting-started.md | 27 ++++++++++++++ tests/consumer/xmake.lua | 12 +++++++ 5 files changed, 134 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/xrepo.yml create mode 100644 tests/consumer/xmake.lua diff --git a/.github/workflows/vcpkg.yml b/.github/workflows/vcpkg.yml index acd275f..9feb46a 100644 --- a/.github/workflows/vcpkg.yml +++ b/.github/workflows/vcpkg.yml @@ -9,21 +9,16 @@ # - Drift in vcpkg infrastructure or GitHub runner images # - Our exported CMake config / target name not surviving an install via vcpkg # -# What this does NOT catch: -# - Regressions introduced in this repo on a PR — vcpkg ships the *released* -# version (currently 1.0.1), not HEAD. The PR/push runs verify the -# published port still works; the weekly schedule catches drift over time. -# -# Triggered automatically on push/PR to master/main; runs weekly to catch -# upstream drift; can also be run manually from the Actions tab. +# Triggers: weekly cron + manual dispatch only. This workflow tests the +# *released* version (currently 1.0.1) from the vcpkg registry, not HEAD, +# so running it on every PR/push would produce a misleading green check +# (it cannot fail on a PR that breaks HEAD). Cron catches registry / runner +# drift over time; use workflow_dispatch when bumping the port version. +# If the workflow itself or tests/consumer/ changes, run it manually. name: vcpkg on: - push: - branches: [master, main] - pull_request: - branches: [master, main] workflow_dispatch: schedule: # Mondays 06:00 UTC. Catches drift in the vcpkg registry / runner images. diff --git a/.github/workflows/xrepo.yml b/.github/workflows/xrepo.yml new file mode 100644 index 0000000..80e601e --- /dev/null +++ b/.github/workflows/xrepo.yml @@ -0,0 +1,71 @@ +# xrepo integration smoke test. +# +# Installs geo-utils-cpp from the official xmake-io/xmake-repo registry, then +# builds and runs the minimal consumer project (tests/consumer/main.cpp) via +# its xmake.lua. Runs on Linux/macOS/Windows in parallel. +# +# What this catches: +# - Breakage in the published xrepo package recipe +# - Drift in xmake-repo or GitHub runner images +# - Our public header layout not surviving an install via xrepo +# +# Triggers: weekly cron + manual dispatch only. This workflow tests the +# *released* version (currently 1.0.1) from xmake-repo, not HEAD, so running +# it on every PR/push would produce a misleading green check (it cannot fail +# on a PR that breaks HEAD). Cron catches registry / runner drift over time; +# use workflow_dispatch when bumping the package version. If the workflow +# itself or tests/consumer/ changes, run it manually. + +name: xrepo + +on: + workflow_dispatch: + schedule: + # Tuesdays 06:00 UTC. Offset from vcpkg.yml to spread runner load. + - cron: '0 6 * * 2' + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + xrepo-consumer: + name: xrepo + consumer (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.os }} + + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v4 + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: latest + + # xmake caches the package registry locally; refresh so the just-published + # port is visible. Matches the `vcpkg` workflow's "Sync vcpkg registry" step. + - name: Update xmake-repo + run: xmake repo --update -v + + # `xmake config` resolves `add_requires("geo-utils-cpp")` against xmake-repo + # and installs it into the local xmake cache. + - name: Build consumer via xrepo + working-directory: tests/consumer + run: | + xmake config --yes --mode=release + xmake build smoke + + - name: Run consumer smoke test + working-directory: tests/consumer + run: xmake run smoke diff --git a/README.md b/README.md index 93d1520..cd122d0 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ vcpkg + + xrepo + Code quality @@ -89,6 +92,21 @@ find_package(GeoUtilsCpp 1.0.1 REQUIRED) target_link_libraries(your_target PRIVATE geo::utils) ``` +### xrepo + +```sh +xrepo install geo-utils-cpp +``` + +Or declare it as a dependency in your `xmake.lua`: + +```lua +add_requires("geo-utils-cpp") + +target("your_target") + add_packages("geo-utils-cpp") +``` + ### find_package ```cmake diff --git a/docs/getting-started.md b/docs/getting-started.md index 107f6f0..c164961 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -49,6 +49,33 @@ find_package(GeoUtilsCpp 1.0.1 REQUIRED) target_link_libraries(your_target PRIVATE geo::utils) ``` +### xrepo + +The library is available in the official +[xmake-repo](https://github.com/xmake-io/xmake-repo) registry as +`geo-utils-cpp`. + +Install via the `xrepo` CLI: + +```sh +xrepo install geo-utils-cpp +``` + +Or declare it as a dependency in your `xmake.lua`: + +```lua +add_requires("geo-utils-cpp") + +target("your_target") + set_kind("binary") + add_files("main.cpp") + add_packages("geo-utils-cpp") +``` + +A minimal smoke-test consumer (`tests/consumer/`) is included for both CMake +and xmake builds — see [`tests/consumer/xmake.lua`](../tests/consumer/xmake.lua) +for the xmake variant. + ### find_package Install the library first, then: diff --git a/tests/consumer/xmake.lua b/tests/consumer/xmake.lua new file mode 100644 index 0000000..51a6122 --- /dev/null +++ b/tests/consumer/xmake.lua @@ -0,0 +1,12 @@ +-- Smoke test for an installed geo-utils-cpp package via xrepo. +-- Mirrors CMakeLists.txt: declare the dependency, link, build, run main.cpp. +-- Used by .github/workflows/xrepo.yml. + +set_languages("c++17") + +add_requires("geo-utils-cpp") + +target("smoke") + set_kind("binary") + add_files("main.cpp") + add_packages("geo-utils-cpp")