Skip to content

chore(submodules): update cli for v2.7.0 (#422) #55

chore(submodules): update cli for v2.7.0 (#422)

chore(submodules): update cli for v2.7.0 (#422) #55

Workflow file for this run

name: sdk-release
"on":
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Optional tag to build/release (e.g. v2.6.0). If empty, uses the current ref."
required: false
default: ""
permissions:
contents: write
concurrency:
group: sdk-release-${{ github.workflow }}-${{ github.event.inputs.tag || github.ref }}
cancel-in-progress: false
jobs:
build-sdk:
name: build-sdk-${{ matrix.profile }} (linux / x86_64)
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
profile:
- default
- web
- data
- desktop
- p2p
- game
- agent
- all
env:
VIX_SDK_PROFILE: ${{ matrix.profile }}
BUILD_DIR: build-sdk-${{ matrix.profile }}
INSTALL_DIR: install-sdk-${{ matrix.profile }}
ASSET: vix-sdk-${{ matrix.profile }}-linux-x86_64.tar.gz
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Checkout tag (manual input)
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' }}
shell: bash
run: |
set -euxo pipefail
git fetch --tags --force
git checkout "tags/${{ github.event.inputs.tag }}"
# ----------------------------------------------------------------
# Base deps shared by every profile.
# ----------------------------------------------------------------
- name: Install base deps (Linux)
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
pkg-config \
ninja-build \
ca-certificates \
git \
curl \
unzip \
zip \
tar \
nlohmann-json3-dev \
libssl-dev \
zlib1g-dev \
libsqlite3-dev \
libbrotli-dev \
libspdlog-dev \
libfmt-dev
# ----------------------------------------------------------------
# Heavy deps installed ONLY for profiles that need them.
# - desktop/all -> GTK + WebKit2GTK (Linux WebView)
# - game/all -> SDL2 + OpenGL
# - all -> MySQL client (full SDK parity)
# ----------------------------------------------------------------
- name: Install WebView deps (desktop/all)
if: ${{ matrix.profile == 'desktop' || matrix.profile == 'all' }}
shell: bash
run: |
set -euxo pipefail
sudo apt-get install -y --no-install-recommends \
libgtk-3-dev \
libgl1-mesa-dev
sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev || \
sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.0-dev
pkg-config --modversion gtk+-3.0
pkg-config --modversion webkit2gtk-4.1 || pkg-config --modversion webkit2gtk-4.0
- name: Install SDL/OpenGL deps (game/all)
if: ${{ matrix.profile == 'game' || matrix.profile == 'all' }}
shell: bash
run: |
set -euxo pipefail
sudo apt-get install -y --no-install-recommends \
libsdl2-dev \
libsdl2-image-dev \
libgl1-mesa-dev
- name: Install MySQL client deps (all)
if: ${{ matrix.profile == 'all' }}
shell: bash
run: |
set -euxo pipefail
sudo apt-get install -y --no-install-recommends libmysqlcppconn-dev
# ----------------------------------------------------------------
# Configure: the profile drives module selection. We still pass the
# heavy backend sub-flags explicitly for desktop/game/all so they
# match historical full-SDK behavior and are unambiguous in logs.
# ----------------------------------------------------------------
- name: Configure SDK (${{ matrix.profile }})
shell: bash
run: |
set -euxo pipefail
CMAKE_ARGS=(
-S . -B "$BUILD_DIR" -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/${INSTALL_DIR}"
-DVIX_SDK_PROFILE="${VIX_SDK_PROFILE}"
-DVIX_ENABLE_INSTALL=ON
-DVIX_BUILD_EXAMPLES=OFF
-DVIX_BUILD_TESTS=OFF
-DVIX_ENABLE_WARNINGS=ON
-DVIX_ENABLE_HTTP_COMPRESSION=ON
)
case "$VIX_SDK_PROFILE" in
all)
CMAKE_ARGS+=(
-DVIX_DB_USE_MYSQL=ON
-DVIX_UI_ENABLE_LINUX_WEBVIEW=ON
-DVIX_GAME_ENABLE_SDL=ON
-DVIX_GAME_ENABLE_SDL_OPENGL=ON
)
;;
desktop)
CMAKE_ARGS+=(
-DVIX_UI_ENABLE_LINUX_WEBVIEW=ON
)
;;
game)
CMAKE_ARGS+=(
-DVIX_GAME_ENABLE_SDL=ON
-DVIX_GAME_ENABLE_SDL_OPENGL=ON
)
;;
esac
cmake "${CMAKE_ARGS[@]}"
- name: Build SDK
shell: bash
run: |
set -euxo pipefail
cmake --build "$BUILD_DIR" -j2
- name: Install SDK
shell: bash
run: |
set -euxo pipefail
cmake --install "$BUILD_DIR"
- name: Normalize vendored Asio headers
shell: bash
run: |
set -euxo pipefail
ASIO_INCLUDE_DIR="third_party/asio-src/asio/include"
test -d "$ASIO_INCLUDE_DIR/asio"
test -f "$ASIO_INCLUDE_DIR/asio.hpp"
mkdir -p "$INSTALL_DIR/include"
mkdir -p "$INSTALL_DIR/include/vix/third_party/asio"
cp -a "$ASIO_INCLUDE_DIR/asio" "$INSTALL_DIR/include/"
cp -a "$ASIO_INCLUDE_DIR/asio.hpp" "$INSTALL_DIR/include/"
cp -a "$ASIO_INCLUDE_DIR/asio" "$INSTALL_DIR/include/vix/third_party/asio/"
cp -a "$ASIO_INCLUDE_DIR/asio.hpp" "$INSTALL_DIR/include/vix/third_party/asio/"
test -f "$INSTALL_DIR/include/asio/io_context.hpp"
test -f "$INSTALL_DIR/include/asio.hpp"
test -f "$INSTALL_DIR/include/vix/third_party/asio/asio/io_context.hpp"
test -f "$INSTALL_DIR/include/vix/third_party/asio/asio.hpp"
# ----------------------------------------------------------------
# Verification. A shared shell library expresses each check once;
# each profile asserts only what it should contain. Checks for the
# foundation (CLI/core/base headers/libs + CMake package + Asio)
# run for every profile. Optional-module checks are gated by profile.
# ----------------------------------------------------------------
- name: Verify installed SDK tree (${{ matrix.profile }})
shell: bash
run: |
set -euxo pipefail
P="$VIX_SDK_PROFILE"
ID="$INSTALL_DIR"
# --- helpers ------------------------------------------------
have_h() { test -f "$ID/include/$1" || { echo "MISSING header: $1" >&2; exit 1; }; }
have_l() { test -f "$ID/lib/$1" || { echo "MISSING lib: $1" >&2; exit 1; }; }
no_h() { if [ -f "$ID/include/$1" ]; then echo "UNEXPECTED header: $1" >&2; exit 1; fi; }
no_l() { if [ -f "$ID/lib/$1" ]; then echo "UNEXPECTED lib: $1" >&2; exit 1; fi; }
# profile membership test: "in default web all" style
has() { case " $1 " in *" $P "*) return 0;; *) return 1;; esac; }
# --- foundation: every profile ------------------------------
test -d "$ID"
test -f "$ID/bin/vix"
have_h "vix.hpp"
have_h "vix/core.hpp"
have_h "vix/json/Simple.hpp"
have_h "vix/error/Error.hpp"
have_h "vix/path/Path.hpp"
have_h "vix/fs.hpp"
have_h "vix/console.hpp"
have_h "vix/env.hpp"
have_h "vix/log.hpp"
have_l "libvix_error.a"
have_l "libvix_path.a"
have_l "libvix_fs.a"
have_l "libvix_io.a"
have_l "libvix_env.a"
have_l "libvix_os.a"
have_l "libvix_utils.a"
have_l "libvix_log.a"
have_l "libvix_core.a"
test -f "$ID/include/asio/io_context.hpp"
test -f "$ID/include/asio.hpp"
test -f "$ID/include/vix/third_party/asio/asio/io_context.hpp"
test -f "$ID/include/vix/third_party/asio/asio.hpp"
test -f "$ID/lib/cmake/Vix/VixConfig.cmake"
test -f "$ID/lib/cmake/Vix/VixConfigVersion.cmake"
test -f "$ID/lib/cmake/Vix/VixTargets.cmake"
# --- async/time/process/threadpool: all profiles -----------
have_h "vix/async.hpp"; have_l "libvix_async.a"
have_h "vix/time.hpp"
have_h "vix/process.hpp"; have_l "libvix_process.a"
have_h "vix/threadpool.hpp"; have_l "libvix_threadpool.a"
# --- Note (+ UI/template) ----------------------------------
# Present in every profile in this tree (Note ships with UI).
have_h "vix/template.hpp"
have_h "vix/ui.hpp"
have_h "vix/note/note.hpp"
have_l "libui.a"
have_l "libvix_note.a"
test -d "$ID/include/vix/ui"
test -d "$ID/include/vix/note"
test -f "$ID/include/vix/ui/assets/AssetManager.hpp"
# --- web modules: web + all --------------------------------
if has "web all"; then
have_h "vix/websocket.hpp"; have_l "libvix_websocket.a"
have_h "vix/validation.hpp"
have_h "vix/crypto.hpp"
have_h "vix/webrpc.hpp"
have_h "vix/requests.hpp"
have_h "vix/requests/requests.hpp"
have_l "libvix_requests.a"
have_l "libvix_middleware.a"
nm -C "$ID/lib/libvix_websocket.a" | grep "vix::websocket::LowLevelServer::run"
nm -C "$ID/lib/libvix_websocket.a" | grep "vix::websocket::Session::shutdown_now"
nm -C "$ID/lib/libvix_websocket.a" | grep "vix::websocket::LongPollingManager::push_to"
fi
# --- data modules: data + all ------------------------------
if has "data all"; then
have_h "vix/db.hpp"
have_h "vix/orm.hpp"
have_h "vix/kv.hpp"; have_l "libvix_kv.a"
have_h "vix/cache.hpp"; have_l "libvix_cache.a"
fi
# --- p2p modules: p2p + all --------------------------------
if has "p2p all"; then
have_h "vix/p2p.hpp"; have_l "libvix_p2p.a"
have_h "vix/p2p_http.hpp"; have_l "libvix_p2p_http.a"
have_h "vix/crypto.hpp"
have_l "libvix_net.a"
have_l "libvix_sync.a"
fi
# --- desktop: WebView present in desktop + all -------------
if has "desktop all"; then
grep -R "vix::ui" "$ID/lib/cmake/Vix" -n
grep -R "libui" "$ID/lib/cmake/Vix" -n
fi
# --- game: game + all --------------------------------------
if has "game all"; then
have_h "vix/game.hpp"
fi
# --- agent: agent + all ------------------------------------
if has "agent all"; then
have_h "vix/agent.hpp"
have_l "libvix_cache.a" # agent depends on cache
fi
# --- exclusions: default must NOT carry heavy domains ------
if [ "$P" = "default" ]; then
no_h "vix/game.hpp"
no_h "vix/agent.hpp"
no_h "vix/db.hpp"
no_h "vix/orm.hpp"
no_h "vix/p2p.hpp"
no_h "vix/websocket.hpp"
no_l "libvix_p2p.a"
no_l "libvix_websocket.a"
fi
# --- exclusions: web must NOT carry game/agent/p2p ---------
if [ "$P" = "web" ]; then
no_h "vix/game.hpp"
no_h "vix/agent.hpp"
no_h "vix/p2p.hpp"
fi
# --- exclusions: data must NOT carry game/agent ------------
if [ "$P" = "data" ]; then
no_h "vix/game.hpp"
no_h "vix/agent.hpp"
fi
# --- inventory for logs ------------------------------------
find "$ID/include" -maxdepth 5 -type f | sort > installed-headers.txt
find "$ID/lib" -maxdepth 2 -type f | sort > installed-libs.txt
find "$ID/lib/cmake" -maxdepth 5 -type f | sort > installed-cmake-files.txt
echo "=== headers ==="; sed -n '1,200p' installed-headers.txt
echo "=== libs ==="; cat installed-libs.txt
echo "=== cmake ==="; cat installed-cmake-files.txt
- name: Package SDK
shell: bash
run: |
set -euxo pipefail
mkdir -p dist
tar -C "$INSTALL_DIR" -czf "dist/$ASSET" .
ls -lah dist
- name: Validate packaged SDK binary
shell: bash
run: |
set -euxo pipefail
rm -rf smoke-bin
mkdir -p smoke-bin
tar -xzf "dist/$ASSET" -C smoke-bin
test -f smoke-bin/bin/vix
file smoke-bin/bin/vix
ldd smoke-bin/bin/vix || true
smoke-bin/bin/vix --version
# ----------------------------------------------------------------
# Consumer link smoke test, scoped per profile. A generated main.cpp
# includes only the headers the profile is expected to ship, so the
# find_package + link path is exercised for exactly that profile.
# ----------------------------------------------------------------
- name: Validate packaged SDK with consumer project (${{ matrix.profile }})
shell: bash
run: |
set -euxo pipefail
P="$VIX_SDK_PROFILE"
has() { case " $1 " in *" $P "*) return 0;; *) return 1;; esac; }
rm -rf smoke-sdk consumer
mkdir -p smoke-sdk consumer
tar -xzf "dist/$ASSET" -C smoke-sdk
{
echo '#include <vix.hpp>'
echo '#include <vix/core.hpp>'
echo '#include <vix/async.hpp>'
echo '#include <vix/time.hpp>'
echo '#include <vix/process.hpp>'
echo '#include <vix/threadpool.hpp>'
echo '#include <vix/ui.hpp>'
echo '#include <vix/note/note.hpp>'
if has "web all"; then
echo '#include <vix/websocket.hpp>'
echo '#include <vix/validation.hpp>'
echo '#include <vix/crypto.hpp>'
echo '#include <vix/webrpc.hpp>'
echo '#include <vix/requests.hpp>'
fi
if has "data all"; then
echo '#include <vix/db.hpp>'
echo '#include <vix/orm.hpp>'
echo '#include <vix/kv.hpp>'
echo '#include <vix/cache.hpp>'
fi
if has "p2p all"; then
echo '#include <vix/p2p.hpp>'
echo '#include <vix/p2p_http.hpp>'
fi
if has "game all"; then
echo '#include <vix/game.hpp>'
fi
if has "agent all"; then
echo '#include <vix/agent.hpp>'
fi
echo '#include <iostream>'
echo 'int main() {'
echo ' vix::ui::ViewContext view_context{};'
echo ' (void)view_context;'
if has "web all"; then
echo ' vix::websocket::Config ws_config{};'
echo ' vix::websocket::Router ws_router{};'
echo ' (void)ws_config; (void)ws_router;'
fi
echo ' std::cout << "Vix SDK consumer (profile='"$P"') build and link works\n";'
echo ' return 0;'
echo '}'
} > consumer/main.cpp
cat > consumer/CMakeLists.txt <<'EOF'
cmake_minimum_required(VERSION 3.20)
project(vix_sdk_consumer LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(Vix CONFIG REQUIRED)
add_executable(app main.cpp)
target_link_libraries(app PRIVATE vix::vix)
EOF
cmake -S consumer -B consumer/build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/smoke-sdk"
cmake --build consumer/build -j2
./consumer/build/app
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: sdk-dist-${{ matrix.profile }}-linux-x86_64
path: dist/*
if-no-files-found: error
publish-sdk:
name: publish-sdk
needs:
- build-sdk
runs-on: ubuntu-24.04
steps:
- name: Download SDK artifacts
uses: actions/download-artifact@v4
with:
path: dist-all
- name: Flatten SDK assets
shell: bash
run: |
set -euxo pipefail
mkdir -p dist
for p in default web data desktop p2p game agent all; do
f="vix-sdk-${p}-linux-x86_64.tar.gz"
find dist-all -type f -name "$f" -exec cp -f {} dist/ \;
test -f "dist/$f" || { echo "missing expected asset: $f" >&2; exit 1; }
done
ls -lah dist
- name: Generate sha256 files
shell: bash
run: |
set -euxo pipefail
cd dist
for f in vix-sdk-*.tar.gz; do
[ -f "$f" ] || continue
sha256sum "$f" > "$f.sha256"
done
ls -lah
- name: Sign SDK assets
shell: bash
env:
MINISIGN_PRIVATE_KEY_B64: ${{ secrets.MINISIGN_PRIVATE_KEY_B64 }}
run: |
set -euxo pipefail
if [ -z "${MINISIGN_PRIVATE_KEY_B64:-}" ]; then
echo "MINISIGN_PRIVATE_KEY_B64 is not configured; skipping minisign signing."
exit 0
fi
cd dist
MS_VER="0.11"
curl -fL --retry 10 --retry-delay 2 \
-o minisign-linux.tar.gz \
"https://github.com/jedisct1/minisign/releases/download/${MS_VER}/minisign-${MS_VER}-linux.tar.gz"
tar -xzf minisign-linux.tar.gz
chmod +x minisign-linux/x86_64/minisign
MS="./minisign-linux/x86_64/minisign"
keyfile="$(mktemp)"
chmod 600 "$keyfile"
printf "%s" "$MINISIGN_PRIVATE_KEY_B64" | base64 -d > "$keyfile"
test -s "$keyfile"
for f in vix-sdk-*.tar.gz; do
[ -f "$f" ] || continue
"$MS" -S -s "$keyfile" -m "$f"
done
rm -f "$keyfile"
rm -rf minisign-linux minisign-linux.tar.gz
ls -lah
- name: Determine tag
id: tag
shell: bash
run: |
set -euxo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.tag }}" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
- name: Upload SDK assets to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
files: dist/*