| name: GPUI | |
| # Builds, lints and tests the GPUI backend (the workspace in `crates/gpui`) on | |
| # macOS, Windows and Linux, and lints the GPUI Kit example | |
| # (`examples/embed-gpui`, a workspace of its own) on Linux. The main workspace's CI covers the CLI that runs | |
| # it (`nsh run --target gpui`). | |
| on: | |
| # Include shared main-workspace dependencies: upstream merges can change | |
| # the core without touching the GPUI workspace itself. | |
| push: | |
| branches: [main, tui/terminal-backend] | |
| paths: | |
| - "crates/nsh-base/**" | |
| - "crates/nsh-bundler/**" | |
| - "crates/nsh-core/**" | |
| - "crates/nsh-dev/**" | |
| - "crates/nsh-engine/**" | |
| - "crates/nsh-js/**" | |
| - "crates/nsh-macros/**" | |
| - "crates/nsh-package/**" | |
| - "crates/nsh-testing/**" | |
| - "crates/gpui/**" | |
| - "third-party/gpui-wgpu/**" | |
| - "third-party/icy_sixel/**" | |
| - "examples/embed-gpui/**" | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| - ".cargo/**" | |
| - "rust-toolchain.toml" | |
| - ".github/workflows/gpui.yml" | |
| pull_request: | |
| paths: | |
| - "crates/nsh-base/**" | |
| - "crates/nsh-bundler/**" | |
| - "crates/nsh-core/**" | |
| - "crates/nsh-dev/**" | |
| - "crates/nsh-engine/**" | |
| - "crates/nsh-js/**" | |
| - "crates/nsh-macros/**" | |
| - "crates/nsh-package/**" | |
| - "crates/nsh-testing/**" | |
| - "crates/gpui/**" | |
| - "third-party/gpui-wgpu/**" | |
| - "third-party/icy_sixel/**" | |
| - "examples/embed-gpui/**" | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| - ".cargo/**" | |
| - "rust-toolchain.toml" | |
| - ".github/workflows/gpui.yml" | |
| schedule: | |
| - cron: "0 3 * * *" | |
| merge_group: | |
| types: [checks_requested] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: gpui-${{ github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| # CI builds each crate once: no incremental state and no debug info | |
| # (faster builds, smaller caches; panics still name their file and line). | |
| CARGO_INCREMENTAL: "0" | |
| CARGO_PROFILE_DEV_DEBUG: "0" | |
| # The toolchain file's iOS and Android targets are only the release's. | |
| RUSTUP_TOOLCHAIN: stable | |
| jobs: | |
| check: | |
| name: check (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, macos-15, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Temporary directories (tests) outside the checkout. | |
| - name: Set up the environment | |
| run: | | |
| mkdir -p "$RUNNER_TEMP/tmp" | |
| echo "TMPDIR=$RUNNER_TEMP/tmp" >> "$GITHUB_ENV" | |
| # QuickJS is C (bindgen needs libclang); GPUI links X11, Wayland, | |
| # xkbcommon, fontconfig and FreeType, and draws with Vulkan (GPUI | |
| # Fast's CI list); web views (feature `webview`, wry) need GTK 3 and | |
| # WebKitGTK 4.1, videos (feature `video`) GStreamer 1.20+. | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| clang libclang-dev build-essential pkg-config \ | |
| libasound2-dev libfontconfig-dev libfreetype-dev libssl-dev \ | |
| libvulkan1 mesa-vulkan-drivers libwayland-dev libx11-xcb-dev libxcb1-dev \ | |
| libxkbcommon-dev libxkbcommon-x11-dev libzstd-dev \ | |
| libgtk-3-dev libwebkit2gtk-4.1-dev \ | |
| libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev | |
| - name: Set up Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| # QuickJS is C: bindgen needs libclang, which the image's LLVM has. | |
| echo "LIBCLANG_PATH=C:\\Program Files\\LLVM\\bin" >> "$GITHUB_ENV" | |
| # rustc can overflow its default stack on the `windows` crate. | |
| echo "RUST_MIN_STACK=268435456" >> "$GITHUB_ENV" | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| # Dependencies only: main's runs save it, pull requests restore it. | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| workspaces: crates/gpui -> ../../target | |
| # The GPUI workspace builds into the repository's `target/` | |
| # (`crates/gpui/.cargo/config.toml`). | |
| - name: Clippy | |
| working-directory: crates/gpui | |
| run: cargo clippy --all-targets --features nsh-platform-gpui/dev -- -D warnings | |
| # Tests need no display: they open no window. | |
| - name: Test | |
| working-directory: crates/gpui | |
| run: cargo test | |
| # With the tests in windows of GPUI's test platform (feature `shot`, GPUI's | |
| # test support): still no display. | |
| - name: Test (GPUI's test platform) | |
| if: runner.os == 'Linux' | |
| working-directory: crates/gpui | |
| run: cargo test -p nsh-platform-gpui --features shot | |
| # Dependency unit tests are not run by the GPUI workspace's cargo test. | |
| # Mesa supplies a real CPU Vulkan adapter without a physical GPU. | |
| - name: Test (WGPU pixel readback) | |
| if: runner.os == 'Linux' | |
| working-directory: crates/gpui | |
| run: > | |
| cargo test --manifest-path ../../third-party/gpui-wgpu/Cargo.toml | |
| --features offscreen,test-support --lib headless_ | |
| -- --test-threads=1 --nocapture | |
| # What a Mac without Xcode's Metal Toolchain builds (the CLI turns | |
| # the feature on there): GPUI's build script stitches its shaders | |
| # for run time compilation instead of running `metal`. | |
| - name: Check (runtime-shaders) | |
| if: runner.os == 'macOS' | |
| working-directory: crates/gpui | |
| run: cargo check -p nsh-gpui-host --features nsh-platform-gpui/runtime-shaders | |
| # The GPUI Kit example: its `build.rs` bundles its app. | |
| - name: Clippy (examples/embed-gpui) | |
| if: runner.os == 'Linux' | |
| working-directory: examples/embed-gpui | |
| run: cargo clippy --all-targets -- -D warnings |