Fix/grid group (#1787)

* ci: config rust log

* chore: rename flowy-sdk to appflowy-core

* fix: create group after editing the url

* fix: start listen on new group

* chore: add tests

* refactor: mock data

* ci: update command
This commit is contained in:
Nathan.fooo
2023-02-02 23:02:49 +08:00
committed by GitHub
parent d09574951b
commit 069519589e
73 changed files with 1569 additions and 1900 deletions

View File

@ -1,8 +1,3 @@
# cargo make --profile production task
# Run the task with profile, e.g.
# cargo make --profile development-mac appflowy-sdk-dev
# cargo make --profile production-windows-x86 appflowy-sdk-dev
[tasks.env_check]
dependencies = ["echo_env", "install_flutter_protobuf"]
@ -15,12 +10,12 @@ condition = { env_set = [
"stable",
] }
[tasks.appflowy-sdk-dev]
mac_alias = "appflowy-sdk-dev-macos"
windows_alias = "appflowy-sdk-dev-windows"
linux_alias = "appflowy-sdk-dev-linux"
[tasks.appflowy-core-dev]
mac_alias = "appflowy-core-dev-macos"
windows_alias = "appflowy-core-dev-windows"
linux_alias = "appflowy-core-dev-linux"
[tasks.appflowy-sdk-dev-android]
[tasks.appflowy-core-dev-android]
category = "Build"
dependencies = ["env_check"]
run_task = { name = [
@ -29,7 +24,7 @@ run_task = { name = [
"restore-crate-type",
] }
[tasks.appflowy-sdk-dev-macos]
[tasks.appflowy-core-dev-macos]
category = "Build"
dependencies = ["env_check"]
run_task = { name = [
@ -39,7 +34,7 @@ run_task = { name = [
"restore-crate-type",
] }
[tasks.appflowy-sdk-dev-windows]
[tasks.appflowy-core-dev-windows]
category = "Build"
dependencies = ["env_check"]
run_task = { name = [
@ -49,7 +44,7 @@ run_task = { name = [
"restore-crate-type",
] }
[tasks.appflowy-sdk-dev-linux]
[tasks.appflowy-core-dev-linux]
category = "Build"
dependencies = ["env_check"]
run_task = { name = [
@ -59,7 +54,6 @@ run_task = { name = [
"restore-crate-type",
] }
#
[tasks.sdk-build]
private = true
@ -112,7 +106,7 @@ script = [
script_runner = "@duckscript"
#
[tasks.appflowy-sdk-release]
[tasks.appflowy-core-release]
description = "Build flowy sdk in release mode"
category = "Build"
dependencies = ["env_check"]
@ -144,7 +138,7 @@ linux_alias = "post-desktop-linux"
private = true
script = [
"""
echo "🚀 🚀 🚀 Flowy-SDK(macOS) build success"
echo "🚀 🚀 🚀 AppFlowy-Core build success"
dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/appflowy_backend/${TARGET_OS}
lib = set lib${LIB_NAME}.${LIB_EXT}
@ -161,7 +155,7 @@ script_runner = "@duckscript"
private = true
script = [
"""
echo "🚀 🚀 🚀 Flowy-SDK(windows) build success"
echo "🚀 🚀 🚀 AppFlowy-Core build success"
dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/windows/flutter/dart_ffi
lib = set ${LIB_NAME}.${LIB_EXT}
@ -180,7 +174,7 @@ script_runner = "@duckscript"
private = true
script = [
"""
echo "🚀 🚀 🚀 Flowy-SDK(linux) build success"
echo "🚀 🚀 🚀 AppFlowy-Core build success"
dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/linux/flutter/dart_ffi
lib = set lib${LIB_NAME}.${LIB_EXT}

View File

@ -4,17 +4,33 @@ windows_alias = "appflowy-windows"
linux_alias = "appflowy-linux"
[tasks.appflowy-macos]
dependencies = ["appflowy-sdk-release"]
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
dependencies = ["appflowy-core-release"]
run_task = { name = [
"code_generation",
"set-app-version",
"flutter-build",
"copy-to-product",
] }
script_runner = "@shell"
[tasks.appflowy-windows]
dependencies = ["appflowy-sdk-release"]
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
dependencies = ["appflowy-core-release"]
run_task = { name = [
"code_generation",
"set-app-version",
"flutter-build",
"copy-to-product",
] }
[tasks.appflowy-linux]
dependencies = ["appflowy-sdk-release"]
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product", "create-release-archive"] }
dependencies = ["appflowy-core-release"]
run_task = { name = [
"code_generation",
"set-app-version",
"flutter-build",
"copy-to-product",
"create-release-archive",
] }
script_runner = "@shell"
[tasks.appflowy-dev]
@ -23,17 +39,32 @@ windows_alias = "appflowy-windows-dev"
linux_alias = "appflowy-linux-dev"
[tasks.appflowy-macos-dev]
dependencies = ["appflowy-sdk-dev"]
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
dependencies = ["appflowy-core-dev"]
run_task = { name = [
"code_generation",
"set-app-version",
"flutter-build",
"copy-to-product",
] }
script_runner = "@shell"
[tasks.appflowy-windows-dev]
dependencies = ["appflowy-sdk-dev"]
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
dependencies = ["appflowy-core-dev"]
run_task = { name = [
"code_generation",
"set-app-version",
"flutter-build",
"copy-to-product",
] }
[tasks.appflowy-linux-dev]
dependencies = ["appflowy-sdk-dev"]
run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
dependencies = ["appflowy-core-dev"]
run_task = { name = [
"code_generation",
"set-app-version",
"flutter-build",
"copy-to-product",
] }
script_runner = "@shell"
[tasks.copy-to-product]
@ -96,15 +127,13 @@ script = [
script_runner = "@duckscript"
[tasks.set-app-version]
script = [
"""
script = ["""
if is_empty ${APP_VERSION}
APP_VERSION = set ${CURRENT_APP_VERSION}
set_env APP_VERSION ${CURRENT_APP_VERSION}
end
echo APP_VERSION: ${APP_VERSION}
""",
]
"""]
script_runner = "@duckscript"
# The following tasks will create an archive that will be used on the GitHub Releases section
@ -118,7 +147,7 @@ linux_alias = "create-release-archive-linux"
[tasks.create-release-archive-linux]
script = [
"cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${APP_VERSION}/${TARGET_OS}/Release",
"tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *"
"tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *",
]
[tasks.create-release-archive-windows]
@ -136,36 +165,30 @@ script = [
]
[tasks.flutter-build]
script = [
"""
script = ["""
cd app_flowy/
flutter clean
flutter pub get
flutter build ${TARGET_OS} --${BUILD_FLAG} --build-name=${APP_VERSION}
""",
]
"""]
script_runner = "@shell"
[tasks.flutter-build.linux]
script = [
"""
script = ["""
cd app_flowy/
flutter clean
flutter pub get
flutter build ${TARGET_OS} --${BUILD_FLAG}
""",
]
"""]
script_runner = "@shell"
[tasks.flutter-build.windows]
script = [
"""
script = ["""
cd app_flowy
exec cmd.exe /c flutter clean
exec cmd.exe /c flutter pub get
exec cmd.exe /c flutter build ${TARGET_OS} --${BUILD_FLAG}
""",
]
"""]
script_runner = "@duckscript"
[tasks.code_generation]
@ -177,7 +200,7 @@ script = [
flutter packages pub get
flutter packages pub run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
flutter packages pub run build_runner build --delete-conflicting-outputs
"""
""",
]
[tasks.code_generation.windows]
@ -189,7 +212,7 @@ script = [
exec cmd.exe /c flutter packages pub get
exec cmd.exe /c flutter packages pub run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
exec cmd.exe /c flutter packages pub run build_runner build --delete-conflicting-outputs
"""
""",
]
[tasks.dry_code_generation]
@ -199,7 +222,7 @@ script = [
cd app_flowy
flutter packages pub run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
flutter packages pub run build_runner build --delete-conflicting-outputs
"""
""",
]
[tasks.dry_code_generation.windows]
@ -209,5 +232,5 @@ script = [
cd ./app_flowy/
exec cmd.exe /c flutter packages pub run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
exec cmd.exe /c flutter packages pub run build_runner build --delete-conflicting-outputs
"""
""",
]

View File

@ -7,6 +7,7 @@ script = ["""
script_runner = "@shell"
[tasks.tauri_dev]
env = { RUST_LOG = "debug" }
script = ["""
cd appflowy_tauri
npm run tauri dev

View File

@ -18,6 +18,7 @@ cargo make --profile test-linux dart_unit_test_inner
script_runner = "@shell"
[tasks.dart_unit_test_inner]
env = { RUST_LOG = "info" }
dependencies = ["build-test-lib"]
description = "Run flutter unit tests"
script = '''
@ -29,6 +30,7 @@ flutter test --dart-define=RUST_LOG=${TEST_RUST_LOG} --concurrency=1
run_task = { name = ["rust_lib_unit_test", "shared_lib_unit_test"] }
[tasks.rust_lib_unit_test]
env = { RUST_LOG = "info" }
description = "Run rust-lib unit tests"
script = '''
cd rust-lib
@ -36,6 +38,7 @@ cargo test --no-default-features --features="sync, rev-sqlite"
'''
[tasks.shared_lib_unit_test]
env = { RUST_LOG = "info" }
description = "Run shared-lib unit test"
script = '''
cd ../shared-lib
@ -62,8 +65,7 @@ fi
[tasks.clean_profraw_files]
description = "Cleans profraw files that are created by `cargo test`"
script_runner = "@duckscript"
script = [
"""
script = ["""
rust_lib_profs = glob_array ./rust-lib/**/*.profraw
for prof in ${rust_lib_profs}
full_path = canonicalize ${prof}
@ -76,14 +78,12 @@ script = [
rm ${full_path}
end
"""
]
"""]
[tasks.run_rustlib_coverage_tests]
description = "Run tests with coverage instrumentation"
script_runner = "@shell"
script = [
"""
script = ["""
echo --- Running coverage tests ---
cd rust-lib/
@ -91,14 +91,12 @@ script = [
RUSTFLAGS='-C instrument-coverage' \
LLVM_PROFILE_FILE='prof-%p-%m.profraw' \
cargo test --no-default-features --features="sync,rev-sqlite"
"""
]
"""]
[tasks.run_sharedlib_coverage_tests]
description = "Run tests with coverage instrumentation"
script_runner = "@shell"
script = [
"""
script = ["""
echo --- Running coverage tests ---
cd ../shared-lib
@ -107,8 +105,7 @@ script = [
LLVM_PROFILE_FILE='prof-%p-%m.profraw' \
cargo test --no-default-features
"""
]
"""]
[tasks.get_rustlib_grcov_report]
description = "Get `grcov` HTML report for test coverage for rust-lib"
@ -128,7 +125,7 @@ script = [
--output-path target/coverage-html
echo "--- Done! Generated HTML report under 'target/coverage-html' for rustlib."
"""
""",
]
[tasks.get_sharedlib_grcov_report]
@ -149,21 +146,20 @@ script = [
--output-path target/coverage-html
echo "--- Done! Generated HTML report under 'target/coverage-html' for sharedlib."
"""
""",
]
[tasks.get_grcov_report]
description = "Get `grcov` HTML report for test coverage"
run_task = { name = [
"get_rustlib_grcov_report",
"get_sharedlib_grcov_report"
"get_sharedlib_grcov_report",
], parallel = true }
[tasks.get_sharedlib_lcov_report]
description = "Generates `lcov` report for `shared-lib`"
script_runner = "@shell"
script = [
"""
script = ["""
echo Getting 'lcov' results for 'shared-lib'
cd ../shared-lib
@ -178,14 +174,12 @@ script = [
--output-path target/coverage.lcov
echo "--- Done! Generated 'target/coverage.lcov' sharedlib."
"""
]
"""]
[tasks.get_rustlib_lcov_report]
description = "Generates `lcov` report for `rust-lib`"
script_runner = "@shell"
script = [
"""
script = ["""
echo Getting 'lcov' results for 'rust-lib'
cd rust-lib/
@ -200,23 +194,22 @@ script = [
--output-path target/coverage.lcov
echo "--- Done! Generated 'target/coverage.lcov' for rustlib."
"""
]
"""]
[tasks.get_lcov_report]
description = "Get `lcov` reports for test coverage"
run_task = { name = [
"get_sharedlib_lcov_report",
"get_rustlib_lcov_report"
"get_rustlib_lcov_report",
], parallel = true }
[tasks.rust_unit_test_with_coverage]
description = "Run rust unit test with code coverage"
run_task = { name = [
"check_grcov",
'appflowy-flutter-deps-tools',
"run_rustlib_coverage_tests",
"run_sharedlib_coverage_tests",
"get_lcov_report",
"clean_profraw_files"
]}
"check_grcov",
'appflowy-flutter-deps-tools',
"run_rustlib_coverage_tests",
"run_sharedlib_coverage_tests",
"get_lcov_report",
"clean_profraw_files",
] }