GPUI MaterialClose

Development

English | 中文

Contribution workflow and branch naming

Workspace and component development

Coding conventions

Testing conventions

Upstream contributions

Development environment

Install Rustup and run Cargo from the repository root. rust-toolchain.toml pins the repository toolchain; published crates declare an MSRV of 1.95.0 in Cargo.toml.

Platform Build prerequisites
Windows 11 x64 Visual Studio Build Tools with Desktop development with C++, MSVC x64, and the Windows SDK.
macOS on Apple Silicon Xcode command-line tools.
Ubuntu 24.04 x64 System packages listed in the Install Linux platform dependencies step of Engineering CI.

Run Gallery from the repository root, optionally passing a story name or ID:

cargo gallery
cargo gallery text-field

The default workspace members are gpui-material-theme and xtask. Use -p gpui-material-gallery to target Gallery directly. From a worktree, set CARGO_TARGET_DIR to the main checkout’s target directory to reuse incremental builds.

Local checks

Stage Markdown additions, renames, and removals before running xtask so they appear in the Git index. cargo xtask check checks Markdown links, heading anchors, bilingual pairs, generated tokens, and three-platform GPUI/Base dependency graphs.

git diff --check origin/main
cargo xtask check

For Rust changes, run formatting, Clippy, Rustdoc, and tests:

cargo fmt --all --check
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
$env:RUSTDOCFLAGS = '-D warnings'; cargo doc --locked --workspace --no-deps --all-features
cargo test --locked --workspace --all-features

Run Gallery UI tests alone with cargo test --locked -p gpui-material-gallery --features test-support. For token changes, follow the generation steps.

Performance and build tools

Use locked Release builds for rendering performance comparisons and --reduce-motion as a diagnostic comparison:

cargo run --locked --release -p gpui-material-gallery -- button
cargo run --locked --release -p gpui-material-gallery --features frame-profile -- button --frame-profile
cargo test --locked --release -p gpui-material-foundation --lib ripple_clip_benchmark -- --ignored --nocapture
cargo test --locked --release -p gpui-material-gallery --features test-support --lib perf_bench -- --ignored --nocapture --test-threads=1

To measure cold and warm Gallery build times into a fresh report directory:

cargo fetch --locked --target x86_64-pc-windows-msvc
cargo xtask timings target/timings/gallery-timings

Documentation website

The website source uses Astro, MDUI web components, and Pagefind search. With Node.js 24 and npm installed:

npm --prefix website ci
npm --prefix website run dev
npm --prefix website run build
npm --prefix website run preview

The dev server serves at /; production builds default to /gpui-material/ and output to website/dist/ with the Pagefind index.

Edit shared guides under docs/ and component examples under website/component/ (each component page shares one Rust snippet across English and Chinese). The website catalog and sidebar use the basic, form, layout, and advanced groups, ordered alphabetically by Rust name within each group.

Browser previews compile the Rust Gallery to WebAssembly and mount each story in its own GPUI canvas (requiring WebGPU or WebGL2). To build local WASM previews before starting Astro:

rustup toolchain install nightly-2026-10-31 --profile minimal --target wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.130 --locked
npm --prefix website run build:wasm

In repository settings, set Settings → Pages → Build and deployment → Source to GitHub Actions. PRs touching website sources or WASM build inputs run the website build; pushes to main touching the website, its build inputs, or docs/ deploy automatically.

CI and merging

Engineering CI selects jobs by comparing the checkout against the base commit (manual runs execute all jobs).

Job Checks
Change scope Classifies changed files and checks diff whitespace.
Documentation checks Runs cargo xtask docs --check for documentation and engineering changes.
Website / Build documentation Builds and link-checks the website with the WASM Gallery when website sources or build inputs change.
Repository checks Checks Rust formatting, generated tokens, three-platform dependency graphs, and the default workspace.
Windows MSVC, macOS ARM64, Linux x64 Runs Clippy, workspace tests, headless Gallery UI tests, native Gallery builds, and Rustdoc checks (on Linux x64).
CI required Confirms the selected jobs passed and unselected jobs were skipped.

Rust build caches are isolated by platform, saved on main, and restored by PRs. Changes to main require a PR that is up to date with its base and passes CI required under the review and merge rules. For releases, see versioning and releases.

Close