Skip to content

Commit 3231a4a

Browse files
remove duplicate code
1 parent 0a5d08e commit 3231a4a

21 files changed

Lines changed: 663 additions & 829 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Build SDK
16+
description: Configure and build an SDK variant with the repository build scripts.
17+
inputs:
18+
preset:
19+
description: Build script command, such as release-examples or debug-tests.
20+
required: true
21+
capture:
22+
description: Whether to enable capture (ON or OFF).
23+
default: 'OFF'
24+
bundle-dir:
25+
description: Optional installation directory for an SDK bundle.
26+
default: ''
27+
version:
28+
description: Optional SDK version to inject.
29+
default: ''
30+
macos-arch:
31+
description: Optional macOS architecture override.
32+
default: ''
33+
runs:
34+
using: composite
35+
steps:
36+
- name: Build (Unix)
37+
if: runner.os != 'Windows'
38+
shell: bash
39+
env:
40+
SDK_PRESET: ${{ inputs.preset }}
41+
SDK_CAPTURE: ${{ inputs.capture }}
42+
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
43+
SDK_VERSION: ${{ inputs.version }}
44+
SDK_MACOS_ARCH: ${{ inputs.macos-arch }}
45+
run: |
46+
args=(./build.sh "$SDK_PRESET")
47+
case "$SDK_CAPTURE" in
48+
ON) args+=(--capture) ;;
49+
OFF) args+=(--no-capture) ;;
50+
*) echo "Invalid capture setting: $SDK_CAPTURE" >&2; exit 1 ;;
51+
esac
52+
if [[ -n "$SDK_BUNDLE_DIR" ]]; then args+=(--bundle --prefix "$SDK_BUNDLE_DIR"); fi
53+
if [[ -n "$SDK_VERSION" ]]; then args+=(--version "$SDK_VERSION"); fi
54+
if [[ -n "$SDK_MACOS_ARCH" ]]; then args+=(--macos-arch "$SDK_MACOS_ARCH"); fi
55+
"${args[@]}"
56+
- name: Build (Windows)
57+
if: runner.os == 'Windows'
58+
shell: pwsh
59+
env:
60+
SDK_PRESET: ${{ inputs.preset }}
61+
SDK_CAPTURE: ${{ inputs.capture }}
62+
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
63+
SDK_VERSION: ${{ inputs.version }}
64+
run: |
65+
$buildArgs = @($env:SDK_PRESET)
66+
switch ($env:SDK_CAPTURE) {
67+
'ON' { $buildArgs += '--capture' }
68+
'OFF' { $buildArgs += '--no-capture' }
69+
default { throw "Invalid capture setting: $env:SDK_CAPTURE" }
70+
}
71+
if ($env:SDK_BUNDLE_DIR) { $buildArgs += @('--bundle', '--prefix', $env:SDK_BUNDLE_DIR) }
72+
if ($env:SDK_VERSION) { $buildArgs += @('--version', $env:SDK_VERSION) }
73+
& .\build.cmd @buildArgs
74+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Set Cargo output root
16+
description: Use a short Cargo root on Windows and the submodule target directory elsewhere.
17+
runs:
18+
using: composite
19+
steps:
20+
- shell: bash
21+
run: |
22+
if [[ "$RUNNER_OS" == "Windows" ]]; then
23+
echo "CARGO_TARGET_DIR=$(cygpath -m "$RUNNER_TEMP")/lk-rust" >> "$GITHUB_ENV"
24+
else
25+
echo "CARGO_TARGET_DIR=$GITHUB_WORKSPACE/client-sdk-rust/target" >> "$GITHUB_ENV"
26+
fi
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Check SDK exported ABI
16+
description: Reject private dependency symbols exported by an installed SDK.
17+
inputs:
18+
bundle-dir:
19+
description: SDK installation directory relative to the workspace.
20+
required: true
21+
runs:
22+
using: composite
23+
steps:
24+
- shell: bash
25+
env:
26+
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
27+
run: |
28+
case "$RUNNER_OS" in
29+
Windows) lib="$SDK_BUNDLE_DIR/bin/livekit.dll" ;;
30+
macOS) lib="$SDK_BUNDLE_DIR/lib/liblivekit.dylib" ;;
31+
Linux) lib="$SDK_BUNDLE_DIR/lib/liblivekit.so" ;;
32+
*) echo "Unsupported runner OS: $RUNNER_OS" >&2; exit 1 ;;
33+
esac
34+
python .github/scripts/check_no_private_symbols.py "$lib"
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Smoke test example binaries
16+
description: Run the example collection help commands through the built SDK.
17+
inputs:
18+
build-dir:
19+
description: SDK CMake build directory.
20+
required: true
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Smoke test examples (Unix)
25+
if: runner.os != 'Windows'
26+
shell: bash
27+
run: |
28+
set -x
29+
failed=false
30+
examples_base="${{ inputs.build-dir }}/cpp-example-collection-build"
31+
resolve_exe() {
32+
local dir="$1" name="$2"
33+
local p="${examples_base}/${dir}/${name}"
34+
if [[ -x "${p}" ]]; then
35+
printf '%s' "${p}"
36+
return 0
37+
fi
38+
p="${examples_base}/${dir}/Release/${name}"
39+
if [[ -x "${p}" ]]; then
40+
printf '%s' "${p}"
41+
return 0
42+
fi
43+
return 1
44+
}
45+
for pair in "SimpleRoom:simple_room" "SimpleRpc:simple_rpc" "SimpleDataStream:simple_data_stream"; do
46+
exe="${pair%%:*}"
47+
dir="${pair#*:}"
48+
if ! exe_path="$(resolve_exe "${dir}" "${exe}")"; then
49+
echo "ERROR: ${exe} not found under ${examples_base}/${dir}/"
50+
failed=true
51+
continue
52+
fi
53+
echo "Testing ${exe}..."
54+
output=$("${exe_path}" --help 2>&1) || true
55+
if [[ -z "${output}" ]]; then
56+
echo "ERROR: ${exe} produced no output"
57+
failed=true
58+
else
59+
echo "${output}"
60+
echo "${exe} ran successfully"
61+
fi
62+
done
63+
if [[ "$failed" == "true" ]]; then exit 1; fi
64+
65+
- name: Smoke test examples (Windows)
66+
if: runner.os == 'Windows'
67+
shell: pwsh
68+
run: |
69+
$ErrorActionPreference = 'Continue'
70+
$examplesBase = "${{ inputs.build-dir }}/cpp-example-collection-build"
71+
$examples = @(
72+
@{ Name = 'SimpleRoom'; Dir = 'simple_room' },
73+
@{ Name = 'SimpleRpc'; Dir = 'simple_rpc' },
74+
@{ Name = 'SimpleDataStream'; Dir = 'simple_data_stream' }
75+
)
76+
$failed = $false
77+
foreach ($ex in $examples) {
78+
$name = $ex.Name
79+
$dir = $ex.Dir
80+
$inDir = Join-Path $examplesBase $dir
81+
$candidates = @(
82+
(Join-Path $inDir "$name.exe"),
83+
(Join-Path (Join-Path $inDir 'Release') "$name.exe")
84+
)
85+
$exePath = $null
86+
foreach ($p in $candidates) {
87+
if (Test-Path -LiteralPath $p) {
88+
$exePath = $p
89+
break
90+
}
91+
}
92+
if ($null -ne $exePath) {
93+
Write-Host "Testing ${name}..."
94+
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
95+
$pinfo.FileName = $exePath
96+
$pinfo.Arguments = "--help"
97+
$pinfo.RedirectStandardOutput = $true
98+
$pinfo.RedirectStandardError = $true
99+
$pinfo.UseShellExecute = $false
100+
$p = New-Object System.Diagnostics.Process
101+
$p.StartInfo = $pinfo
102+
$p.Start() | Out-Null
103+
$stdout = $p.StandardOutput.ReadToEnd()
104+
$stderr = $p.StandardError.ReadToEnd()
105+
$p.WaitForExit()
106+
$output = $stdout + $stderr
107+
if ([string]::IsNullOrWhiteSpace($output)) {
108+
Write-Host "ERROR: ${name} produced no output"
109+
$failed = $true
110+
} else {
111+
Write-Host $output
112+
Write-Host "${name} ran successfully"
113+
}
114+
} else {
115+
Write-Host "ERROR: ${name} not found under ${examplesBase}/${dir}/"
116+
$failed = $true
117+
}
118+
}
119+
if ($failed) { exit 1 } else { exit 0 }
120+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Test installed SDK bundle
16+
description: Validate an SDK bundle through the standalone CTest consumer.
17+
inputs:
18+
bundle-dir:
19+
description: SDK installation directory relative to the workspace.
20+
required: true
21+
capture:
22+
description: Expected capture support (ON or OFF).
23+
required: true
24+
build-type:
25+
description: Consumer configuration (Debug or Release).
26+
default: Release
27+
version:
28+
description: Optional expected SDK version for release metadata checks.
29+
default: ''
30+
macos-arch:
31+
description: Optional macOS architecture override.
32+
default: ''
33+
runs:
34+
using: composite
35+
steps:
36+
- name: Test bundle (Unix)
37+
if: runner.os != 'Windows'
38+
shell: bash
39+
env:
40+
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
41+
SDK_CAPTURE: ${{ inputs.capture }}
42+
SDK_BUILD_TYPE: ${{ inputs.build-type }}
43+
SDK_VERSION: ${{ inputs.version }}
44+
SDK_MACOS_ARCH: ${{ inputs.macos-arch }}
45+
run: |
46+
bundle="$GITHUB_WORKSPACE/$SDK_BUNDLE_DIR"
47+
build_dir="build-packaging-$SDK_CAPTURE"
48+
arch_args=()
49+
if [[ -n "$SDK_MACOS_ARCH" ]]; then arch_args+=(-DCMAKE_OSX_ARCHITECTURES="$SDK_MACOS_ARCH"); fi
50+
cmake -S src/tests/packaging -B "$build_dir" -G Ninja \
51+
-DCMAKE_BUILD_TYPE="$SDK_BUILD_TYPE" -DCMAKE_PREFIX_PATH="$bundle" \
52+
-DLIVEKIT_EXPECT_CAPTURE="$SDK_CAPTURE" -DLIVEKIT_EXPECT_VERSION="$SDK_VERSION" "${arch_args[@]}"
53+
cmake --build "$build_dir" --config "$SDK_BUILD_TYPE"
54+
ctest --test-dir "$build_dir" -C "$SDK_BUILD_TYPE" --output-on-failure -L packaging
55+
- name: Test bundle (Windows)
56+
if: runner.os == 'Windows'
57+
shell: pwsh
58+
env:
59+
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
60+
SDK_CAPTURE: ${{ inputs.capture }}
61+
SDK_BUILD_TYPE: ${{ inputs.build-type }}
62+
SDK_VERSION: ${{ inputs.version }}
63+
run: |
64+
$bundle = Join-Path $env:GITHUB_WORKSPACE $env:SDK_BUNDLE_DIR
65+
$buildDir = "build-packaging-$env:SDK_CAPTURE"
66+
cmake -S src/tests/packaging -B "$buildDir" -DCMAKE_PREFIX_PATH="$bundle" -DLIVEKIT_EXPECT_CAPTURE="$env:SDK_CAPTURE" -DLIVEKIT_EXPECT_VERSION="$env:SDK_VERSION"
67+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
68+
cmake --build "$buildDir" --config "$env:SDK_BUILD_TYPE"
69+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
70+
$env:PATH = "$bundle\bin;$env:PATH"
71+
ctest --test-dir "$buildDir" -C "$env:SDK_BUILD_TYPE" --output-on-failure -L packaging
72+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

0 commit comments

Comments
 (0)