Skip to content

Commit 1319328

Browse files
Use the same bundle for CI runs as releases (#242)
* Unified CI build artifacts with release SDK bundles by packaging through CMake install rules * CI artifacts now include public headers, runtime libraries, build metadata, and find_package(LiveKit) CMake files * CI no longer uploads internal build-only static dependency archives * Added Windows build.cmd --bundle --prefix support and switched the Windows release job to use it * Added CI validation for required SDK bundle files * Fixed Windows batch argument parsing so --prefix correctly uses its supplied directory
1 parent 4959b76 commit 1319328

5 files changed

Lines changed: 103 additions & 19 deletions

File tree

‎.github/workflows/builds.yml‎

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,32 @@ jobs:
3434
include:
3535
- os: ubuntu-22.04
3636
name: ubuntu-22.04-x64
37-
build_cmd: ./build.sh release-examples
37+
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-x64
3838
build_dir: build-release
3939
- os: ubuntu-22.04-arm
4040
name: ubuntu-22.04-arm64
41-
build_cmd: ./build.sh release-examples
41+
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-arm64
4242
build_dir: build-release
4343
- os: ubuntu-24.04
4444
name: ubuntu-24.04-x64
45-
build_cmd: ./build.sh release-examples
45+
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-x64
4646
build_dir: build-release
4747
- os: ubuntu-24.04-arm
4848
name: ubuntu-24.04-arm64
49-
build_cmd: ./build.sh release-examples
49+
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-arm64
5050
build_dir: build-release
5151
- os: macos-26-xlarge
5252
name: macos-arm64
53-
build_cmd: ./build.sh release-examples
53+
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-macos-arm64
5454
build_dir: build-release
5555
- os: macos-26-large
5656
name: macos-x64
57-
build_cmd: ./build.sh release-examples --macos-arch x86_64
57+
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-macos-x64 --macos-arch x86_64
5858
build_dir: build-release
5959
# Pinned to Windows 2022 for current VS 17 implementation
6060
- os: windows-2022
6161
name: windows-x64
62-
build_cmd: .\build.cmd release-examples
62+
build_cmd: .\build.cmd release-examples --bundle --prefix sdk-out\livekit-sdk-windows-x64
6363
build_dir: build-release
6464

6565
name: Build (${{ matrix.name }})
@@ -325,15 +325,23 @@ jobs:
325325
}
326326
if ($failed) { exit 1 } else { exit 0 }
327327
328+
- name: Verify SDK bundle
329+
shell: bash
330+
run: |
331+
set -euo pipefail
332+
bundle="sdk-out/livekit-sdk-${{ matrix.name }}"
333+
test -f "${bundle}/include/livekit/livekit.h"
334+
test -f "${bundle}/share/livekit/build-info.json"
335+
test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfig.cmake"
336+
test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfigVersion.cmake"
337+
test -f "${bundle}/lib/cmake/LiveKit/LiveKitTargets.cmake"
338+
328339
# ---------- Upload artifacts ----------
329-
- name: Upload build artifacts
340+
- name: Upload SDK bundle
330341
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
331342
with:
332343
name: livekit-sdk-${{ matrix.name }}
333-
path: |
334-
${{ matrix.build_dir }}/lib/
335-
${{ matrix.build_dir }}/include/
336-
${{ matrix.build_dir }}/bin/
344+
path: sdk-out/livekit-sdk-${{ matrix.name }}
337345
retention-days: 7
338346

339347
- name: Upload deprecated linux-x64 alias artifact

‎.github/workflows/make-release.yml‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,7 @@ jobs:
248248
$bundleDir = "sdk-out/livekit-sdk-${{ matrix.name }}-$version"
249249
250250
if ([string]::IsNullOrWhiteSpace($version)) { throw "version is empty" }
251-
.\build.cmd release-examples --version "$version"
252-
253-
# There is the missing step that generates LiveKitTargets.cmake in the install tree
254-
# TODO(sxian): fix it after getting access to a windows machine
255-
cmake --install "build-release" --config Release --prefix "$bundleDir"
251+
.\build.cmd release-examples --version "$version" --bundle --prefix "$bundleDir"
256252
257253
Write-Host "Bundle contents:"
258254
Get-ChildItem -Recurse -File $bundleDir | Select-Object -First 200 | ForEach-Object { $_.FullName }

‎AGENTS.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Be sure to update the directory layout in this file if the directory layout chan
108108

109109
## Build
110110
for building, use the build.sh script for Linux and macOS, and the build.cmd script for Windows. Do not invoke CMake directly to build the SDK.
111-
Updates to ./build.sh and ./build.cmd should be accompanied by updates to this file and the README.md file.
111+
Updates to ./build.sh and ./build.cmd should be accompanied by updates to this file and docs/building.md.
112112

113113
```
114114
./build.sh debug # Debug build
@@ -122,6 +122,11 @@ Updates to ./build.sh and ./build.cmd should be accompanied by updates to this f
122122
./build.sh clean-all # Full clean (C++ + local-install + Rust targets)
123123
```
124124

125+
To create an installable SDK bundle, use the same build command with
126+
`--bundle --prefix <install-dir>` (for example,
127+
`./build.sh release --bundle --prefix sdk-out/livekit-sdk`). On Windows, use
128+
`build.cmd release --bundle --prefix C:\path\to\livekit-sdk`.
129+
125130
The build scripts pass an explicit job count to `cmake --build --parallel`. Set
126131
`CMAKE_BUILD_PARALLEL_LEVEL` to override the default detected logical CPU count.
127132

‎build.cmd‎

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ set "PRESET=windows-release"
99
set "LIVEKIT_VERSION="
1010
set "CMAKE_EXTRA_ARGS="
1111
set "BUILD_PARALLEL_JOBS="
12+
set "DO_BUNDLE="
13+
set "PREFIX="
1214

1315
REM ============================================================
1416
REM Auto-detect LIBCLANG_PATH if not already set
@@ -87,7 +89,20 @@ if /I "%~1"=="--version" (
8789
goto :get_version_value
8890
)
8991

90-
:: 3. Handle unknown arguments
92+
:: 3. Install the SDK bundle after a successful build.
93+
if /I "%~1"=="--bundle" (
94+
set "DO_BUNDLE=1"
95+
shift
96+
goto parse_all
97+
)
98+
99+
:: 4. Set the install prefix for --bundle.
100+
if /I "%~1"=="--prefix" (
101+
shift
102+
goto :get_prefix_value
103+
)
104+
105+
:: 5. Handle unknown arguments
91106
echo ERROR: Unknown option: %~1
92107
exit /b 1
93108

@@ -97,6 +112,15 @@ set "LIVEKIT_VERSION=%~1"
97112
shift
98113
goto parse_all
99114

115+
:get_prefix_value
116+
if "%~1"=="" (
117+
echo ERROR: --prefix requires a value
118+
exit /b 1
119+
)
120+
set "PREFIX=%~1"
121+
shift
122+
goto parse_all
123+
100124
:after_parse
101125
if not defined CMD (
102126
echo ERROR: No command specified
@@ -190,10 +214,15 @@ echo clean Clean both Debug and Release build directories + local-
190214
echo clean-all Full clean (build dirs + local-install + Rust targets)
191215
echo help Show this help
192216
echo.
217+
echo Options (for debug / release):
218+
echo --bundle Install the SDK bundle using cmake --install
219+
echo --prefix ^<dir^> Install prefix for --bundle ^(default: .\sdk-out\livekit-sdk^)
220+
echo.
193221
echo Examples:
194222
echo build.cmd debug
195223
echo build.cmd release
196224
echo build.cmd release-examples
225+
echo build.cmd release --bundle --prefix C:\path\to\livekit-sdk
197226
echo build.cmd debug-tests
198227
echo build.cmd release-tests
199228
echo build.cmd release-all
@@ -232,8 +261,37 @@ if errorlevel 1 (
232261
exit /b 1
233262
)
234263
echo ==^> Build complete!
264+
if defined DO_BUNDLE (
265+
call :install_bundle
266+
if errorlevel 1 exit /b 1
267+
)
235268
goto :eof
236269

270+
:install_bundle
271+
if not defined PREFIX set "PREFIX=%PROJECT_ROOT%\sdk-out\livekit-sdk"
272+
273+
if not "%PREFIX:~1,1%"==":" set "PREFIX=%PROJECT_ROOT%\%PREFIX%"
274+
275+
REM cmd's mkdir/rmdir reject forward slashes; normalize to backslashes.
276+
set "PREFIX=%PREFIX:/=\%"
277+
278+
echo ==^> Installing SDK bundle to: %PREFIX%
279+
if exist "%PREFIX%" rmdir /s /q "%PREFIX%"
280+
if exist "%PREFIX%" (
281+
echo Failed to remove existing bundle directory: %PREFIX%
282+
exit /b 1
283+
)
284+
mkdir "%PREFIX%"
285+
if errorlevel 1 exit /b 1
286+
287+
cmake --install "%BUILD_DIR%" --config %BUILD_TYPE% --prefix "%PREFIX%"
288+
if errorlevel 1 (
289+
echo SDK bundle install failed!
290+
exit /b 1
291+
)
292+
echo ==^> SDK bundle installed.
293+
exit /b 0
294+
237295
:clean
238296
echo ==^> Cleaning build directories...
239297
set "BUILD_DIR_DEBUG=%PROJECT_ROOT%\build-debug"

‎docs/building.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ wrap the right CMake preset for your platform and pick sensible defaults.
115115
# ... same suffixes as build.sh
116116
```
117117

118+
### Create an SDK bundle
119+
120+
To create an installable SDK bundle with public headers, runtime libraries, and
121+
CMake package files, add `--bundle --prefix <install-dir>` to a build command:
122+
123+
**Linux/Mac:**
124+
125+
```bash
126+
./build.sh release --bundle --prefix sdk-out/livekit-sdk
127+
```
128+
129+
**Windows:**
130+
131+
```powershell
132+
.\build.cmd release --bundle --prefix C:\path\to\livekit-sdk
133+
```
134+
118135
The build scripts pass an explicit job count to `cmake --build --parallel`. Set
119136
`CMAKE_BUILD_PARALLEL_LEVEL` to override the auto-detected logical CPU count.
120137

0 commit comments

Comments
 (0)