mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
ci: add tauri ci (#1833)
* ci: add tauri ci * ci: update install windows scripts * Update tauri_ci.yaml * Update tauri_ci.yaml * ci: update
This commit is contained in:
parent
72768a2f77
commit
cbd351453d
74
.github/workflows/tauri_ci.yaml
vendored
Normal file
74
.github/workflows/tauri_ci.yaml
vendored
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
name: Tauri-CI
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "frontend/rust-lib/**"
|
||||||
|
- "frontend/appflowy_tauri/**"
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_VERSION: "16"
|
||||||
|
RUST_TOOLCHAIN: "1.65"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tauri-build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: [macos-latest, ubuntu-20.04, windows-latest]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: setup node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
id: rust_toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
||||||
|
override: true
|
||||||
|
profile: minimal
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
prefix-key: ${{ matrix.platform }}
|
||||||
|
|
||||||
|
- name: install dependencies (windows only)
|
||||||
|
if: matrix.platform == 'windows-latest'
|
||||||
|
working-directory: frontend
|
||||||
|
run: |
|
||||||
|
cargo install --force cargo-make
|
||||||
|
cargo install --force duckscript_cli
|
||||||
|
vcpkg integrate install
|
||||||
|
cargo make appflowy-tauri-deps-tools
|
||||||
|
|
||||||
|
- name: install dependencies (ubuntu only)
|
||||||
|
if: matrix.platform == 'ubuntu-20.04'
|
||||||
|
working-directory: frontend
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
|
||||||
|
cargo install --force cargo-make
|
||||||
|
cargo make appflowy-tauri-deps-tools
|
||||||
|
|
||||||
|
- name: install dependencies (macOS only)
|
||||||
|
if: matrix.platform == 'macos-latest'
|
||||||
|
working-directory: frontend
|
||||||
|
run: |
|
||||||
|
cargo install --force cargo-make
|
||||||
|
cargo make appflowy-tauri-deps-tools
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
working-directory: frontend/appflowy_tauri
|
||||||
|
run: |
|
||||||
|
mkdir dist
|
||||||
|
npm install
|
||||||
|
cargo make --cwd .. build_tauri_backend
|
||||||
|
yarn && yarn build
|
||||||
|
|
||||||
|
- uses: tauri-apps/tauri-action@v0
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -24,7 +24,7 @@ CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
|
|||||||
CARGO_MAKE_CRATE_NAME = "dart-ffi"
|
CARGO_MAKE_CRATE_NAME = "dart-ffi"
|
||||||
LIB_NAME = "dart_ffi"
|
LIB_NAME = "dart_ffi"
|
||||||
CURRENT_APP_VERSION = "0.1.0"
|
CURRENT_APP_VERSION = "0.1.0"
|
||||||
FLUTTER_DESKTOP_FEATURES = "flutter,rev-sqlite"
|
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite"
|
||||||
PRODUCT_NAME = "AppFlowy"
|
PRODUCT_NAME = "AppFlowy"
|
||||||
# CRATE_TYPE: https://doc.rust-lang.org/reference/linkage.html
|
# CRATE_TYPE: https://doc.rust-lang.org/reference/linkage.html
|
||||||
# If you update the macOS's CRATE_TYPE, don't forget to update the
|
# If you update the macOS's CRATE_TYPE, don't forget to update the
|
||||||
@ -134,7 +134,7 @@ CRATE_TYPE = "cdylib"
|
|||||||
FLUTTER_OUTPUT_DIR = "Debug"
|
FLUTTER_OUTPUT_DIR = "Debug"
|
||||||
LIB_EXT = "so"
|
LIB_EXT = "so"
|
||||||
LINUX_ARCH = "arm64"
|
LINUX_ARCH = "arm64"
|
||||||
FLUTTER_DESKTOP_FEATURES = "flutter,rev-sqlite,openssl_vendored"
|
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored"
|
||||||
|
|
||||||
[env.production-linux-aarch64]
|
[env.production-linux-aarch64]
|
||||||
BUILD_FLAG = "release"
|
BUILD_FLAG = "release"
|
||||||
@ -145,7 +145,7 @@ FLUTTER_OUTPUT_DIR = "Release"
|
|||||||
LIB_EXT = "so"
|
LIB_EXT = "so"
|
||||||
LINUX_ARCH = "arm64"
|
LINUX_ARCH = "arm64"
|
||||||
APP_ENVIRONMENT = "production"
|
APP_ENVIRONMENT = "production"
|
||||||
FLUTTER_DESKTOP_FEATURES = "flutter,rev-sqlite,openssl_vendored"
|
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored"
|
||||||
|
|
||||||
[tasks.echo_env]
|
[tasks.echo_env]
|
||||||
script = ['''
|
script = ['''
|
||||||
@ -173,14 +173,14 @@ BUILD_FLAG = "debug"
|
|||||||
TARGET_OS = "android"
|
TARGET_OS = "android"
|
||||||
CRATE_TYPE = "cdylib"
|
CRATE_TYPE = "cdylib"
|
||||||
FLUTTER_OUTPUT_DIR = "Debug"
|
FLUTTER_OUTPUT_DIR = "Debug"
|
||||||
FLUTTER_DESKTOP_FEATURES = "flutter,rev-sqlite,openssl_vendored"
|
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored"
|
||||||
|
|
||||||
[env.production-android]
|
[env.production-android]
|
||||||
BUILD_FLAG = "release"
|
BUILD_FLAG = "release"
|
||||||
TARGET_OS = "android"
|
TARGET_OS = "android"
|
||||||
CRATE_TYPE = "cdylib"
|
CRATE_TYPE = "cdylib"
|
||||||
FLUTTER_OUTPUT_DIR = "Release"
|
FLUTTER_OUTPUT_DIR = "Release"
|
||||||
FLUTTER_DESKTOP_FEATURES = "flutter,rev-sqlite,openssl_vendored"
|
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored"
|
||||||
|
|
||||||
[tasks.setup-crate-type]
|
[tasks.setup-crate-type]
|
||||||
private = true
|
private = true
|
||||||
|
@ -12,13 +12,14 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.2.0",
|
||||||
"google-protobuf": "^3.21.2",
|
"google-protobuf": "^3.21.2",
|
||||||
"ts-results": "^3.3.0",
|
|
||||||
"nanoid": "^4.0.0",
|
"nanoid": "^4.0.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0",
|
||||||
|
"ts-results": "^3.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/cli": "^1.2.2",
|
"@tauri-apps/cli": "^1.2.2",
|
||||||
|
"@types/google-protobuf": "^3.15.6",
|
||||||
"@types/node": "^18.7.10",
|
"@types/node": "^18.7.10",
|
||||||
"@types/react": "^18.0.15",
|
"@types/react": "^18.0.15",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
|
2
frontend/appflowy_tauri/src-tauri/rust-toolchain.toml
Normal file
2
frontend/appflowy_tauri/src-tauri/rust-toolchain.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "1.65"
|
@ -14,10 +14,10 @@ use request::*;
|
|||||||
use tauri::Manager;
|
use tauri::Manager;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let sdk = init_flowy_core();
|
let flowy_core = init_flowy_core();
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.invoke_handler(tauri::generate_handler![invoke_request])
|
.invoke_handler(tauri::generate_handler![invoke_request])
|
||||||
.manage(sdk)
|
.manage(flowy_core)
|
||||||
.on_window_event(|_window_event| {})
|
.on_window_event(|_window_event| {})
|
||||||
.on_menu_event(|_menu| {})
|
.on_menu_event(|_menu| {})
|
||||||
.on_page_load(|window, _payload| {
|
.on_page_load(|window, _payload| {
|
||||||
@ -29,7 +29,8 @@ fn main() {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
if cfg!(debug_assertions) {
|
#[cfg(debug_assertions)]
|
||||||
|
{
|
||||||
let window = app.get_window("main").unwrap();
|
let window = app.get_window("main").unwrap();
|
||||||
window.open_devtools();
|
window.open_devtools();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
export {}
|
@ -0,0 +1 @@
|
|||||||
|
export {}
|
@ -0,0 +1 @@
|
|||||||
|
export {}
|
@ -0,0 +1 @@
|
|||||||
|
export {}
|
@ -0,0 +1 @@
|
|||||||
|
export {}
|
@ -32,8 +32,8 @@ flowy-notification = { path = "../flowy-notification" }
|
|||||||
flowy-derive = { path = "../flowy-derive" }
|
flowy-derive = { path = "../flowy-derive" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["flowy-core/dart", "flutter", "rev-sqlite"]
|
default = ["dart", "rev-sqlite"]
|
||||||
flutter = []
|
dart = ["flowy-core/dart"]
|
||||||
rev-sqlite = ["flowy-core/rev-sqlite"]
|
rev-sqlite = ["flowy-core/rev-sqlite"]
|
||||||
http_sync = ["flowy-core/http_sync", "flowy-core/use_bunyan"]
|
http_sync = ["flowy-core/http_sync", "flowy-core/use_bunyan"]
|
||||||
openssl_vendored = ["flowy-core/openssl_vendored"]
|
openssl_vendored = ["flowy-core/openssl_vendored"]
|
||||||
|
@ -11,12 +11,10 @@ use grid_model::{CellRevision, DatabaseBlockRevision, RowChangeset, RowRevision}
|
|||||||
use lib_infra::future::FutureResult;
|
use lib_infra::future::FutureResult;
|
||||||
use lib_infra::retry::spawn_retry;
|
use lib_infra::retry::spawn_retry;
|
||||||
use lib_ot::core::EmptyAttributes;
|
use lib_ot::core::EmptyAttributes;
|
||||||
use parking_lot::RwLock;
|
|
||||||
use revision_model::Revision;
|
use revision_model::Revision;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use tokio::sync::RwLock;
|
||||||
// use tokio::sync::RwLock;
|
|
||||||
|
|
||||||
pub struct DatabaseBlockRevisionEditor {
|
pub struct DatabaseBlockRevisionEditor {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@ -57,7 +55,7 @@ impl DatabaseBlockRevisionEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn duplicate_block(&self, duplicated_block_id: &str) -> DatabaseBlockRevision {
|
pub async fn duplicate_block(&self, duplicated_block_id: &str) -> DatabaseBlockRevision {
|
||||||
self.pad.read().duplicate_data(duplicated_block_id)
|
self.pad.read().await.duplicate_data(duplicated_block_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a row after the the with prev_row_id. If prev_row_id is None, the row will be appended to the list
|
/// Create a row after the the with prev_row_id. If prev_row_id is None, the row will be appended to the list
|
||||||
@ -112,16 +110,15 @@ impl DatabaseBlockRevisionEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn index_of_row(&self, row_id: &str) -> Option<usize> {
|
pub async fn index_of_row(&self, row_id: &str) -> Option<usize> {
|
||||||
self.pad.read().index_of_row(row_id)
|
self.pad.read().await.index_of_row(row_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn number_of_rows(&self) -> i32 {
|
pub async fn number_of_rows(&self) -> i32 {
|
||||||
self.pad.read().rows.len() as i32
|
self.pad.read().await.rows.len() as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_row_rev(&self, row_id: &str) -> FlowyResult<Option<(usize, Arc<RowRevision>)>> {
|
pub async fn get_row_rev(&self, row_id: &str) -> FlowyResult<Option<(usize, Arc<RowRevision>)>> {
|
||||||
let duration = Duration::from_millis(300);
|
if let Ok(pad) = self.pad.try_read() {
|
||||||
if let Some(pad) = self.pad.try_read_for(duration) {
|
|
||||||
Ok(pad.get_row_rev(row_id))
|
Ok(pad.get_row_rev(row_id))
|
||||||
} else {
|
} else {
|
||||||
tracing::error!("Required grid block read lock failed, retrying");
|
tracing::error!("Required grid block read lock failed, retrying");
|
||||||
@ -143,7 +140,7 @@ impl DatabaseBlockRevisionEditor {
|
|||||||
where
|
where
|
||||||
T: AsRef<str> + ToOwned + ?Sized,
|
T: AsRef<str> + ToOwned + ?Sized,
|
||||||
{
|
{
|
||||||
let row_revs = self.pad.read().get_row_revs(row_ids)?;
|
let row_revs = self.pad.read().await.get_row_revs(row_ids)?;
|
||||||
Ok(row_revs)
|
Ok(row_revs)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +149,7 @@ impl DatabaseBlockRevisionEditor {
|
|||||||
field_id: &str,
|
field_id: &str,
|
||||||
row_ids: Option<Vec<Cow<'_, String>>>,
|
row_ids: Option<Vec<Cow<'_, String>>>,
|
||||||
) -> FlowyResult<Vec<CellRevision>> {
|
) -> FlowyResult<Vec<CellRevision>> {
|
||||||
let cell_revs = self.pad.read().get_cell_revs(field_id, row_ids)?;
|
let cell_revs = self.pad.read().await.get_cell_revs(field_id, row_ids)?;
|
||||||
Ok(cell_revs)
|
Ok(cell_revs)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +157,8 @@ impl DatabaseBlockRevisionEditor {
|
|||||||
where
|
where
|
||||||
F: for<'a> FnOnce(&'a mut GridBlockRevisionPad) -> FlowyResult<Option<GridBlockRevisionChangeset>>,
|
F: for<'a> FnOnce(&'a mut GridBlockRevisionPad) -> FlowyResult<Option<GridBlockRevisionChangeset>>,
|
||||||
{
|
{
|
||||||
let changeset = f(&mut self.pad.write())?;
|
let mut write_guard = self.pad.write().await;
|
||||||
|
let changeset = f(&mut write_guard)?;
|
||||||
match changeset {
|
match changeset {
|
||||||
None => {}
|
None => {}
|
||||||
Some(changeset) => {
|
Some(changeset) => {
|
||||||
|
@ -2,11 +2,10 @@ use flowy_client_sync::client_database::GridBlockRevisionPad;
|
|||||||
use flowy_error::FlowyError;
|
use flowy_error::FlowyError;
|
||||||
use grid_model::RowRevision;
|
use grid_model::RowRevision;
|
||||||
use lib_infra::retry::Action;
|
use lib_infra::retry::Action;
|
||||||
|
|
||||||
use parking_lot::RwLock;
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
pub struct GetRowDataRetryAction {
|
pub struct GetRowDataRetryAction {
|
||||||
pub row_id: String,
|
pub row_id: String,
|
||||||
@ -23,8 +22,8 @@ impl Action for GetRowDataRetryAction {
|
|||||||
let row_id = self.row_id.clone();
|
let row_id = self.row_id.clone();
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
match pad.try_read() {
|
match pad.try_read() {
|
||||||
None => Ok(None),
|
Err(_) => Ok(None),
|
||||||
Some(read_guard) => Ok(read_guard.get_row_rev(&row_id)),
|
Ok(read_guard) => Ok(read_guard.get_row_rev(&row_id)),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,9 @@ cargo install diesel_cli --no-default-features --features sqlite
|
|||||||
|
|
||||||
[tasks.install_diesel.windows]
|
[tasks.install_diesel.windows]
|
||||||
script = """
|
script = """
|
||||||
cargo install diesel_cli --no-default-features --features sqlite
|
#https://duredhelfinceleb.github.io/diesel_windows_install_doc/
|
||||||
|
|
||||||
|
cargo install diesel_cli --no-default-features --features "sqlite-bundled"
|
||||||
"""
|
"""
|
||||||
dependencies = ["check_vcpkg"]
|
dependencies = ["check_vcpkg"]
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
script = """
|
script = """
|
||||||
npm install -g protoc-gen-ts
|
npm install -g protoc-gen-ts
|
||||||
"""
|
"""
|
||||||
script_runner = "@duckscript"
|
script_runner = "@shell"
|
||||||
|
|
||||||
[tasks.install_tauri_protobuf.mac]
|
[tasks.install_tauri_protobuf.mac]
|
||||||
script = """
|
script = """
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[tasks.tauri_build]
|
[tasks.build_tauri_backend]
|
||||||
description = "Build the Tauri backend & Run Code Generation"
|
description = "Build the Tauri backend"
|
||||||
script = ["""
|
script = ["""
|
||||||
cd appflowy_tauri/src-tauri
|
cd appflowy_tauri/src-tauri
|
||||||
cargo build
|
cargo build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user