Skip to content

meta: Faster CI: code-PR queue runs under 8 minutes #930

Open
13 of 16 issues completed
Open

Description

@zackees

Goal

Cut a code PR's merge-queue run from 13–15 min to under 8 min, and keep docs/CI-only runs at 2–4 min, without weakening the gate (RED→GREEN, Tier 2 ON/OFF, differential coverage).

Where the time goes now (measured 2026-10-15)

Merge-queue runs of the Pull workflow:

Run Before (morning) Now
Code PR 25–27 min 13–15 min
Docs/CI-only — 2–4 min (lane proofs)

Jobs in a code-PR queue run (#918):

Job Time
Rust Tier 2 Linux 13.1 min (all of it in the one step Validate Tier 2 (ENABLE_RUST_LIBOBS OFF vs ON))
Rust Tests (ubuntu) 3.1 min
clang-format / gersemi 1.5 / 1.3 min
everything else < 0.5 min

Tier 2 Linux is the critical path. Everything else runs alongside it.

Already landed (context)

#716 merge queue · #807 lane proofs · #898/#911 path-scoped platform jobs · #837 Tier 2 -j4 · #783 Tier 2 under xvfb/PipeWire/D-Bus · #717 submodule guard · #721 retries · #924 maintainer bypass and jump-to-front

Follow-ups

A. Tier 2 Linux (critical path, the biggest payoff)

B. Per-run setup

soldr and zccache pay off here and in C (Rust and C++ compiles on cold or slow runners), not in Tier 2. zccache has replayed stale output (docs/ci-tooling.md), so leaning on it harder needs that fixed first.

C. Platform jobs (macOS/Windows off the per-PR path)

D. Full and release builds (not on the PR path)

E. Queue hygiene

Measuring done

Median code-PR queue run over a day of merges is under 8 min (E1 or gh run list --workflow pr-pull.yaml --event merge_group), with no drop in Tier 2 test count, ON or OFF.

Sub-issues

Sub-issues

13 of 16 Issues completed
Loading 16 sub-issues

Activity

  1. added
    infra
    on Oct 16, 2026
  2. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    How Tier 2 runs today (rust/tools/linux-validate/validate.sh):

    • for mode in OFF ON (line 75): each mode configures, builds and runs ctest, and the two modes run one after the other.
    • Inside each mode, ctest runs 4 at a time: -j "${OBS_CTEST_JOBS:-1}" (line 104), with CI setting OBS_CTEST_JOBS: 4 (build-project.yaml:916, ci: Run Tier 2 Linux ctest with -j4 #837). Locally the default is 1.
    • One xvfb-run -a display is shared by every test in a mode.

    So A2 comes first: separate OFF and ON jobs should roughly halve the 13 min. A3 is less certain: the runner has 4 vCPUs, so -j4 already matches the core count. Going higher only helps if tests mostly wait (sleeps, timeouts, PipeWire or D-Bus startup), which A1 will show, and the shared display may need RUN_SERIAL for tests that interfere.

  3. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    A1 measured from the Tier 2 Linux log of #918's queue run (timestamps of validate.sh phases):

    Phase Time
    Setup before the first build (container, Rust staticlib, ported-object check) 2 min 23 s
    OFF configure + build 28 s
    OFF ctest (250 tests, -j4) 4 min 46 s
    ON configure + build 33 s
    ON ctest 4 min 38 s
    Export comparison (1,766 symbols, identical) + ccache stats 6 s

    Compiling is about 1 min of the 12.9; tests are 9.4 min and setup is 2.4 min.

    Slowest tests (OFF run): test_deinterlace_2x_field_order 82.8 s, test_async_delay_audio 59.3, test_startup_cycle_stress 47.7, test_portal_shortcuts 42.7, test_vlc_audio_pacing 34.6, test_vlc_playlist_gap 26.4, test_audio_clock_drift 23.5, test_stinger_media_duration 23.4, test_vlc_audio_track 20.4, test_audio_sync_offset_change 19.0. The top 10 sum to about 380 s, more than the whole 285 s run. They look like real-time media tests, so they mostly wait instead of using CPU.

    Revised order:

    1. A3+ (new first item): start slow tests first (ctest COST, or keep CTestCostData.txt between runs; a fresh container has none, so long tests can start last) and raise -j past 4, since waiting tests don't compete for the 4 vCPUs. Expected: each ctest goes from about 4.7 min to about 1.5–2 min; the floor is the longest test (about 83 s) unless it can run faster than real time.
    2. A2: OFF and ON as separate jobs at the same time.
    3. A5 → swap design: build the cmocka tests once and run them against a C libobs.so and a Rust libobs.so (same soname and exports, via LD_LIBRARY_PATH). This is a stronger ABI check, makes the C library cacheable from master, and lets Rust-only PRs skip the OFF build and the OFF ctest (about 5 min). Check first: decklink/obs-nvenc link libobs dynamically, and both libraries come from one configure.
    4. Setup (2.4 min): prebuilt container image, cached Rust staticlib.

    Combined target for Tier 2: about 4–5 min, down from 13.

  4. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    A7: fail fast on exports and ABI before any test runs.

    Today validate.sh compares the two libobs.so exports (nm -D, "IDENTICAL (1766 symbols)") last, after both ctest runs, so an export mismatch costs the full 13 min. New order:

    1. Per unit, straight after compiling: for each ported unit, the global defined symbols of the C object it replaces (nm --defined-only -g libobs.dir/util/<unit>.c.o) must equal the Rust staticlib's exports for that unit, minus an allowlist of Rust runtime internals. A mismatch fails in seconds and names the unit and symbol. It also catches the case where both sides link only because another object defines the symbol.
    2. Library level, straight after linking: the existing nm -D OFF/ON comparison, moved to run before ctest. It catches link-time problems such as rust-exports.map letting internals through.
    3. Signatures and layouts: nm compares names only (C symbols carry no types). Add abidiff libobs-C.so libobs-Rust.so (libabigail), which reads the DWARF from the RelWithDebInfo builds and compares function signatures and struct layouts. Check first how well it handles Rust DWARF for #[repr(C)] types; it may need suppressions for Rust-only internals. This complements the per-struct layout tests.
    4. Only then ctest (slow tests first, OFF and ON at the same time; items 1–3 above).

    This pairs with the swap design (one set of test binaries, two libobs.so): both libraries exist as artifacts before any test runs, so all of these checks run first.

  5. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    A7 follow-up: the Rust side of libobs.so has no signatures today.

    Checked with gdb -batch -ex 'ptype …' on the local Tier 2 OFF and ON libraries:

    OFF: libobs/util/dstr.c:313  void dstr_ncat(struct dstr *, const char *, const size_t);
         libobs/util/bmem.c:101  void *bmalloc(size_t);
    ON:  0x…fa450 dstr_ncat   type = <unknown return type> ()
         0x…03090 bmalloc     (address only)
    

    [profile.release] in Cargo.toml doesn't enable debug info, so the Rust staticlib carries no DWARF, and abidiff would see only names on the ON side. To make the signature check real:

    1. Build the staticlib with full debug info in the Tier 2 job only: CARGO_PROFILE_RELEASE_DEBUG=2 (shipped builds unchanged). "limited" or line-tables-only debug info leaves out parameter types.
    2. Expect type-name differences in Rust DWARF (usize vs size_t, *mut Dstr vs struct dstr *, c_char vs char). abidiff compares what the types resolve to, but some suppressions will be needed; tune them once on the current 1,766 exports.
    3. Order: per-unit nm (names), then abidiff libobs-OFF.so libobs-ON.so (signatures and layouts), then ctest.

    Tools: gdb ptype, llvm-dwarfdump, readelf --debug-dump=info are available now. abidw/abidiff (libabigail) and pahole need adding to the Tier 2 image.

  6. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    A7 revised: check signatures with the compiler, not DWARF. Supersedes the previous comment's CARGO_PROFILE_RELEASE_DEBUG=2 + abidiff plan. Full debug info bloats every object, slows linking and inflates the cache, all to recover what the public headers already state.

    Signature check: generate a C header from the Rust extern "C" exports (cbindgen), and compile one translation unit that includes it together with the real public header:

    #include "util/dstr.h"          /* public header: the reference */
    #include "obs_rust_exports.h"   /* cbindgen output from the Rust shims */

    A mismatch fails the compile with conflicting types for 'dstr_ncat'. This uses C's own compatibility rules (size_t/usize, char/c_char), needs no suppressions, and is text in and text out, so ccache handles it. cbindgen needs config to emit the C tag names (struct dstr), not the layouts.

    Mirror option on the Rust side: bindgen declarations from the C headers, plus a compile-time assertion per export:

    const _: unsafe extern "C" fn(*mut dstr, *const c_char, usize) = obs_util::ffi::dstr_ncat;

    That fails cargo build, so it runs in the lint lane before Tier 2.

    A7 order:

    1. Per-unit nm: names complete, none missing or extra.
    2. Generated header compiled against the public headers: signatures.
    3. Existing layout tests: struct size, alignment and offsets.
    4. ctest.

    Steps 1–3 take seconds, need no debug info and cache cleanly.

  7. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    Do first: #937, the target design for Tier 2 Linux: build once (C libobs.so + Rust libobs.so + test programs), then fan the tests out over parallel runners (library × shard). Builds are about 1 min of the 12.9 and tests are 9.4 min back to back, so splitting the tests is the win. Expected Tier 2 at about 3–4 min. A2 (OFF/ON as parallel jobs, in progress) and #931 (slow tests first) are steps toward it.

  8. 22 remaining items

  9. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    A5 (#1093) demonstrated with ci/lane_proof.py key --lane tier2-linux --base origin/master on stacked probe commits:

    head change key
    master — ca487d36…
    +1 edit rust/obs-util/tests/*.rs ca487d36… (same)
    +2 + edit rust/obs-gpu-status/src/lib.rs (not built by Tier 2) ca487d36… (same)
    +3 + edit rust/obs-util/src/lib.rs (built) 38b4a1a8… (new)

    So a queue run for a test-only or unbuilt-crate change hits master's proof and skips Tier 2 Linux: build ~3 min + 6 shards ~1.5–2 min each ≈ 13–15 runner-min per such run (master run 38934065121 numbers).

  10. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    Full run 38936650968 (dispatch on master):

  11. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    #978 (157 → 22 integration-test binaries) measured on master run 38941912537 vs 38892442457:

    • Cross Lint cargo test --no-run per target: Windows MSVC 62 → 37 s, aarch64 macOS 64 → 37 s, x86_64 macOS 57 → 32 s; lane 299 → 229 s; job 360 → 300 s.
    • Rust Tests macOS: 334 s (queue run 38908431573) → 201 s; Windows ~unchanged (203 → 211 s).
    • Fast Gate unchanged within noise (234 → 246 s).
  12. zackees commented on Oct 17, 2026

    @zackees
    MemberAuthor

    Claiming: evaluate moving only the Tier 2 compile stage ahead of Fast Gate under #1286. Current generated graph serializes independent runners: Fast Gate -> Tier 2 build -> OFF/ON tests. The build consumes no Fast Gate artifact; scope/proof checks come from check-event/ci-mode. Proposed policy exception: compile can overlap Fast Gate, but both OFF/ON test jobs explicitly wait for Fast Gate and successful build; a skipped attested Fast Gate remains allowed, while failed/canceled gates block tests. All existing required checks remain. This trades possible wasted compilation on red PRs for shorter successful queue critical paths, so document the exception and model/measure runner cost. No workflow graph change has been made yet.

  13. added
    claimed
    and removed
    claimed
    on Oct 17, 2026
  14. zackees commented on Oct 22, 2026

    @zackees
    MemberAuthor

    Final speed-batch report: #1754; measurements and portable evidence. The maintainer explicitly waived the24h wait; the fixed after window is October22,05:52–07:12:45UTC (80m45s),36listed/29terminal/7active-or-queued at capture. This is not a full-day result.

    #1701 allows tests to overlap remaining FastGate work without removing that required check. Baseline median opportunity was0s; benefit is run-dependent. Current complete-Linux matched queue median526→560.5s (n5→2), although samplep95709→574s and medianrunner-minutes18.167→16.367. The under8minute queue target remains unproven and this issue stays open. Broad queue709→352s must not be used because after cohorts include Qt-only/FastGate-only selections.

    Additional trace attribution from the same portable records: dependency-ready→test-start median3s before (10mode jobs) versus30s after (4mode jobs). Run39735875632 waited57sON/59sOFF after its builder and metadata dependencies completed, versus3s/3s in39732507051. This includes orchestration/dispatch; it does not prove runner-capacity exhaustion. FastGate had already completed before the builder in both after runs, so removing that dependency had no opportunity in these two queue samples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    infra

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions