Skip to content

Commit 76c421b

Browse files
try windows cacheing
1 parent 4461e5e commit 76c421b

4 files changed

Lines changed: 79 additions & 2 deletions

File tree

.github/workflows/builds.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ env:
2020
CARGO_INCREMENTAL: "0"
2121
# Pinned commit for cpp-example-collection smoke build (https://github.com/livekit-examples/cpp-example-collection)
2222
CPP_EXAMPLE_COLLECTION_REF: bbf0fdf72dac2239117213475449565686f8c58b
23-
# vcpkg binary caching for Windows
23+
# vcpkg binary caching for Windows. x-gha stores compiled vcpkg packages
24+
# (protobuf, abseil, spdlog, ...) in the GitHub Actions cache, so the
25+
# Windows manifest-mode dep build is skipped on a warm cache. `clear`
26+
# drops the default (source-only) provider first. Requires the
27+
# ACTIONS_CACHE_URL / ACTIONS_RUNTIME_TOKEN export step below.
28+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
2429
VCPKG_DEFAULT_TRIPLET: x64-windows-static-md
2530
VCPKG_DEFAULT_HOST_TRIPLET: x64-windows-static-md
2631
VCPKG_TARGET_TRIPLET: x64-windows-static-md

.github/workflows/tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ env:
1818
# incremental dirs add nothing but bloat the cached target/ directory and
1919
# slow the cache upload/download.
2020
CARGO_INCREMENTAL: "0"
21-
# vcpkg binary caching for Windows (mirrors builds.yml)
21+
# vcpkg binary caching for Windows (mirrors builds.yml). x-gha stores
22+
# compiled vcpkg packages in the GitHub Actions cache so the Windows
23+
# manifest-mode dep build is skipped on a warm cache. Requires the
24+
# ACTIONS_CACHE_URL / ACTIONS_RUNTIME_TOKEN export step below.
25+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
2226
VCPKG_DEFAULT_TRIPLET: x64-windows-static-md
2327
VCPKG_DEFAULT_HOST_TRIPLET: x64-windows-static-md
2428
VCPKG_TARGET_TRIPLET: x64-windows-static-md

build.cmd

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ echo build.cmd clean-all
202202
goto :eof
203203

204204
:configure_build
205+
call :now _T_CONFIG_START
205206
echo ==^> Configuring CMake (%BUILD_TYPE%)...
206207
if not defined VCPKG_ROOT (
207208
echo Warning: VCPKG_ROOT is not set. Attempting to configure without vcpkg...
@@ -213,6 +214,7 @@ if errorlevel 1 (
213214
echo Configuration failed!
214215
exit /b 1
215216
)
217+
call :elapsed "configure (%PRESET%)" %_T_CONFIG_START%
216218
goto build_only
217219

218220
:build_only
@@ -225,15 +227,45 @@ if not defined BUILD_PARALLEL_JOBS (
225227
set "BUILD_PARALLEL_JOBS=2"
226228
)
227229
)
230+
call :now _T_BUILD_START
228231
echo ==^> Building (%BUILD_TYPE%) with %BUILD_PARALLEL_JOBS% parallel jobs...
232+
233+
rem Optional Rust-FFI-first split: build the build_rust_ffi target on its own
234+
rem first so CI logs report the Rust dep/FFI compile time separately from the
235+
rem C++ compile time. Off by default (single build invocation).
236+
if "%LK_BUILD_TIMING%"=="1" (
237+
call :now _T_FFI_START
238+
echo ==^> [timing] Building Rust FFI target ^(build_rust_ffi^) first...
239+
cmake --build "%BUILD_DIR%" --config %BUILD_TYPE% --parallel "%BUILD_PARALLEL_JOBS%" --target build_rust_ffi
240+
if errorlevel 1 (
241+
echo Build failed!
242+
exit /b 1
243+
)
244+
call :elapsed "build: Rust FFI (build_rust_ffi)" %_T_FFI_START%
245+
)
246+
229247
cmake --build "%BUILD_DIR%" --config %BUILD_TYPE% --parallel "%BUILD_PARALLEL_JOBS%"
230248
if errorlevel 1 (
231249
echo Build failed!
232250
exit /b 1
233251
)
252+
call :elapsed "build total (%PRESET%)" %_T_BUILD_START%
234253
echo ==^> Build complete!
235254
goto :eof
236255

