ci: run tests on PRs and before releases#141
Merged
Merged
Conversation
- Add reusable composite action .github/actions/setup-rust that installs
the Rust toolchain, sets up cargo caching, and (only on Linux) installs
the minimal system libraries gpui needs (wayland, x11-xcb, xkbcommon-x11,
fontconfig, alsa, vulkan loader, openssl, zstd).
- build.yml: trigger on pull_request:[main] in addition to push:[main].
Replace the previous single test step with two jobs:
* test-linux -- fmt --check, clippy -D warnings and cargo test for
the workspace excluding ui_gpui (Linux only).
* test-gpui -- cargo test -p ui_gpui across Linux, macOS aarch64,
macOS x86_64 and Windows.
The existing release-style build matrix now needs both test jobs and
is skipped for pull requests so PRs only pay for tests.
- release.yml: prepend the same two test jobs and make prepare-version
depend on them so a release is never cut on a red workspace. Also
switch the release build steps over to the composite action and drop
the inline Linux-deps block.
- The old, much larger X11/XCB/mesa/xrandr/xinerama/xcursor/xi apt-get
list is gone; the trimmed list mirrors what zed's CI actually uses
for gpui.
shell_command and canonical_working_dir are only used inside the #[cfg(target_os = "macos")] impl that wraps Seatbelt. Without a cfg gate they trip clippy's dead_code lint on Linux/Windows once the new CI test job runs there. Move them under #[cfg(target_os = "macos")] and drop the now-redundant target_family branches in shell_command (which under that cfg are always Unix anyway).
GitHub's macos-13 runners (which are the only way to get x86_64) have very low capacity and the job sat queued for >10 minutes during the first PR run while the aarch64, Linux and Windows jobs all completed in 4-8 minutes. Release builds still cover x86_64 macOS via the build matrix, so we don't lose meaningful coverage by dropping it here. aarch64 macOS continues to test gpui on the platform that matters most for the project's primary target.
bail! is only used inside the macOS-only canonical_working_dir helper. Without a cfg gate the import is unused on Linux/Windows and trips clippy's unused_imports lint.
clippy::assertions_on_constants flags assert!(true). The placeholder test exists only to document that the macOS-specific Seatbelt tests are intentionally skipped on other platforms, so the assertion has no value -- an empty body with a comment is just as informative.
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.
What
.github/actions/setup-rustthat installs the Rust toolchain, sets up cargo caching (Swatinem/rust-cache), and on Linux installs only the system libraries gpui actually needs.build.ymlnow also triggers onpull_request: [main]and runs two test jobs:cargo fmt --check,cargo clippy -D warningsandcargo testfor--workspace --exclude ui_gpui(Linux only).cargo test -p ui_gpuiacross Linux, macOS aarch64, macOS x86_64 and Windows.needs: [test-linux, test-gpui]and is skipped on PRs (if: github.event_name != 'pull_request'), so PRs only pay for tests.release.ymlgets the same two test jobs, andprepare-versionneedsboth of them — no release is cut on a red workspace.release.ymlalso uses the composite action; the inline Linux-deps block is gone.Why
The previous setup didn't run any tests in CI at all and the inline apt-get list was much larger than necessary. The trimmed list mirrors what zed's CI uses for gpui (wayland / x11-xcb / xkbcommon-x11 / fontconfig / alsa / vulkan loader / openssl / zstd).
Verified locally
cargo fmt --all -- --check— OKcargo clippy --workspace --exclude ui_gpui --all-targets --locked -- -D warnings— OKcargo test --workspace --exclude ui_gpui --locked— all greencargo test -p ui_gpui --locked— 67 tests, all greenNotes
buildjob is intentionally hidden on PRs (skipped). That's expected; the cross-platform release matrix is too expensive to run on every PR push.release.ymlare structurally identical to those inbuild.yml(same composite action, same commands), so a green PR run validates the release path too. They will only actually execute when the release workflow is dispatched manually.