Skip to content

Commit 0a5d08e

Browse files
two step build/test: base sdk, then with capture
1 parent 98fd218 commit 0a5d08e

5 files changed

Lines changed: 405 additions & 223 deletions

File tree

‎.github/workflows/builds.yml‎

Lines changed: 210 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ permissions:
1212

1313
env:
1414
CARGO_TERM_COLOR: always
15-
# Disable Cargo incremental artifacts. The Rust FFI is built once per
16-
# submodule SHA and cached whole (see the cargo target cache below), so
17-
# incremental dirs add nothing but bloat the cached target/ directory and
18-
# slow the cache upload/download.
15+
# Cache both feature-specific Rust builds per submodule SHA. Cargo
16+
# incremental codegen directories add cache size without helping CMake reuse.
1917
CARGO_INCREMENTAL: "0"
2018
# vcpkg binary caching for Windows. The x-gha backend was removed from vcpkg,
2119
# so use vcpkg's files provider and persist that directory with actions/cache.
@@ -34,71 +32,41 @@ jobs:
3432
include:
3533
- os: ubuntu-22.04
3634
name: ubuntu-22.04-x64
37-
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-x64
35+
build_cmd: ./build.sh release-examples --no-capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-x64
36+
capture_build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-x64-capture
3837
build_dir: build-release
3938
- os: ubuntu-22.04-arm
4039
name: ubuntu-22.04-arm64
41-
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-arm64
40+
build_cmd: ./build.sh release-examples --no-capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-arm64
41+
capture_build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-arm64-capture
4242
build_dir: build-release
4343
- os: ubuntu-24.04
4444
name: ubuntu-24.04-x64
45-
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-x64
45+
build_cmd: ./build.sh release-examples --no-capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-x64
46+
capture_build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-x64-capture
4647
build_dir: build-release
4748
- os: ubuntu-24.04-arm
4849
name: ubuntu-24.04-arm64
49-
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-arm64
50+
build_cmd: ./build.sh release-examples --no-capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-arm64
51+
capture_build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-arm64-capture
5052
build_dir: build-release
5153
- os: macos-26-xlarge
5254
name: macos-arm64
53-
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-macos-arm64
55+
build_cmd: ./build.sh release-examples --no-capture --bundle --prefix sdk-out/livekit-sdk-macos-arm64
56+
capture_build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-macos-arm64-capture
5457
build_dir: build-release
5558
- os: macos-26-large
5659
name: macos-x64
57-
build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-macos-x64 --macos-arch x86_64
60+
build_cmd: ./build.sh release-examples --no-capture --bundle --prefix sdk-out/livekit-sdk-macos-x64 --macos-arch x86_64
61+
capture_build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-macos-x64-capture --macos-arch x86_64
5862
build_dir: build-release
5963
# Pinned to Windows 2022 for current VS 17 implementation
6064
- os: windows-2022
6165
name: windows-x64
62-
build_cmd: .\build.cmd release-examples --bundle --prefix sdk-out\livekit-sdk-windows-x64
66+
build_cmd: .\build.cmd release-examples --no-capture --bundle --prefix sdk-out\livekit-sdk-windows-x64
67+
capture_build_cmd: .\build.cmd release-examples --capture --bundle --prefix sdk-out\livekit-sdk-windows-x64-capture
6368
build_dir: build-release
6469

65-
- os: ubuntu-22.04
66-
name: ubuntu-22.04-x64-capture
67-
build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-x64-capture
68-
build_dir: build-release
69-
capture: true
70-
- os: ubuntu-22.04-arm
71-
name: ubuntu-22.04-arm64-capture
72-
build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-arm64-capture
73-
build_dir: build-release
74-
capture: true
75-
- os: ubuntu-24.04
76-
name: ubuntu-24.04-x64-capture
77-
build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-x64-capture
78-
build_dir: build-release
79-
capture: true
80-
- os: ubuntu-24.04-arm
81-
name: ubuntu-24.04-arm64-capture
82-
build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-arm64-capture
83-
build_dir: build-release
84-
capture: true
85-
- os: macos-26-xlarge
86-
name: macos-arm64-capture
87-
build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-macos-arm64-capture
88-
build_dir: build-release
89-
capture: true
90-
- os: macos-26-large
91-
name: macos-x64-capture
92-
build_cmd: ./build.sh release-examples --capture --bundle --prefix sdk-out/livekit-sdk-macos-x64-capture --macos-arch x86_64
93-
build_dir: build-release
94-
# Pinned to Windows 2022 for current VS 17 implementation
95-
capture: true
96-
- os: windows-2022
97-
name: windows-x64-capture
98-
build_cmd: .\build.cmd release-examples --capture --bundle --prefix sdk-out\livekit-sdk-windows-x64-capture
99-
build_dir: build-release
100-
capture: true
101-
10270
name: Build (${{ matrix.name }})
10371
runs-on: ${{ matrix.os }}
10472