256+
rem ---- timing helpers ----
257+
rem :now <varname> -> sets <varname> to current Unix epoch seconds.
258+
:now
259+
for /f %%s in ('powershell -NoProfile -Command "[int][double]::Parse((Get-Date -UFormat %%s))"') do set "%~1=%%s"
260+
goto :eof
261+
262+
rem :elapsed "<label>" <start-epoch> -> prints "==> [timing] <label>: <N>s".
263+
:elapsed
264+
call :now _T_ELAPSED_END
265+
set /a _T_ELAPSED_DIFF=%_T_ELAPSED_END% - %~2
266+
echo ==^> [timing] %~1: %_T_ELAPSED_DIFF%s
267+
goto :eof
268+
237269
:clean
238270
echo ==^> Cleaning build directories...
239271
set "BUILD_DIR_DEBUG=%PROJECT_ROOT%\build-debug"

build.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,19 @@ parse_opts() {
133133
done
134134
}
135135

136+
# Print "<label>: <N>s" using a start timestamp captured with `date +%s`.
137+
# Used for the build-phase timing breakdown surfaced in CI logs. Set
138+
# LK_BUILD_TIMING=1 to also split the Rust FFI build out from the C++ build.
139+
_lk_now() { date +%s; }
140+
_lk_report() {
141+
local label="$1" start="$2" end
142+
end="$(_lk_now)"
143+
echo "==> [timing] ${label}: $((end - start))s"
144+
}
145+
136146
configure() {
147+
local _t_start
148+
_t_start="$(_lk_now)"
137149
echo "==> Configuring CMake (${BUILD_TYPE}) using preset ${PRESET}..."
138150
local -a extra_args=()
139151
if [[ -n "${LIVEKIT_VERSION}" ]]; then
@@ -173,6 +185,7 @@ configure() {
173185
ln -sf "${BUILD_DIR}/compile_commands.json" "${PROJECT_ROOT}/compile_commands.json"
174186
echo "==> Symlinked compile_commands.json -> ${BUILD_DIR}/compile_commands.json"
175187
fi
188+
_lk_report "configure (${PRESET})" "${_t_start}"
176189
}
177190

178191
detect_parallel_jobs() {
@@ -201,14 +214,37 @@ build() {
201214
local parallel_jobs
202215
parallel_jobs="$(detect_parallel_jobs)"
203216

217+
local _t_start _t_ffi
218+
_t_start="$(_lk_now)"
219+
204220
echo "==> Building (${BUILD_TYPE}) with ${parallel_jobs} parallel jobs..."
221+
local have_preset=0
205222
if [[ -n "${PRESET}" ]] && [[ -f "${PROJECT_ROOT}/CMakePresets.json" ]]; then
223+
have_preset=1
224+
fi
225+
226+
# Optional Rust-FFI-first split: build the build_rust_ffi target on its own
227+
# first so CI logs report the Rust dep/FFI compile time separately from the
228+
# C++ compile time. Off by default (single build invocation).
229+
if [[ "${LK_BUILD_TIMING:-0}" == "1" ]]; then
230+
_t_ffi="$(_lk_now)"
231+
echo "==> [timing] Building Rust FFI target (build_rust_ffi) first..."
232+
if [[ "${have_preset}" -eq 1 ]]; then
233+
cmake --build --preset "${PRESET}" --parallel "${parallel_jobs}" --target build_rust_ffi
234+
else
235+
cmake --build "${BUILD_DIR}" --parallel "${parallel_jobs}" --target build_rust_ffi
236+
fi
237+
_lk_report "build: Rust FFI (build_rust_ffi)" "${_t_ffi}"
238+
fi
239+
240+
if [[ "${have_preset}" -eq 1 ]]; then
206241
# Use preset build if available
207242
cmake --build --preset "${PRESET}" --parallel "${parallel_jobs}"
208243
else
209244
# Fallback to traditional build
210245
cmake --build "${BUILD_DIR}" --parallel "${parallel_jobs}"
211246
fi
247+
_lk_report "build total (${PRESET})" "${_t_start}"
212248
}
213249

214250
install_bundle() {

0 commit comments

Comments
 (0)