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 initial CI job for Windows target (#8088)

Kirill Bulatovc97ecc7326b4
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bf8d7a79efe..43549531a4a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -126,6 +126,36 @@ jobs:
- name: Build Zed
run: cargo build -p zed
+
+ # todo!(windows): Actually run the tests
+ windows_tests:
+ name: (Windows) Run Clippy and tests
+ runs-on: windows-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v4
+ with:
+ clean: false
+ submodules: "recursive"
+
+ - name: Restore from cache
+ uses: actions/cache@v4
+ with:
+ path: |
+ ~/.cargo/bin/
+ ~/.cargo/registry/index/
+ ~/.cargo/registry/cache/
+ ~/.cargo/git/db/
+ target/
+ key: ${{ runner.os }}-cargo-${{ hashFiles('**/rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
+ # todo!(windows): Actually run clippy
+ #- name: cargo clippy
+ # shell: bash -euxo pipefail {0}
+ # run: script/clippy
+
+ - name: Build Zed
+ run: cargo build -p zed
+
bundle:
name: Bundle macOS app
runs-on:
diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs
index 968c1795f12..bde0fe3f704 100644
--- a/crates/fs/src/fs.rs
+++ b/crates/fs/src/fs.rs
@@ -245,7 +245,7 @@ impl Fs for RealFs {
#[cfg(unix)]
let inode = metadata.ino();
- // todo!(windows)
+ // todo!("windows")
#[cfg(windows)]
let inode = 0;
diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs
index 7e57009af21..bbd2e93b4fe 100644
--- a/crates/gpui/src/platform.rs
+++ b/crates/gpui/src/platform.rs
@@ -61,6 +61,10 @@ pub(crate) fn current_platform() -> Rc<dyn Platform> {
pub(crate) fn current_platform() -> Rc<dyn Platform> {
Rc::new(LinuxPlatform::new())
}
+#[cfg(target_os = "windows")]
+pub(crate) fn current_platform() -> Rc<dyn Platform> {
+ todo!("windows")
+}
pub(crate) trait Platform: 'static {
fn background_executor(&self) -> BackgroundExecutor;
diff --git a/crates/gpui/src/platform/test/platform.rs b/crates/gpui/src/platform/test/platform.rs
index fc73e49afbc..dc4dc13fa1e 100644
--- a/crates/gpui/src/platform/test/platform.rs
+++ b/crates/gpui/src/platform/test/platform.rs
@@ -125,6 +125,9 @@ impl Platform for TestPlatform {
#[cfg(target_os = "macos")]
return Arc::new(crate::platform::mac::MacTextSystem::new());
+
+ #[cfg(target_os = "windows")]
+ todo!("windows")
}
fn run(&self, _on_finish_launching: Box<dyn FnOnce()>) {
diff --git a/crates/install_cli/src/install_cli.rs b/crates/install_cli/src/install_cli.rs
index e1dff2c52b2..52a6656b902 100644
--- a/crates/install_cli/src/install_cli.rs
+++ b/crates/install_cli/src/install_cli.rs
@@ -18,12 +18,16 @@ pub async fn install_cli(cx: &AsyncAppContext) -> Result<()> {
// If the symlink is not there or is outdated, first try replacing it
// without escalating.
smol::fs::remove_file(link_path).await.log_err();
- if smol::fs::unix::symlink(&cli_path, link_path)
- .await
- .log_err()
- .is_some()
+ // todo!("windows")
+ #[cfg(not(windows))]
{
- return Ok(());
+ if smol::fs::unix::symlink(&cli_path, link_path)
+ .await
+ .log_err()
+ .is_some()
+ {
+ return Ok(());
+ }
}
// The symlink could not be created, so use osascript with admin privileges
diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs
index 0e5eeda8512..882db723916 100644
--- a/crates/terminal/src/terminal.rs
+++ b/crates/terminal/src/terminal.rs
@@ -396,7 +396,7 @@ impl TerminalBuilder {
#[cfg(unix)]
let (fd, shell_pid) = (pty.file().as_raw_fd(), pty.child().id());
- // todo!(windows)
+ // todo!("windows")
#[cfg(windows)]
let (fd, shell_pid) = (-1, 0);
@@ -664,7 +664,7 @@ impl Terminal {
fn update_process_info(&mut self) -> bool {
#[cfg(unix)]
let mut pid = unsafe { libc::tcgetpgrp(self.shell_fd as i32) };
- // todo!(windows)
+ // todo!("windows")
#[cfg(windows)]
let mut pid = -1;
if pid < 0 {
diff --git a/crates/zed/src/languages/csharp.rs b/crates/zed/src/languages/csharp.rs
index 475b7573d03..c8d71ecc6e4 100644
--- a/crates/zed/src/languages/csharp.rs
+++ b/crates/zed/src/languages/csharp.rs
@@ -81,11 +81,15 @@ impl super::LspAdapter for OmniSharpAdapter {
archive.unpack(container_dir).await?;
}
- fs::set_permissions(
- &binary_path,
- <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
- )
- .await?;
+ // todo!("windows")
+ #[cfg(not(windows))]
+ {
+ fs::set_permissions(
+ &binary_path,
+ <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
+ )
+ .await?;
+ }
Ok(LanguageServerBinary {
path: binary_path,
arguments: server_binary_arguments(),
diff --git a/crates/zed/src/languages/elixir.rs b/crates/zed/src/languages/elixir.rs
index 39b9c0a1001..ed76d9e1ea1 100644
--- a/crates/zed/src/languages/elixir.rs
+++ b/crates/zed/src/languages/elixir.rs
@@ -356,11 +356,15 @@ impl LspAdapter for NextLspAdapter {
}
futures::io::copy(response.body_mut(), &mut file).await?;
- fs::set_permissions(
- &binary_path,
- <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
- )
- .await?;
+ // todo!("windows")
+ #[cfg(not(windows))]
+ {
+ fs::set_permissions(
+ &binary_path,
+ <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
+ )
+ .await?;
+ }
}
Ok(LanguageServerBinary {
diff --git a/crates/zed/src/languages/lua.rs b/crates/zed/src/languages/lua.rs
index 24cbafb50f7..95d73f25662 100644
--- a/crates/zed/src/languages/lua.rs
+++ b/crates/zed/src/languages/lua.rs
@@ -83,11 +83,15 @@ impl super::LspAdapter for LuaLspAdapter {
archive.unpack(container_dir).await?;
}
- fs::set_permissions(
- &binary_path,
- <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
- )
- .await?;
+ // todo!("windows")
+ #[cfg(not(windows))]
+ {
+ fs::set_permissions(
+ &binary_path,
+ <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
+ )
+ .await?;
+ }
Ok(LanguageServerBinary {
path: binary_path,
arguments: Vec::new(),
diff --git a/crates/zed/src/languages/rust.rs b/crates/zed/src/languages/rust.rs
index 8bcda939497..b5a1bdbde0e 100644
--- a/crates/zed/src/languages/rust.rs
+++ b/crates/zed/src/languages/rust.rs
@@ -74,11 +74,15 @@ impl LspAdapter for RustLspAdapter {
let decompressed_bytes = GzipDecoder::new(BufReader::new(response.body_mut()));
let mut file = File::create(&destination_path).await?;
futures::io::copy(decompressed_bytes, &mut file).await?;
- fs::set_permissions(
- &destination_path,
- <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
- )
- .await?;
+ // todo!("windows")
+ #[cfg(not(windows))]
+ {
+ fs::set_permissions(
+ &destination_path,
+ <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
+ )
+ .await?;
+ }
remove_matching(&container_dir, |entry| entry != destination_path).await;
}
diff --git a/crates/zed/src/languages/toml.rs b/crates/zed/src/languages/toml.rs
index e6f933d707a..c426990f0d9 100644
--- a/crates/zed/src/languages/toml.rs
+++ b/crates/zed/src/languages/toml.rs
@@ -72,11 +72,15 @@ impl LspAdapter for TaploLspAdapter {
futures::io::copy(decompressed_bytes, &mut file).await?;
- fs::set_permissions(
- &binary_path,
- <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
- )
- .await?;
+ // todo!("windows")
+ #[cfg(not(windows))]
+ {
+ fs::set_permissions(
+ &binary_path,
+ <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
+ )
+ .await?;
+ }
}
Ok(LanguageServerBinary {
diff --git a/crates/zed/src/languages/zig.rs b/crates/zed/src/languages/zig.rs
index 6c12f129c51..ee626d4b813 100644
--- a/crates/zed/src/languages/zig.rs
+++ b/crates/zed/src/languages/zig.rs
@@ -64,11 +64,15 @@ impl LspAdapter for ZlsAdapter {
archive.unpack(container_dir).await?;
}
- fs::set_permissions(
- &binary_path,
- <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
- )
- .await?;
+ // todo!("windows")
+ #[cfg(not(windows))]
+ {
+ fs::set_permissions(
+ &binary_path,
+ <fs::Permissions as fs::unix::PermissionsExt>::from_mode(0o755),
+ )
+ .await?;
+ }
Ok(LanguageServerBinary {
path: binary_path,
arguments: vec![],