Repository navigation
ci: Lint and test the Cargo feature sets that --workspace does not build - #2059
Merged
Merged
Conversation
The --workspace clippy and test runs unify Cargo features, so they build libobs-rust and obs-util only with gio on, and obs-build, obs-studio-rust and obs-sys only with their opt-in features off. CMake ships both gio states (os-linux.cmake and os-freebsd.cmake: NO_DEFAULT_FEATURES, then gio if Gio is found), and the opt-in features are built only for a few tests on macOS and Windows. ci/test_feature_sets.py requires: - feature_coverage(): every feature of a workspace crate is built on in one run and off in another (the --workspace run or a FEATURE_SETS entry), or has an exemption with a reason. A run counts as "off" only where it builds the crate. Dependency tables (features, default-features, optional, dev and build dependencies) and the feature syntax (dep:x, x/y, x?/y) decide what a run enables. - the real workspace passes that check, and FEATURE_SETS has the gio-off run of libobs-rust; FEATURE_TEST_SETS tests obs-util with gio off. - the lint lane calls check_feature_sets() and runs one clippy per FEATURE_SETS entry; the rust-test lane runs one cargo test per FEATURE_TEST_SETS entry. ci/local_gate.py has stubs only, so all 14 tests fail (3 failures, 11 errors). ci/test_local_gate.py is unchanged and passes. Refs obs-rust#2056 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lint lane now runs one clippy for each entry of FEATURE_SETS in ci/local_gate.py, and the rust-test lane one cargo test for each entry of FEATURE_TEST_SETS: - `-p libobs-rust --no-default-features`: libobs without GIO, as libobs/cmake/os-linux.cmake and os-freebsd.cmake build it when Gio is not found. obs-util is then built with gio off too. - `-p obs-util`: obs-util's own test and bench targets with gio off. FEATURE_TEST_SETS runs its tests in this state, so the `#[cfg(not(feature = "gio"))]` code in platform_nix_inhibit.rs is compiled, linted and tested. - `-p obs-studio-rust --features libobs-integration`: the native libobs contracts, which only a few macOS and Windows tests built before. check_feature_sets() runs in the lint lane. It fails when a workspace feature is not built both on and off by some clippy run (the --workspace run or a FEATURE_SETS entry), so a new Cargo feature needs an entry or an exemption with a reason. obs-studio-rust/bundled-native and obs-sys/bundled are exempt: obs-sys/build.rs needs OBS_BUILD_RUST_ARCHIVE, a release libobs-rust staticlib, and Tier 2 checks them after its native build. Without the entries, the check reports the six gaps of obs-rust#2056 on master: libobs-rust/gio and obs-util/gio never off; obs-build/libobs-integration, obs-studio-rust/libobs-integration, obs-studio-rust/bundled-native and obs-sys/bundled never on. docs/rust-port/testing-policy.md describes the rule. Refs obs-rust#2056 Co-Authored-By: Claude Opus 5.5 <[email protected]>
4 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2056 (proposal 1, the feature matrix; proposal 2,
[workspace.dependencies], is the next PR)What and why
The
--workspaceclippy and test runs unify Cargo features. They buildlibobs-rustandobs-utilonly withgioon, and the opt-in features only off. CMake ships bothgiostates (libobs/cmake/os-linux.cmake,os-freebsd.cmake:NO_DEFAULT_FEATURES, thengioif Gio is found). So the#[cfg(not(feature = "gio"))]code inrust/obs-util/src/ffi/platform_nix_inhibit.rswas not compiled, linted or tested by any lane.This PR adds the feature sets to the existing local-gate lanes. It adds no job and changes no workflow: the Fast Gate already runs
ci/local_gate.py --lane lintand--lane rust-test.FEATURE_SETSinci/local_gate.py: the lint lane runs oneclippy --all-targets -D warningsfor each entry.-p libobs-rust --no-default-features: libobs without GIO, as CMake builds it.-p obs-util: obs-util's own test and bench targets withgiooff.-p obs-studio-rust --features libobs-integration: the native libobs contracts. Before, only a few macOS/Windows tests built this feature (Tier 2, Qt SDK step).FEATURE_TEST_SETS: the rust-test lane runs theobs-utiltests withgiooff.check_feature_sets()in the lint lane: it fails when a workspace feature is not built both on and off by some clippy run (the--workspacerun or aFEATURE_SETSentry). It reads the workspace manifests withtomlliband follows the dependency tables (features,default-features,optional, dev and build dependencies) and the feature syntax (dep:x,x/y,x?/y). A new Cargo feature therefore needs an entry, or an exemption with a reason.obs-studio-rust/bundled-nativeandobs-sys/bundled.obs-sys/build.rsneedsOBS_BUILD_RUST_ARCHIVE, a releaselibobs-ruststaticlib, so they cannot build in the lint lane. Tier 2 checks them after its native build (validate.sh,validate.ps1).ci/test_local_gate_probe.py: the scratch crate of the probe has noobs-util, so the probe skips theFEATURE_TEST_SETSruns, as it skips the windows-gnu step.docs/rust-port/testing-policy.mddescribes the rule.Without the
FEATURE_SETSentries, the check reports the six gaps from #2056 on master 6891f69:No Rust code changes: the
gio-off code andlibobs-integrationare clean today.Cost (Debian 13 container, 6 cores, after a warm
--workspaceclippy, with the feature-set crates cleaned first): the three clippy runs take 3.0 s, 4.9 s and 2.0 s. Theobs-utiltest build withgiooff takes 7.7 s, and the 839 tests run in about 6 s. A CI runner with fewer cores takes longer.RED → GREEN
ci/test_feature_sets.py(14 tests) against stubs inci/local_gate.py: 3 failures, 11 errors.ci/test_local_gate.py(18) passes.ci/test_feature_sets.py14/14,ci/test_local_gate.py18/18,ci/test_local_gate_probe.pyOK (the soldr probe ran). Linux (Debian 13, kernel 6.x, soldr 0.9.38, Rust 1.98.1):OBS_GATE_SKIP_SELF_TEST=1 uv run ci/local_gate.py --lane lint(as the Fast Gate runs it): ok, 42 s.+ Cargo feature sets: 3 runs, every feature built on and off, all three clippy runs clean.FEATURE_TEST_SETSrun (nextest + doctests): 839/839, doctests 2/2.ci/self-tests: 1189 run. 3 errors intest_hybrid_packaging.py, because this host has nozstd; master 6891f69 gives the same 3 errors on this host.SOLDR_RUSTC_WRAPPER=none:cargo tree -e features -i obs-utilfor-p obs-utiland for-p libobs-rust --no-default-featuresshows nogio.Checklist
master-Wor ratchet change)🤖 Generated with Claude Code