@@ -186,10 +154,6 @@ jobs:
186154
brew update
187155
brew install cmake ninja protobuf abseil
188156
189-
- name: Set up capture dependencies
190-
if: matrix.capture == true
191-
uses: ./.github/actions/setup-capture
192-
193157
# ---------- Rust toolchain ----------
194158
- name: Install Rust (stable)
195159
uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067
@@ -234,9 +198,9 @@ jobs:
234198
path: |
235199
client-sdk-rust/target/
236200
${{ env.CARGO_TARGET_DIR }}
237-
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-${{ steps.rust_sha.outputs.sha }}
201+
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-v3-${{ steps.rust_sha.outputs.sha }}
238202
restore-keys: |
239-
${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-
203+
${{ matrix.os }}-${{ matrix.name }}-cargo-target-v3-
240204
241205
# restore-keys can hydrate target/ from a prior submodule SHA. cxxbridge
242206
# artifacts in webrtc-sys are not compatible across those bumps.
@@ -268,26 +232,6 @@ jobs:
268232
shell: pwsh
269233
run: ${{ matrix.build_cmd }}
270234

271-
# Save the populated target/ now, while the build output still exists and
272-
# before the "Clean after build" step runs clean-all. Save only from main
273-
# pushes so PRs restore from the shared main cache instead of creating
274-
# large PR-scoped target caches that quickly evict useful entries.
275-
- name: Save cargo target
276-
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache-cargo-target.outputs.cache-hit != 'true'
277-
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
278-
with:
279-
path: |
280-
client-sdk-rust/target/
281-
${{ env.CARGO_TARGET_DIR }}
282-
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-${{ steps.rust_sha.outputs.sha }}
283-
284-
- name: Save vcpkg binary cache
285-
if: runner.os == 'Windows' && steps.cache-vcpkg-binary.outputs.cache-hit != 'true'
286-
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
287-
with:
288-
path: ${{ env.VCPKG_BINARY_CACHE_DIR }}
289-
key: ${{ runner.os }}-${{ matrix.name }}-vcpkg-binary-${{ env.VCPKG_TARGET_TRIPLET }}-${{ env.VCPKG_GIT_COMMIT }}-${{ hashFiles('vcpkg.json') }}
290-
291235
# ---------- Smoke test cpp-example-collection binaries ----------
292236
# Built under cpp-example-collection-build/ (not build-dir/bin). Visual Studio
293237
# multi-config places executables in per-target Release/ (or Debug/) subdirs.
@@ -393,36 +337,37 @@ jobs:
393337
run: |
394338
set -euo pipefail
395339
bundle="sdk-out/livekit-sdk-${{ matrix.name }}"
340+
grep -F "#define LIVEKIT_CAPTURE_ENABLED 0" "${bundle}/include/livekit/build.h"
396341
test -f "${bundle}/include/livekit/livekit.h"
397342
test -f "${bundle}/share/livekit/build-info.json"
398343
test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfig.cmake"
399344
test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfigVersion.cmake"
400345
test -f "${bundle}/lib/cmake/LiveKit/LiveKitTargets.cmake"
401346
402-
- name: Test installed capture SDK (Unix)
403-
if: matrix.capture == true && runner.os != 'Windows'
347+
- name: Test installed standard SDK (Unix)
348+
if: runner.os != 'Windows'
404349
shell: bash
405350
run: |
406351
bundle="$GITHUB_WORKSPACE/sdk-out/livekit-sdk-${{ matrix.name }}"
407352
arch_args=()
408353
if [[ "${{ matrix.name }}" == macos-x64* ]]; then arch_args+=(-DCMAKE_OSX_ARCHITECTURES=x86_64); fi
409-
cmake -S src/tests/packaging -B build-packaging-tests -G Ninja \
354+
cmake -S src/tests/packaging -B build-packaging-standard -G Ninja \
410355
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$bundle" \
411-
-DLIVEKIT_EXPECT_CAPTURE=ON "${arch_args[@]}"
412-
cmake --build build-packaging-tests
413-
ctest --test-dir build-packaging-tests -C Release --output-on-failure -L packaging
356+
-DLIVEKIT_EXPECT_CAPTURE=OFF "${arch_args[@]}"
357+
cmake --build build-packaging-standard
358+
ctest --test-dir build-packaging-standard -C Release --output-on-failure -L packaging
414359
415-
- name: Test installed capture SDK (Windows)
416-
if: matrix.capture == true && runner.os == 'Windows'
360+
- name: Test installed standard SDK (Windows)
361+
if: runner.os == 'Windows'
417362
shell: pwsh
418363
run: |
419364
$bundle = Join-Path $env:GITHUB_WORKSPACE "sdk-out/livekit-sdk-${{ matrix.name }}"
420-
cmake -S src/tests/packaging -B build-packaging-tests -DCMAKE_PREFIX_PATH="$bundle" -DLIVEKIT_EXPECT_CAPTURE=ON
365+
cmake -S src/tests/packaging -B build-packaging-standard -DCMAKE_PREFIX_PATH="$bundle" -DLIVEKIT_EXPECT_CAPTURE=OFF
421366
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
422-
cmake --build build-packaging-tests --config Release
367+
cmake --build build-packaging-standard --config Release
423368
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
424369
$env:PATH = "$bundle\bin;$env:PATH"
425-
ctest --test-dir build-packaging-tests -C Release --output-on-failure -L packaging
370+
ctest --test-dir build-packaging-standard -C Release --output-on-failure -L packaging
426371
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
427372
428373
# ---------- Upload artifacts ----------
@@ -455,6 +400,186 @@ jobs:
455400
${{ matrix.build_dir }}/bin/
456401
retention-days: 7
457402

403+
# Reconfigure the same CMake tree after the standard bundle and aliases
404+
# have been validated and uploaded. Keep both install prefixes separate.
405+
- name: Set up capture dependencies
406+
uses: ./.github/actions/setup-capture
407+
408+
- name: Rebuild with capture (Unix)
409+
if: runner.os != 'Windows'
410+
shell: bash
411+
run: |
412+
chmod +x build.sh
413+
${{ matrix.capture_build_cmd }}
414+
415+
- name: Rebuild with capture (Windows)
416+
if: runner.os == 'Windows'
417+
shell: pwsh
418+
run: ${{ matrix.capture_build_cmd }}
419+
420+
- name: Smoke test capture examples (Unix)
421+
if: runner.os != 'Windows'
422+
shell: bash
423+
run: |
424+
set -x
425+
failed=false
426+
examples_base="${{ matrix.build_dir }}/cpp-example-collection-build"
427+
resolve_exe() {
428+
local dir="$1" name="$2"
429+
local p="${examples_base}/${dir}/${name}"
430+
if [[ -x "${p}" ]]; then
431+
printf '%s' "${p}"
432+
return 0
433+
fi
434+
p="${examples_base}/${dir}/Release/${name}"
435+
if [[ -x "${p}" ]]; then
436+
printf '%s' "${p}"
437+
return 0
438+
fi
439+
return 1
440+
}
441+
for pair in "SimpleRoom:simple_room" "SimpleRpc:simple_rpc" "SimpleDataStream:simple_data_stream"; do
442+
exe="${pair%%:*}"
443+
dir="${pair#*:}"
444+
if ! exe_path="$(resolve_exe "${dir}" "${exe}")"; then
445+
echo "ERROR: ${exe} not found under ${examples_base}/${dir}/"
446+
failed=true
447+
continue
448+
fi
449+
echo "Testing ${exe}..."
450+
output=$("${exe_path}" --help 2>&1) || true
451+
if [[ -z "${output}" ]]; then
452+
echo "ERROR: ${exe} produced no output"
453+
failed=true
454+
else
455+
echo "${output}"
456+
echo "${exe} ran successfully"
457+
fi
458+
done
459+
if [[ "$failed" == "true" ]]; then exit 1; fi
460+
461+
- name: Smoke test capture examples (Windows)
462+
if: runner.os == 'Windows'
463+
shell: pwsh
464+
run: |
465+
$ErrorActionPreference = 'Continue'
466+
$examplesBase = "${{ matrix.build_dir }}/cpp-example-collection-build"
467+
$examples = @(
468+
@{ Name = 'SimpleRoom'; Dir = 'simple_room' },
469+
@{ Name = 'SimpleRpc'; Dir = 'simple_rpc' },
470+
@{ Name = 'SimpleDataStream'; Dir = 'simple_data_stream' }
471+
)
472+
$failed = $false
473+
foreach ($ex in $examples) {
474+
$name = $ex.Name
475+
$dir = $ex.Dir
476+
$inDir = Join-Path $examplesBase $dir
477+
$candidates = @(
478+
(Join-Path $inDir "$name.exe"),
479+
(Join-Path (Join-Path $inDir 'Release') "$name.exe")
480+
)
481+
$exePath = $null
482+
foreach ($p in $candidates) {
483+
if (Test-Path -LiteralPath $p) {
484+
$exePath = $p
485+
break
486+
}
487+
}
488+
if ($null -ne $exePath) {
489+
Write-Host "Testing ${name}..."
490+
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
491+
$pinfo.FileName = $exePath
492+
$pinfo.Arguments = "--help"
493+
$pinfo.RedirectStandardOutput = $true
494+
$pinfo.RedirectStandardError = $true
495+
$pinfo.UseShellExecute = $false
496+
$p = New-Object System.Diagnostics.Process
497+
$p.StartInfo = $pinfo
498+
$p.Start() | Out-Null
499+
$stdout = $p.StandardOutput.ReadToEnd()
500+
$stderr = $p.StandardError.ReadToEnd()
501+
$p.WaitForExit()
502+
$output = $stdout + $stderr
503+
if ([string]::IsNullOrWhiteSpace($output)) {
504+
Write-Host "ERROR: ${name} produced no output"
505+
$failed = $true
506+
} else {
507+
Write-Host $output
508+
Write-Host "${name} ran successfully"
509+
}
510+
} else {
511+
Write-Host "ERROR: ${name} not found under ${examplesBase}/${dir}/"
512+
$failed = $true
513+
}
514+
}
515+
if ($failed) { exit 1 } else { exit 0 }
516+
517+
- name: Verify capture SDK bundle
518+
shell: bash
519+
run: |
520+
set -euo pipefail
521+
bundle="sdk-out/livekit-sdk-${{ matrix.name }}-capture"
522+
grep -F "#define LIVEKIT_CAPTURE_ENABLED 1" "${bundle}/include/livekit/build.h"
523+
test -f "${bundle}/include/livekit/livekit.h"
524+
test -f "${bundle}/share/livekit/build-info.json"
525+
test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfig.cmake"
526+
test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfigVersion.cmake"
527+
test -f "${bundle}/lib/cmake/LiveKit/LiveKitTargets.cmake"
528+
529+
- name: Test installed capture SDK (Unix)
530+
if: runner.os != 'Windows'
531+
shell: bash
532+
run: |
533+
bundle="$GITHUB_WORKSPACE/sdk-out/livekit-sdk-${{ matrix.name }}-capture"
534+
arch_args=()
535+
if [[ "${{ matrix.name }}" == macos-x64 ]]; then arch_args+=(-DCMAKE_OSX_ARCHITECTURES=x86_64); fi
536+
cmake -S src/tests/packaging -B build-packaging-capture -G Ninja \
537+
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$bundle" \
538+
-DLIVEKIT_EXPECT_CAPTURE=ON "${arch_args[@]}"
539+
cmake --build build-packaging-capture
540+
ctest --test-dir build-packaging-capture -C Release --output-on-failure -L packaging
541+
542+
- name: Test installed capture SDK (Windows)
543+
if: runner.os == 'Windows'
544+
shell: pwsh
545+
run: |
546+
$bundle = Join-Path $env:GITHUB_WORKSPACE "sdk-out/livekit-sdk-${{ matrix.name }}-capture"
547+
cmake -S src/tests/packaging -B build-packaging-capture -DCMAKE_PREFIX_PATH="$bundle" -DLIVEKIT_EXPECT_CAPTURE=ON
548+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
549+
cmake --build build-packaging-capture --config Release
550+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
551+
$env:PATH = "$bundle\bin;$env:PATH"
552+
ctest --test-dir build-packaging-capture -C Release --output-on-failure -L packaging
553+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
554+
555+
- name: Upload capture SDK bundle
556+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
557+
with:
558+
name: livekit-sdk-${{ matrix.name }}-capture
559+
path: sdk-out/livekit-sdk-${{ matrix.name }}-capture
560+
retention-days: 7
561+
562+
# Save the populated target/ now, while the build output still exists and
563+
# before the "Clean after build" step runs clean-all. Save only from main
564+
# pushes so PRs restore from the shared main cache instead of creating
565+
# large PR-scoped target caches that quickly evict useful entries.
566+
- name: Save cargo target
567+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache-cargo-target.outputs.cache-hit != 'true'
568+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
569+
with:
570+
path: |
571+
client-sdk-rust/target/
572+
${{ env.CARGO_TARGET_DIR }}
573+
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-v3-${{ steps.rust_sha.outputs.sha }}
574+
575+
- name: Save vcpkg binary cache
576+
if: runner.os == 'Windows' && steps.cache-vcpkg-binary.outputs.cache-hit != 'true'
577+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
578+
with:
579+
path: ${{ env.VCPKG_BINARY_CACHE_DIR }}
580+
key: ${{ runner.os }}-${{ matrix.name }}-vcpkg-binary-${{ env.VCPKG_TARGET_TRIPLET }}-${{ env.VCPKG_GIT_COMMIT }}-${{ hashFiles('vcpkg.json') }}
581+
582+
458583
# ---------- Cleanup ----------
459584
- name: Clean after build (best-effort)
460585
if: always()

0 commit comments

Comments
 (0)