Skip to content

Commit 854a167

Browse files
committed
feat: improve build system and add release workflow
Build System Improvements: - Separate build directories (build-debug/ vs build-release/) - Fix LIVEKIT_VERSION default to 0.0.0 - Fix Ninja clean to avoid CMake reconfiguration - Remove -j flag issue in build.cmd CI/CD Workflows: - Add Windows support with vcpkg in builds.yml - Use build.sh/build.cmd scripts instead of raw cmake commands - Add SDK bundle creation and artifact upload - Add make-release.yml for automated GitHub releases - Support tag-triggered releases (v* tags) - Build for Linux x64, macOS arm64/x64, Windows x64 Documentation: - Update README_BUILD.md with new build directory structure - Add build-debug/ and build-release/ to .gitignore
1 parent e62dbbb commit 854a167

File tree

8 files changed

+323
-176
lines changed

8 files changed

+323
-176
lines changed

.github/workflows/builds.yml

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131

3232
env:
3333
CARGO_TERM_COLOR: always
34-
# vcpkg binary caching only needed for Windows
34+
# vcpkg binary caching for Windows
3535
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
3636

3737
jobs:
@@ -41,12 +41,19 @@ jobs:
4141
matrix:
4242
include:
4343
- os: ubuntu-latest
44-
preset: linux-release-examples
44+
name: linux-x64
45+
build_cmd: ./build.sh release-examples
46+
build_dir: build-release
4547
- os: macos-latest
46-
preset: macos-release-examples
48+
name: macos-arm64
49+
build_cmd: ./build.sh release-examples
50+
build_dir: build-release
4751
- os: windows-latest
48-
preset: windows-release-examples
49-
name: ${{ matrix.os }}
52+
name: windows-x64
53+
build_cmd: .\build.cmd release-examples
54+
build_dir: build-release
55+
56+
name: Build (${{ matrix.name }})
5057
runs-on: ${{ matrix.os }}
5158

5259
steps:
@@ -56,6 +63,7 @@ jobs:
5663
submodules: recursive
5764
fetch-depth: 0
5865

66+
# ---------- vcpkg caching for Windows ----------
5967
- name: Export GitHub Actions cache environment variables
6068
if: runner.os == 'Windows'
6169
uses: actions/github-script@v7
@@ -70,7 +78,8 @@ jobs:
7078
with:
7179
vcpkgGitCommitId: 'c82f74667287d3dc386bce81e44964370c91a289'
7280

73-
- name: Install system deps (Ubuntu)
81+
# ---------- OS-specific deps ----------
82+
- name: Install deps (Ubuntu)
7483
if: runner.os == 'Linux'
7584
run: |
7685
set -eux
@@ -85,18 +94,20 @@ jobs:
8594
libssl-dev \
8695
libprotobuf-dev protobuf-compiler \
8796
libabsl-dev \
88-
libwayland-dev libdecor-0-dev # For SDL3
97+
libwayland-dev libdecor-0-dev
8998
90-
- name: Install system deps (macOS)
99+
- name: Install deps (macOS)
91100
if: runner.os == 'macOS'
92101
run: |
93102
set -eux
94103
brew update
95104
brew install cmake ninja protobuf abseil
96105
106+
# ---------- Rust toolchain ----------
97107
- name: Install Rust (stable)
98108
uses: dtolnay/rust-toolchain@stable
99109

110+
# ---------- Cache Cargo ----------
100111
- name: Cache Cargo registry
101112
uses: actions/cache@v4
102113
with:
@@ -114,35 +125,42 @@ jobs:
114125
restore-keys: |
115126
${{ runner.os }}-cargo-target-
116127
128+
# ---------- Build environment setup ----------
117129
- name: Set Linux build environment
118130
if: runner.os == 'Linux'
119131
run: |
120132
echo "CXXFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV
121133
echo "CFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV
122-
# Find libclang path
123134
LLVM_VERSION=$(llvm-config --version | cut -d. -f1)
124135
echo "LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib" >> $GITHUB_ENV
125136
126-
- name: Configure CMake
127-
run: cmake --preset ${{ matrix.preset }}
137+
# ---------- Build ----------
138+
- name: Build (Unix)
139+
if: runner.os != 'Windows'
140+
shell: bash
141+
run: |
142+
chmod +x build.sh
143+
${{ matrix.build_cmd }}
128144
129-
- name: Build
130-
run: cmake --build --preset ${{ matrix.preset }}
145+
- name: Build (Windows)
146+
if: runner.os == 'Windows'
147+
shell: pwsh
148+
run: ${{ matrix.build_cmd }}
131149

150+
# ---------- Smoke test examples ----------
132151
- name: Smoke test examples (Unix)
133152
if: runner.os != 'Windows'
134153
shell: bash
135154
run: |
136155
set -x
137156
failed=false
138157
for exe in SimpleRoom SimpleRpc SimpleDataStream; do
139-
exe_path="build/bin/${exe}"
158+
exe_path="${{ matrix.build_dir }}/bin/${exe}"
140159
if [[ -x "${exe_path}" ]]; then
141160
echo "Testing ${exe}..."
142-
# Capture output to verify program actually runs
143161
output=$("${exe_path}" --help 2>&1) || true
144162
if [[ -z "${output}" ]]; then
145-
echo "ERROR: ${exe} produced no output - may have failed to start"
163+
echo "ERROR: ${exe} produced no output"
146164
failed=true
147165
else
148166
echo "${output}"
@@ -163,11 +181,9 @@ jobs:
163181
$examples = @('SimpleRoom', 'SimpleRpc', 'SimpleDataStream')
164182
$failed = $false
165183
foreach ($exe in $examples) {
166-
$exePath = "build/bin/Release/${exe}.exe"
184+
$exePath = "${{ matrix.build_dir }}/bin/Release/${exe}.exe"
167185
if (Test-Path $exePath) {
168186
Write-Host "Testing ${exe}..."
169-
# Capture output to verify program actually runs
170-
# Use Start-Process to avoid PowerShell error handling issues
171187
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
172188
$pinfo.FileName = $exePath
173189
$pinfo.Arguments = "--help"
@@ -182,7 +198,7 @@ jobs:
182198
$p.WaitForExit()
183199
$output = $stdout + $stderr
184200
if ([string]::IsNullOrWhiteSpace($output)) {
185-
Write-Host "ERROR: ${exe} produced no output - may have failed to start"
201+
Write-Host "ERROR: ${exe} produced no output"
186202
$failed = $true
187203
} else {
188204
Write-Host $output
@@ -195,22 +211,24 @@ jobs:
195211
}
196212
if ($failed) { exit 1 } else { exit 0 }
197213
214+
# ---------- Upload artifacts ----------
198215
- name: Upload build artifacts
199216
uses: actions/upload-artifact@v4
200217
with:
201-
name: livekit-sdk-${{ matrix.os }}
218+
name: livekit-sdk-${{ matrix.name }}
202219
path: |
203-
build/lib/
204-
build/include/
205-
build/bin/
220+
${{ matrix.build_dir }}/lib/
221+
${{ matrix.build_dir }}/include/
222+
${{ matrix.build_dir }}/bin/
206223
retention-days: 7
207224

225+
# ---------- Cleanup ----------
208226
- name: Clean after build (best-effort)
209227
if: always()
210228
shell: bash
211229
run: |
212230
if [[ "$RUNNER_OS" == "Windows" ]]; then
213-
rm -rf build || true
231+
rm -rf build-release build-debug || true
214232
else
215-
[[ -x build.sh ]] && ./build.sh clean || true
233+
./build.sh clean-all || true
216234
fi

0 commit comments

Comments
 (0)