Skip to content

Commit

Permalink
ci: update ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Jul 28, 2024
1 parent da6ff7b commit 8ef7d3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/macos_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ jobs:
aws s3 cp s3://appflowy-local-ai-test/macos-latest/AppFlowyLLM_debug.zip AppFlowyLLM_macos-latest_debug.zip
unzip AppFlowyLLM_macos-latest_debug.zip -d AppFlowyLLM
cd AppFlowyLLM
ls
shell: bash

- name: Prepare env
run: |
ls
ABS_PATH=$(pwd)
chat_bin_path=$ABS_PATH/AppFlowyLLM/appflowy_ai_plugin
embedding_bin_path=$ABS_PATH/AppFlowyLLM/appflowy_embedding_plugin
chat_bin_path=$ABS_PATH/AppFlowyLLM/AppFlowyLLM.app/Contents/MacOS/appflowy_ai_plugin
embedding_bin_path=$ABS_PATH/AppFlowyLLM/AppFlowyLLM.app/Contents/MacOS/appflowy_embedding_plugin
cp dev.env .env
sed -i '' 's|RUST_LOG=.*|RUST_LOG=trace|' .env
Expand Down
13 changes: 4 additions & 9 deletions appflowy-plugin/src/core/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,14 @@ pub(crate) async fn start_plugin_process(
running_state: RunningStateSender,
) -> Result<(), anyhow::Error> {
trace!("start plugin process: {:?}, {:?}", id, plugin_info);
#[cfg(unix)]
{
trace!("ensure executable: {:?}", plugin_info.exec_path);
ensure_executable(&plugin_info.exec_path).await?;
}

let (tx, ret) = tokio::sync::oneshot::channel();
let spawn_result = thread::Builder::new()
.name(format!("<{}> core host thread", &plugin_info.name))
.spawn(move || {
info!("Load {} plugin", &plugin_info.name);

#[cfg(target_os = "macos")]
handle_macos_security_check(&plugin_info);
// #[cfg(target_os = "macos")]
// handle_macos_security_check(&plugin_info);

let child = std::process::Command::new(&plugin_info.exec_path)
.stdin(Stdio::piped())
Expand Down Expand Up @@ -275,6 +269,7 @@ pub(crate) async fn start_plugin_process(
Ok(())
}

#[allow(dead_code)]
#[cfg(unix)]
async fn ensure_executable(exec_path: &std::path::Path) -> Result<(), anyhow::Error> {
use std::os::unix::fs::PermissionsExt;
Expand All @@ -286,13 +281,13 @@ async fn ensure_executable(exec_path: &std::path::Path) -> Result<(), anyhow::Er
Ok(())
}

#[allow(dead_code)]
#[cfg(target_os = "macos")]
pub fn handle_macos_security_check(plugin_info: &PluginInfo) {
trace!("macos security check: {:?}", plugin_info.exec_path);
let mut open_manually = false;
match xattr::list(&plugin_info.exec_path) {
Ok(list) => {
let mut has_quarantine = false;
let mut has_lastuseddate = false;

// https://eclecticlight.co/2023/03/16/what-is-macos-ventura-doing-tracking-provenance/
Expand Down
2 changes: 1 addition & 1 deletion appflowy-plugin/src/core/rpc_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl RpcObject {
/// - `Ok(Ok(ResponsePayload::Streaming(data)))`: If the response contains streaming data of type "streaming".
/// - `Ok(Ok(ResponsePayload::StreamEnd(json!({}))))`: If the response contains streaming data of type "end".
/// - `Err(String)`: If any validation or parsing errors occur.
///.
///
pub fn into_response(mut self) -> Result<Response, String> {
// Ensure 'id' field is present
self
Expand Down

0 comments on commit 8ef7d3e

Please sign in to comment.