ci(rust): run the Rust workspace, which no workflow has ever built - #177
Closed
EtienneLescot wants to merge 2 commits into
Closed
ci(rust): run the Rust workspace, which no workflow has ever built#177EtienneLescot wants to merge 2 commits into
EtienneLescot wants to merge 2 commits into
Conversation
No GitHub workflow invokes cargo. crates/compositor is production code the app links, crates/compositor-view-napi is the addon it ships, and neither has ever been compiled by CI - the 76 unit tests in the workspace only run when someone remembers to run them locally, and nothing catches a crate that stops building. A runner cannot compile the workspace at all as things stand. FFMPEG_DIR in crates/.cargo/config.toml points at a tree that is gitignored: bindgen needs its include/ and the linker needs its lib/, and neither has ever been provisioned by anything. The steps were folklore - hand-place the archive, or symlink poc-d3d/thirdparty and hope. So fetch-ffmpeg.mjs now keeps that tree. It already downloads the shared build, verifies its pinned SHA-256 and asserts the licence is LGPL; it extracted include/ and lib/ and then deleted them with the temp dir, keeping only the DLLs. Landing them at FFMPEG_DIR reuses the pin, the digest and the licence check rather than adding a second download path to keep in sync, and it fixes the clean-checkout build for people too, not only for CI. The destination is read out of the cargo config the same way compositorViewService.ts reads it for the runtime PATH, so a rename cannot silently desynchronise them. It copies over the tree rather than replacing it: crates/thirdparty is commonly a junction into poc-d3d/thirdparty, and a recursive delete would follow it and take the real tree with it. The job is windows-latest by necessity - the compositor is D3D11 and links the windows crate, so there is nothing to run on ubuntu. It runs from crates/ rather than passing --manifest-path, because cargo resolves .cargo/config.toml against the working directory and would otherwise get neither FFMPEG_DIR nor LIBCLANG_PATH. --workspace because default-members = ["poc-d3d"] means a bare cargo test skips the library and the addon. --all-targets because it excludes doctests, and it must: bindgen copies ffmpeg's C doxygen comments into out/ffi.rs verbatim, so rustdoc finds 13 "examples" that are C, and fails them. They are generated and there is nothing in them to fix. Not included, deliberately. cargo fmt --check fails today on files nobody touched in this change (audio.rs among them), and clippy on FFI-heavy code with a 13-warning generated binding is a backlog, not a gate. Both are ratchets to add once someone has cleared them; the gate that pays for itself now is "it builds and the tests pass". Verified locally with the junction removed, so the runner's cold state: fetch-ffmpeg.mjs materialised the tree at crates/thirdparty, cargo clean -p openscreen-compositor forced bindgen to re-run against it, and cargo test --workspace --all-targets passed 76/76. Re-running the script is a no-op.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
The gap
No workflow invokes
cargo.crates/compositoris production code the app links,crates/compositor-view-napiis the addon it ships, and neither has ever been compiled by CI. The 76 unit tests in the workspace run only when someone remembers to run them locally, and nothing catches a crate that stops building.This surfaced reviewing #161, which added unit tests as an acceptance criterion — tests that no automated system would ever have run.
Why it wasn't just "add a job"
A runner cannot compile the workspace as things stand.
FFMPEG_DIRincrates/.cargo/config.tomlpoints at a gitignored tree: bindgen needs itsinclude/, the linker needs itslib/, and nothing has ever provisioned either. The steps were folklore — hand-place the archive, or junctionpoc-d3d/thirdpartyand hope.So
fetch-ffmpeg.mjsnow keeps that tree. It already downloads the shared build, verifies its pinned SHA-256, and asserts the licence is LGPL — then extractedinclude/andlib/and deleted them with the temp dir, keeping only the DLLs. Landing them atFFMPEG_DIRreuses the existing pin, digest and licence check instead of adding a second download path to keep in sync, and it fixes the clean-checkout build for contributors too, not just for CI.Two details worth a look in review:
pinnedFfmpegDir()incompositorViewService.tsreads it for the runtime PATH — a rename can't silently desynchronise them.crates/thirdpartyis commonly a junction intopoc-d3d/thirdparty, and a recursive delete would follow the junction and take the real tree with it.The job
windows-latestby necessity — the compositor is D3D11 and links thewindowscrate, so there is nothing to run on ubuntu.crates/rather than passing--manifest-path: cargo resolves.cargo/config.tomlagainst the working directory, and from the root the build gets neitherFFMPEG_DIRnorLIBCLANG_PATH.--workspacebecausedefault-members = ["poc-d3d"]means a barecargo testskips the library and the addon.--all-targetsbecause it excludes doctests, and it has to: bindgen copies ffmpeg's C doxygen comments verbatim intoout/ffi.rs, so rustdoc finds 13 "examples" that are C and fails to compile them as Rust. They are generated, and there is nothing in them to fix.Deliberately not included
cargo fmt --checkfails today on files nobody touched here (audio.rsamong them).clippyon FFI-heavy code, against a generated binding that already emits 13 warnings, is a backlog rather than a gate.Both are ratchets worth adding once someone has cleared them — the same shape as the existing
typecheck-testsjob. The gate that pays for itself now is "it builds and the tests pass".Verification
Locally, with the junction removed so the runner's cold state was reproduced:
fetch-ffmpeg.mjsmaterialised the tree atcrates/thirdparty,cargo clean -p openscreen-compositorforced bindgen to re-run against it, andcargo test --workspace --all-targetspassed 76/76. Re-running the script is a no-op.Beyond that, this PR verifies itself — the job below is the change.
Expect the first run to be slow (cold
Swatinem/rust-cache, and Windows runners are not fast); subsequent runs hit the cache.