Skip to content

Breaking changes: remove deprecated code, return weak_ptr instead of … #32

Breaking changes: remove deprecated code, return weak_ptr instead of …

Breaking changes: remove deprecated code, return weak_ptr instead of … #32

Workflow file for this run

name: Release SDK
on:
push:
tags:
- "v*" # Triggers on version tags like v0.1.0, v1.0.0
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.0)'
required: true
type: string
env:
CARGO_TERM_COLOR: always
# sccache caches rustc invocations across runs. RUSTC_WRAPPER is exported
# only after the setup step verifies the GHA cache backend is reachable, so
# transient cache backend failures fall back to uncached rustc instead of
# failing the build.
SCCACHE_GHA_ENABLED: "true"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_DEFAULT_TRIPLET: x64-windows-static-md
VCPKG_DEFAULT_HOST_TRIPLET: x64-windows-static-md
VCPKG_TARGET_TRIPLET: x64-windows-static-md
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: linux-x64
generator: Ninja
- os: ubuntu-24.04-arm
name: linux-arm64
generator: Ninja
- os: macos-26-xlarge
name: macos-arm64
generator: Ninja
- os: macos-26-large
name: macos-x64
generator: Ninja
# Pinned to Windows 2022 for current VS 17 implementation
- os: windows-2022
name: windows-x64
generator: "Visual Studio 17 2022"
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout (with submodules)
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
fetch-depth: 0
# ---------- Extract version ----------
- name: Extract version
id: version
shell: bash
run: |
set -euo pipefail
if [[ -n "${{ github.event.inputs.version }}" ]]; then
VERSION="${{ github.event.inputs.version }}"
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
# github.ref_name is e.g. "v0.2.4"
TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"
else
VERSION="0.0.0-dev"
fi
# Basic validation: must not be empty, must not start with v, no spaces
if [[ -z "$VERSION" ]]; then
echo "ERROR: Derived version is empty"
exit 1
fi
if [[ "$VERSION" == v* ]]; then
echo "ERROR: Derived version still has leading 'v': $VERSION"
exit 1
fi
if [[ "$VERSION" =~ [[:space:]] ]]; then
echo "ERROR: Version contains whitespace: '$VERSION'"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "SDK Version: $VERSION"
# ---------- vcpkg for Windows ----------
- name: Export GitHub Actions cache environment variables
if: runner.os == 'Windows'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup vcpkg (Windows only)
if: runner.os == 'Windows'
uses: lukka/run-vcpkg@6fe69898af670ac05f4a8427cc5cff4fb361cee5 # v11.5
with:
vcpkgGitCommitId: 'fb87e2bb3fe69e16c224989acb5a61349166c782'
# ---------- OS-specific deps ----------
- name: Install deps (Ubuntu)
if: runner.os == 'Linux'
run: |
set -eux
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ninja-build pkg-config \
llvm-dev libclang-dev clang \
libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-dev \
libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \
libxrandr-dev libxi-dev libxkbcommon-dev \
libasound2-dev libpulse-dev \
libssl-dev \
libprotobuf-dev protobuf-compiler \
libabsl-dev \
libwayland-dev libdecor-0-dev
- name: Install deps (macOS)
if: runner.os == 'macOS'
run: |
set -eux
brew update
brew install cmake ninja protobuf abseil
# ---------- Rust toolchain ----------
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: stable
- name: Install Rust cross-compilation target
if: matrix.name == 'macos-x64'
run: rustup target add x86_64-apple-darwin
# ---------- Setup sccache ----------
- name: Setup sccache
uses: mozilla-actions/sccache-action@054db53350805f83040bf3e6e9b8cf5a139aa7c9 # v0.0.7
- name: Enable sccache wrapping (probe first)
shell: bash
run: |
if sccache --start-server >/dev/null 2>&1; then
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
echo "::notice::sccache enabled (RUSTC_WRAPPER=sccache)"
else
echo "::warning::sccache backend unreachable; building without compile cache this run"
fi
# ---------- Cache Cargo ----------
- name: Cache Cargo registry
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-${{ matrix.name }}-cargo-registry-${{ hashFiles('client-sdk-rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.name }}-cargo-registry-
- name: Cache cargo target
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: client-sdk-rust/target/
key: ${{ runner.os }}-${{ matrix.name }}-cargo-target-${{ hashFiles('client-sdk-rust/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.name }}-cargo-target-
# ---------- Build environment setup ----------
- name: Set Linux build environment
if: runner.os == 'Linux'
run: |
echo "CXXFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV
echo "CFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV
LLVM_VERSION=$(llvm-config --version | cut -d. -f1)
echo "LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib" >> $GITHUB_ENV
# ---------- Build + Bundle (Unix) ----------
- name: Build and Bundle (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
chmod +x build.sh
version="${{ steps.version.outputs.version }}"
bundleDir="sdk-out/livekit-sdk-${{ matrix.name }}-${version}"
if [[ -z "$version" ]]; then
echo "ERROR: version is empty"
exit 1
fi
if [[ "$version" == "0.0.0-dev" ]]; then
echo "ERROR: refusing to build release with fallback version: $version"
exit 1
fi
if [[ "${{ matrix.name }}" == "macos-x64" ]]; then
./build.sh release-examples --version "$version" --bundle --prefix "$bundleDir" --macos-arch x86_64
else
./build.sh release-examples --version "$version" --bundle --prefix "$bundleDir"
fi
# List bundle contents
echo "Bundle contents:"
find "$bundleDir" -type f | head -120
- name: Validate bundle version metadata (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
version="${{ steps.version.outputs.version }}"
bundleDir="sdk-out/livekit-sdk-${{ matrix.name }}-${version}"
header="${bundleDir}/include/livekit/build.h"
buildInfo="${bundleDir}/share/livekit/build-info.json"
test -f "$header"
test -f "$buildInfo"
grep -F "#define LIVEKIT_BUILD_VERSION \"${version}\"" "$header"
if grep -F '#define LIVEKIT_BUILD_VERSION "0.0.0"' "$header"; then
echo "ERROR: bundle reports fallback SDK version"
exit 1
fi
grep -F "\"sdk_version\": \"${version}\"" "$buildInfo"
grep -Eq '"rust_submodule_commit": "[0-9a-f]{7,}"' "$buildInfo"
grep -Eq '"livekit_ffi_version": "[0-9]+\.[0-9]+\.[0-9]+' "$buildInfo"
# ---------- Build + Bundle (Windows) ----------
- name: Build and Bundle (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$version = "${{ steps.version.outputs.version }}"
$bundleDir = "sdk-out/livekit-sdk-${{ matrix.name }}-$version"
if ([string]::IsNullOrWhiteSpace($version)) { throw "version is empty" }
.\build.cmd release-examples --version "$version"
# There is the missing step that generates LiveKitTargets.cmake in the install tree
# TODO(sxian): fix it after getting access to a windows machine
cmake --install "build-release" --config Release --prefix "$bundleDir"
Write-Host "Bundle contents:"
Get-ChildItem -Recurse -File $bundleDir | Select-Object -First 200 | ForEach-Object { $_.FullName }
# ---------- Verify exported ABI: no third-party symbol leaks ----------
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v6.0.0
with:
python-version: '3.x'
- name: Symbol leak check (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -eux
libdir="build-release/lib"
if [[ "$RUNNER_OS" == "macOS" ]]; then
lib="${libdir}/liblivekit.dylib"
if [[ ! -f "${lib}" ]]; then
lib="build-release/bin/liblivekit.dylib"
fi
else
lib="${libdir}/liblivekit.so"
if [[ ! -f "${lib}" ]]; then
lib="build-release/bin/liblivekit.so"
fi
fi
python3 .github/scripts/check_no_private_symbols.py "${lib}"
- name: Symbol leak check (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$candidates = @(
"build-release/bin/livekit.dll",
"build-release/lib/livekit.dll"
)
$lib = $null
foreach ($p in $candidates) {
if (Test-Path -LiteralPath $p) { $lib = $p; break }
}
if ($null -eq $lib) {
Write-Error "livekit.dll not found in any of: $($candidates -join ', ')"
exit 1
}
python .github/scripts/check_no_private_symbols.py "$lib"
- name: Validate bundle version metadata (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$version = "${{ steps.version.outputs.version }}"
$bundleDir = "sdk-out/livekit-sdk-${{ matrix.name }}-$version"
$header = Join-Path $bundleDir "include/livekit/build.h"
$buildInfo = Join-Path $bundleDir "share/livekit/build-info.json"
if (!(Test-Path $header)) { throw "Missing $header" }
if (!(Test-Path $buildInfo)) { throw "Missing $buildInfo" }
$headerText = Get-Content -Raw $header
$expectedHeaderVersion = "#define LIVEKIT_BUILD_VERSION `"$version`""
if (!$headerText.Contains($expectedHeaderVersion)) {
throw "Header does not report expected SDK version $version"
}
if ($headerText.Contains('#define LIVEKIT_BUILD_VERSION "0.0.0"')) {
throw "Bundle reports fallback SDK version"
}
$buildInfoText = Get-Content -Raw $buildInfo
$expectedBuildInfoVersion = "`"sdk_version`": `"$version`""
if (!$buildInfoText.Contains($expectedBuildInfoVersion)) {
throw "Build info does not report expected SDK version $version"
}
if ($buildInfoText -match '"rust_submodule_commit": "unknown"') {
throw "Build info is missing Rust submodule commit"
}
if ($buildInfoText -match '"livekit_ffi_version": "unknown"') {
throw "Build info is missing livekit-ffi version"
}
# ---------- Upload artifact (raw directory, no pre-compression) ----------
- name: Upload build artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: livekit-sdk-${{ matrix.name }}-${{ steps.version.outputs.version }}
path: sdk-out/livekit-sdk-${{ matrix.name }}-${{ steps.version.outputs.version }}
# ---------- Release Job ----------
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Extract version
id: version
shell: bash
run: |
set -euo pipefail
if [[ -n "${{ github.event.inputs.version }}" ]]; then
VERSION="${{ github.event.inputs.version }}"
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"
else
VERSION="0.0.0-dev"
fi
if [[ -z "$VERSION" ]]; then
echo "ERROR: Derived version is empty"
exit 1
fi
if [[ "$VERSION" == v* ]]; then
echo "ERROR: Derived version still has leading 'v': $VERSION"
exit 1
fi
if [[ "$VERSION" =~ [[:space:]] ]]; then
echo "ERROR: Version contains whitespace: '$VERSION'"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "SDK Version: $VERSION"
- name: Download all artifacts
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: ${{ github.workspace }}/artifacts
- name: List downloaded artifacts
run: |
echo "Downloaded artifacts structure:"
find ${{ github.workspace }}/artifacts -type f | head -100
# ---------- Create archives in release job ----------
- name: Create release archives
shell: bash
run: |
mkdir -p release-assets
VERSION="${{ steps.version.outputs.version }}"
cd ${{ github.workspace }}/artifacts
# List what we have
echo "Artifacts downloaded:"
ls -la
# Create tar.gz for Linux and macOS
for platform in linux-x64 linux-arm64 macos-arm64 macos-x64; do
dirName="livekit-sdk-${platform}-${VERSION}"
if [[ -d "${dirName}" ]]; then
echo "Creating archive for ${platform}..."
tar -czf "${{ github.workspace }}/release-assets/${dirName}.tar.gz" "${dirName}"
echo "Created: ${dirName}.tar.gz"
fi
done
# Create zip for Windows
dirName="livekit-sdk-windows-x64-${VERSION}"
if [[ -d "${dirName}" ]]; then
echo "Creating archive for windows-x64..."
zip -r "${{ github.workspace }}/release-assets/${dirName}.zip" "${dirName}"
echo "Created: ${dirName}.zip"
fi
- name: List release assets
run: ls -la ${{ github.workspace }}/release-assets/
- name: Create GitHub Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: LiveKit C++ SDK v${{ steps.version.outputs.version }}
draft: true
files: ${{ github.workspace }}/release-assets/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ---------- Publish Docs Job ----------
publish-docs:
name: Publish Documentation
needs: release
uses: ./.github/workflows/publish-docs.yml
with:
version: ${{ needs.release.outputs.version }}
secrets: inherit