Skip to content

Commit cc7bae7

Browse files
See if we improved anything
1 parent 52d8bff commit cc7bae7

4 files changed

Lines changed: 86 additions & 13 deletions

File tree

.github/workflows/builds.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ env:
1818
# transient cache backend failures fall back to uncached rustc instead of
1919
# failing the build.
2020
SCCACHE_GHA_ENABLED: "true"
21+
# sccache cannot cache Cargo incremental artifacts; without this, sccache
22+
# reports ~0% utilization even on cache misses. Disabling incremental lets
23+
# sccache cache per-crate compilations whenever the cargo target cache misses.
24+
CARGO_INCREMENTAL: "0"
2125
# Pinned commit for cpp-example-collection smoke build (https://github.com/livekit-examples/cpp-example-collection)
2226
CPP_EXAMPLE_COLLECTION_REF: 56815733a71c14692569e8adf2916a56a14d4882
2327
# vcpkg binary caching for Windows
@@ -133,7 +137,17 @@ jobs:
133137
run: |
134138
if sccache --start-server >/dev/null 2>&1; then
135139
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
136-
echo "::notice::sccache enabled (RUSTC_WRAPPER=sccache)"
140+
# Wire sccache into the C++ build too (the dominant build cost),
141+
# but only where the generator honors compiler launchers. The
142+
# Windows preset uses the Visual Studio generator, which ignores
143+
# CMAKE_<LANG>_COMPILER_LAUNCHER, so we skip it there.
144+
if [[ "$RUNNER_OS" != "Windows" ]]; then
145+
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV"
146+
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV"
147+
echo "::notice::sccache enabled for rustc + C/C++ (RUSTC_WRAPPER + CMAKE_*_COMPILER_LAUNCHER)"
148+
else
149+
echo "::notice::sccache enabled for rustc only (Windows VS generator ignores compiler launchers)"
150+
fi
137151
else
138152
echo "::warning::sccache backend unreachable; building without compile cache this run"
139153
fi
@@ -180,6 +194,11 @@ jobs:
180194
shell: pwsh
181195
run: ${{ matrix.build_cmd }}
182196

197+
- name: sccache stats
198+
if: always()
199+
shell: bash
200+
run: sccache --show-stats || true
201+
183202
# ---------- Smoke test cpp-example-collection binaries ----------
184203
# Built under cpp-example-collection-build/ (not build-dir/bin). Visual Studio
185204
# multi-config places executables in per-target Release/ (or Debug/) subdirs.

.github/workflows/ci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ concurrency:
2727

2828
permissions:
2929
contents: read
30-
# Reusable child workflows (builds.yml, tests.yml) request actions:read
31-
# (GHA cache) and packages:read (GHCR). GitHub clamps a child workflow's
32-
# permissions to the MIN of (caller's permissions, child's request), so
33-
# we must grant these at the caller level even though ci.yml itself
34-
# doesn't use them. Without this, callers get
35-
# "actions: read, packages: read" but is only allowed "actions: none, packages: none"
3630
actions: read
3731
packages: read
3832

.github/workflows/tests.yml

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ env:
1818
# transient cache backend failures fall back to uncached rustc instead of
1919
# failing the build.
2020
SCCACHE_GHA_ENABLED: "true"
21+
# sccache cannot cache Cargo incremental artifacts; without this, sccache
22+
# reports ~0% utilization even on cache misses. Disabling incremental lets
23+
# sccache cache per-crate compilations whenever the cargo target cache misses.
24+
CARGO_INCREMENTAL: "0"
2125
# vcpkg binary caching for Windows (mirrors builds.yml)
2226
VCPKG_DEFAULT_TRIPLET: x64-windows-static-md
2327
VCPKG_DEFAULT_HOST_TRIPLET: x64-windows-static-md
@@ -123,7 +127,17 @@ jobs:
123127
run: |
124128
if sccache --start-server >/dev/null 2>&1; then
125129
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
126-
echo "::notice::sccache enabled (RUSTC_WRAPPER=sccache)"
130+
# Wire sccache into the C++ build too (the dominant build cost),
131+
# but only where the generator honors compiler launchers. The
132+
# Windows preset uses the Visual Studio generator, which ignores
133+
# CMAKE_<LANG>_COMPILER_LAUNCHER, so we skip it there.
134+
if [[ "$RUNNER_OS" != "Windows" ]]; then
135+
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV"
136+
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV"
137+
echo "::notice::sccache enabled for rustc + C/C++ (RUSTC_WRAPPER + CMAKE_*_COMPILER_LAUNCHER)"
138+
else
139+
echo "::notice::sccache enabled for rustc only (Windows VS generator ignores compiler launchers)"
140+
fi
127141
else
128142
echo "::warning::sccache backend unreachable; building without compile cache this run"
129143
fi
@@ -170,6 +184,11 @@ jobs:
170184
shell: pwsh
171185
run: ${{ matrix.build_cmd }}
172186

