Repository navigation
259 lines (229 loc) · 10.9 KB
/
Copy pathbuilds.yml
File metadata and controls
259 lines (229 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: Builds
# Called by top-level ci.yml
on:
workflow_call: {}
workflow_dispatch: {}
permissions:
contents: read
actions: read
packages: read
env:
CARGO_TERM_COLOR: always
# Cache both feature-specific Rust builds per submodule SHA. Cargo
# incremental codegen directories add cache size without helping CMake reuse.
CARGO_INCREMENTAL: "0"
# vcpkg binary caching for Windows. The x-gha backend was removed from vcpkg,
# so use vcpkg's files provider and persist that directory with actions/cache.
VCPKG_GIT_COMMIT: fb87e2bb3fe69e16c224989acb5a61349166c782
VCPKG_BINARY_CACHE_DIR: ${{ github.workspace }}/.vcpkg-binary-cache
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/.vcpkg-binary-cache,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-22.04
name: ubuntu-22.04-x64
- os: ubuntu-22.04-arm
name: ubuntu-22.04-arm64
- os: ubuntu-24.04
name: ubuntu-24.04-x64
- os: ubuntu-24.04-arm
name: ubuntu-24.04-arm64
- os: macos-26-xlarge
name: macos-arm64
- os: macos-26-large
name: macos-x64
macos_arch: x86_64
# Pinned to Windows 2022 for current VS 17 implementation
- os: windows-2022
name: windows-x64
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.os }}
env:
BUILD_DIR: build-release
steps:
- name: Checkout (with submodules)
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
fetch-depth: 1
- name: Set Cargo output root
uses: ./.github/actions/cargo-target-root
- name: Pull LFS files
run: git lfs pull
# Cargo's freshness check is mtime-based. A fresh `actions/checkout`
# stamps every submodule source file with the checkout time, which is
# newer than the cached target/ artifacts — so cargo rebuilds the whole
# client-sdk-rust workspace (~6 min) even on an exact cargo-target cache
# hit. Pin all submodule source files to a fixed, deterministic
# timestamp (older than any cached artifact) so cargo treats them as
# unchanged across runs and reuses the cached FFI build. Runs before the
# cargo target cache is restored, so target/ does not yet exist and is
# never touched. shell: bash so this also runs under Git Bash on Windows.
- name: Stabilize Rust source mtimes for cargo freshness
shell: bash
run: |
find client-sdk-rust -type f -not -path '*/.git/*' -exec touch -t 202001010000 {} +
# ---------- vcpkg for Windows ----------
- name: Restore vcpkg binary cache
if: runner.os == 'Windows'
id: cache-vcpkg-binary
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.VCPKG_BINARY_CACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.name }}-vcpkg-binary-${{ env.VCPKG_TARGET_TRIPLET }}-${{ env.VCPKG_GIT_COMMIT }}-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.name }}-vcpkg-binary-${{ env.VCPKG_TARGET_TRIPLET }}-${{ env.VCPKG_GIT_COMMIT }}-
- name: Set up base SDK dependencies
uses: ./.github/actions/setup-sdk-deps
with:
vcpkg-commit: ${{ env.VCPKG_GIT_COMMIT }}
# ---------- Rust toolchain ----------
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
with:
toolchain: stable
- name: Install Rust cross-compilation target
if: matrix.name == 'macos-x64'
run: rustup target add x86_64-apple-darwin
# ---------- Cache Cargo ----------
# The Rust FFI is built from the pinned client-sdk-rust submodule. Its
# compiled output only changes when the submodule commit changes, so we
# key the target cache on the submodule SHA (not Cargo.lock, which is
# pinned inside the submodule and effectively immutable -- that froze the
# old cache permanently). Resolve it once here for the restore/save steps.
- name: Resolve Rust submodule SHA
id: rust_sha
shell: bash
run: echo "sha=$(git -C client-sdk-rust rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Cache cargo registry
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
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-
# macOS FFI libraries retain GStreamer link paths. Include capture setup
# in the key so changes to the framework installation invalidate them.
# Restore-only here; the matching save runs after a successful build (see
# "Save cargo target" below). A combined actions/cache saves in a post-job
# step that runs AFTER the "Clean after build" cleanup wipes target/debug
# and target/release, which is why the old cache was always ~empty. The
# restore/save split lets us snapshot the populated target/ before cleanup.
- name: Restore cargo target
id: cache-cargo-target
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
client-sdk-rust/target/
${{ env.CARGO_TARGET_DIR }}
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-release-standard-${{ hashFiles('CMakeLists.txt', 'build.sh', 'build.cmd', '.github/actions/setup-capture/action.yml', '.github/actions/test-capture-variants/action.yml') }}-${{ steps.rust_sha.outputs.sha }}
# Restore exact keys only: webrtc-sys cxxbridge artifacts are not
# compatible across Rust submodule bumps. Avoid downloading a fallback
# cache that this cleanup would immediately discard.
- name: Drop stale cargo target on submodule SHA cache miss
if: steps.cache-cargo-target.outputs.cache-hit != 'true'
shell: bash
run: rm -rf client-sdk-rust/target/ "$CARGO_TARGET_DIR"
# ---------- 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"
# ---------- Build ----------
- name: Build standard SDK
uses: ./.github/actions/build-sdk
with:
preset: release-examples
capture: 'none'
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}
macos-arch: ${{ matrix.macos_arch || '' }}
# ---------- Smoke test cpp-example-collection binaries ----------
# Built under cpp-example-collection-build/ (not build-dir/bin). Visual Studio
# multi-config places executables in per-target Release/ (or Debug/) subdirs.
- name: Smoke test examples
uses: ./.github/actions/smoke-examples
with:
build-dir: ${{ env.BUILD_DIR }}
- name: Test installed standard SDK
uses: ./.github/actions/test-sdk-bundle
with:
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}
capture: 'none'
macos-arch: ${{ matrix.macos_arch || '' }}
# ---------- Upload artifacts ----------
- name: Upload SDK bundle
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: livekit-sdk-${{ matrix.name }}
path: sdk-out/livekit-sdk-${{ matrix.name }}
retention-days: 7
# Reconfigure the same CMake tree after the standard bundle and aliases
# have been validated and uploaded. Keep both install prefixes separate.
- name: Set up capture dependencies
if: matrix.name != 'macos-x64'
uses: ./.github/actions/setup-capture
- name: Build capture SDK
if: matrix.name != 'macos-x64'
uses: ./.github/actions/build-sdk
with:
preset: release-examples
capture: 'all'
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}-capture
macos-arch: ${{ matrix.macos_arch || '' }}
- name: Smoke test capture examples
if: matrix.name != 'macos-x64'
uses: ./.github/actions/smoke-examples
with:
build-dir: ${{ env.BUILD_DIR }}
- name: Test installed capture SDK
if: matrix.name != 'macos-x64'
uses: ./.github/actions/test-sdk-bundle
with:
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}-capture
capture: 'all'
macos-arch: ${{ matrix.macos_arch || '' }}
- name: Upload capture SDK bundle
if: matrix.name != 'macos-x64'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: livekit-sdk-${{ matrix.name }}-capture
path: sdk-out/livekit-sdk-${{ matrix.name }}-capture
retention-days: 7
# Save the populated target/ now, while the build output still exists and
# before the "Clean after build" step runs clean-all. Save only from main
# pushes so PRs restore from the shared main cache instead of creating
# large PR-scoped target caches that quickly evict useful entries.
- name: Save cargo target
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache-cargo-target.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
client-sdk-rust/target/
${{ env.CARGO_TARGET_DIR }}
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-release-standard-${{ hashFiles('CMakeLists.txt', 'build.sh', 'build.cmd', '.github/actions/setup-capture/action.yml', '.github/actions/test-capture-variants/action.yml') }}-${{ steps.rust_sha.outputs.sha }}
- name: Save vcpkg binary cache
if: runner.os == 'Windows' && steps.cache-vcpkg-binary.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.VCPKG_BINARY_CACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.name }}-vcpkg-binary-${{ env.VCPKG_TARGET_TRIPLET }}-${{ env.VCPKG_GIT_COMMIT }}-${{ hashFiles('vcpkg.json') }}
# ---------- Cleanup ----------
- name: Clean after build (best-effort)
if: always()
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
rm -rf build-release build-debug || true
else
./build.sh clean-all || true
fi