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 }}
0 commit comments