Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add visual tests to macOS CI (#52847)

Richard Feldmanffbfff3e17af
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index b651e7046bc..35efafcfcd9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -43,6 +43,8 @@ jobs:
SCCACHE_BUCKET: sccache-zed
- name: steps::cargo_nextest
run: cargo nextest run --workspace --no-fail-fast --no-tests=warn
+ - name: steps::cargo_build_visual_tests
+ run: cargo build -p zed --bin zed_visual_test_runner --features visual-tests
- name: steps::show_sccache_stats
run: sccache --show-stats || true
- name: steps::cleanup_cargo_config
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml
index a1a0569f5df..13d036b1286 100644
--- a/.github/workflows/run_tests.yml
+++ b/.github/workflows/run_tests.yml
@@ -440,6 +440,8 @@ jobs:
SCCACHE_BUCKET: sccache-zed
- name: steps::cargo_nextest
run: cargo nextest run --workspace --no-fail-fast --no-tests=warn${{ needs.orchestrate.outputs.changed_packages && format(' -E "{0}"', needs.orchestrate.outputs.changed_packages) || '' }}
+ - name: steps::cargo_build_visual_tests
+ run: cargo build -p zed --bin zed_visual_test_runner --features visual-tests
- name: steps::show_sccache_stats
run: sccache --show-stats || true
- name: steps::cleanup_cargo_config
diff --git a/crates/zed/src/visual_test_runner.rs b/crates/zed/src/visual_test_runner.rs
index 17ce65bea4f..7e081c15a56 100644
--- a/crates/zed/src/visual_test_runner.rs
+++ b/crates/zed/src/visual_test_runner.rs
@@ -2646,10 +2646,11 @@ fn run_multi_workspace_sidebar_visual_tests(
cx.run_until_parked();
- // Create the sidebar and register it on the MultiWorkspace
- let sidebar = multi_workspace_window
- .update(cx, |_multi_workspace, window, cx| {
- let multi_workspace_handle = cx.entity();
+ // Create the sidebar outside the MultiWorkspace update to avoid a
+ // re-entrant read panic (Sidebar::new reads the MultiWorkspace).
+ let sidebar = cx
+ .update_window(multi_workspace_window.into(), |root_view, window, cx| {
+ let multi_workspace_handle: Entity<MultiWorkspace> = root_view.downcast().unwrap();
cx.new(|cx| sidebar::Sidebar::new(multi_workspace_handle, window, cx))
})
.context("Failed to create sidebar")?;
@@ -3178,10 +3179,11 @@ edition = "2021"
cx.run_until_parked();
- // Create and register the workspace sidebar
- let sidebar = workspace_window
- .update(cx, |_multi_workspace, window, cx| {
- let multi_workspace_handle = cx.entity();
+ // Create the sidebar outside the MultiWorkspace update to avoid a
+ // re-entrant read panic (Sidebar::new reads the MultiWorkspace).
+ let sidebar = cx
+ .update_window(workspace_window.into(), |root_view, window, cx| {
+ let multi_workspace_handle: Entity<MultiWorkspace> = root_view.downcast().unwrap();
cx.new(|cx| sidebar::Sidebar::new(multi_workspace_handle, window, cx))
})
.context("Failed to create sidebar")?;
diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rs
index 52338e30ff1..65b44123c7b 100644
--- a/tooling/xtask/src/tasks/workflows/run_tests.rs
+++ b/tooling/xtask/src/tasks/workflows/run_tests.rs
@@ -596,6 +596,9 @@ fn run_platform_tests_impl(platform: Platform, filter_packages: bool) -> NamedJo
.when(!filter_packages, |job| {
job.add_step(steps::cargo_nextest(platform))
})
+ .when(platform == Platform::Mac, |job| {
+ job.add_step(steps::cargo_build_visual_tests())
+ })
.add_step(steps::show_sccache_stats(platform))
.add_step(steps::cleanup_cargo_config(platform)),
}
diff --git a/tooling/xtask/src/tasks/workflows/steps.rs b/tooling/xtask/src/tasks/workflows/steps.rs
index 02476531ae9..15c2614ada8 100644
--- a/tooling/xtask/src/tasks/workflows/steps.rs
+++ b/tooling/xtask/src/tasks/workflows/steps.rs
@@ -254,6 +254,10 @@ pub fn setup_sccache(platform: Platform) -> Step<Run> {
.add_env(("SCCACHE_BUCKET", SCCACHE_R2_BUCKET))
}
+pub fn cargo_build_visual_tests() -> Step<Run> {
+ named::bash("cargo build -p zed --bin zed_visual_test_runner --features visual-tests")
+}
+
pub fn show_sccache_stats(platform: Platform) -> Step<Run> {
match platform {
// Use $env:RUSTC_WRAPPER (absolute path) because GITHUB_PATH changes