187+
- name: sccache stats
188+
if: always()
189+
shell: bash
190+
run: sccache --show-stats || true
191+
173192
# ---------- Run unit tests ----------
174193
- name: Run unit tests (Unix)
175194
if: runner.os != 'Windows'
@@ -280,6 +299,10 @@ jobs:
280299
coverage:
281300
name: Code Coverage
282301
runs-on: ubuntu-latest
302+
# A debug build instrumented with --coverage is far heavier (RAM + disk)
303+
# than the release builds. Cap the wall-clock so a stuck/OOM build fails
304+
# fast and visibly instead of hanging toward the 6h default.
305+
timeout-minutes: 45
283306

284307
steps:
285308
- name: Checkout (with submodules)
@@ -291,6 +314,19 @@ jobs:
291314
- name: Pull LFS files
292315
run: git lfs pull
293316

317+
# Reclaim ~30GB on the runner. The debug+coverage object tree plus gcov
318+
# data is large; prior runs died mid-build from disk/memory pressure.
319+
- name: Free disk space
320+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
321+
with:
322+
tool-cache: false
323+
android: true
324+
dotnet: true
325+
haskell: true
326+
large-packages: true
327+
docker-images: true
328+
swap-storage: false
329+
294330
# ---------- OS deps ----------
295331
- name: Install deps
296332
run: |
@@ -366,8 +402,13 @@ jobs:
366402
-DCMAKE_EXE_LINKER_FLAGS="--coverage" \
367403
-DCMAKE_SHARED_LINKER_FLAGS="--coverage"
368404
405+
# Cap parallelism: a debug build with --coverage instrumentation has a
406+
# much larger per-TU memory footprint, and unbounded --parallel (one job
407+
# per core) is what OOM-killed prior runs (failure surfaced only as an
408+
# abandoned "Build" step). 2 keeps peak RAM in check on the standard
409+
# runner; bump if/when this moves to a larger runner.
369410
- name: Build
370-
run: cmake --build build-debug --parallel
411+
run: cmake --build build-debug --parallel 2
371412

372413
# ---------- Run unit tests ----------
373414
- name: Run unit tests
@@ -376,6 +417,16 @@ jobs:
376417
build-debug/bin/livekit_unit_tests \
377418
--gtest_output=xml:build-debug/unit-test-results.xml
378419
420+
# Make resource-exhaustion failures visible instead of silent. Runs only
421+
# if an earlier step failed (e.g. OOM during Build).
422+
- name: Diagnostics on failure
423+
if: failure()
424+
run: |
425+
echo "===== disk ====="; df -h || true
426+
echo "===== memory ====="; free -h || true
427+
echo "===== dmesg (OOM killer) ====="
428+
sudo dmesg 2>/dev/null | grep -iE 'killed process|out of memory|oom' | tail -20 || true
429+
379430
# ---------- Generate coverage reports ----------
380431
- name: Generate coverage reports
381432
run: |
@@ -415,7 +466,3 @@ jobs:
415466
path: coverage-html/
416467
retention-days: 14
417468

418-
- name: Upload coverage to Codecov
419-
uses: getsentry/codecov-action@03112cc3b486a3397dc8d17a58680008721fc86f # v0.3.7
420-
with:
421-
token: ${{ secrets.GITHUB_TOKEN }}

build.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,19 @@ configure() {
144144
echo "==> Setting CMAKE_OSX_ARCHITECTURES=${MACOS_ARCH}"
145145
extra_args+=("-DCMAKE_OSX_ARCHITECTURES=${MACOS_ARCH}")
146146
fi
147+
# Bridge compiler-launcher env vars (e.g. sccache/ccache) into the CMake
148+
# cache. CMake does NOT read CMAKE_<LANG>_COMPILER_LAUNCHER from the
149+
# environment, so CI exports these and we forward them explicitly. Only the
150+
# Ninja/Makefile generators honor launchers; the Visual Studio generator
151+
# ignores them, so Windows builds simply leave these unset.
152+
if [[ -n "${CMAKE_C_COMPILER_LAUNCHER:-}" ]]; then
153+
echo "==> Using C compiler launcher: ${CMAKE_C_COMPILER_LAUNCHER}"
154+
extra_args+=("-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}")
155+
fi
156+
if [[ -n "${CMAKE_CXX_COMPILER_LAUNCHER:-}" ]]; then
157+
echo "==> Using C++ compiler launcher: ${CMAKE_CXX_COMPILER_LAUNCHER}"
158+
extra_args+=("-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}")
159+
fi
147160
if ((${#extra_args[@]})); then
148161
if ! cmake --preset "${PRESET}" "${extra_args[@]}"; then
149162
echo "Warning: CMake preset '${PRESET}' failed. Falling back to traditional configure..."

0 commit comments

Comments
 (0)