ci: reduce build time (#3519)

This commit is contained in:
Mohammad Zolfaghari
2023-10-23 17:47:11 +03:30
committed by GitHub
parent cd6e133c86
commit 25a98cda81
21 changed files with 430 additions and 104 deletions

View File

@ -94,6 +94,14 @@ run_task = { name = [
] }
script_runner = "@shell"
[tasks.appflowy-make-product-dev]
run_task = { name = [
"set-app-version",
"flutter-build",
"copy-to-product",
] }
[tasks.copy-to-product]
mac_alias = "copy-to-product-macos"
windows_alias = "copy-to-product-windows"
@ -227,8 +235,9 @@ script = [
cd appflowy_flutter
flutter clean
flutter pub get
flutter packages pub get
cd ../
sh scripts/code_generation/generate.sh
sh scripts/code_generation/generate.sh -s
"""
]
@ -239,6 +248,7 @@ script = [
cd ./appflowy_flutter/
exec cmd.exe /c flutter clean
exec cmd.exe /c flutter pub get
exec cmd.exe /c flutter packages pub get
cd ../
exec scripts/code_generation/generate.cmd
""",

View File

@ -36,6 +36,31 @@ cd appflowy_flutter
flutter test --dart-define=RUST_LOG=${RUST_LOG} -j, --concurrency=1 --coverage
'''
[tasks.dart_unit_test_no_build]
script = '''
cargo make --profile test-macos-$(uname -m) run_dart_unit_test_no_build
'''
[tasks.dart_unit_test_no_build.windows]
script = '''
cargo make --profile test-windows run_dart_unit_test_no_build
'''
[tasks.dart_unit_test_no_build.linux]
script = '''
cargo make --profile test-linux run_dart_unit_test_no_build
'''
[tasks.run_dart_unit_test_no_build]
env = { RUST_LOG = "info" }
dependencies = ["copy-from-build-to-sandbox-folder"]
description = "Run flutter unit tests"
script = '''
cd appflowy_flutter
flutter test --dart-define=RUST_LOG=${RUST_LOG} -j, --concurrency=1 --coverage
'''
script_runner = "@shell"
[tasks.rust_unit_test]
run_task = { name = ["rust_lib_unit_test", "shared_lib_unit_test"] }
@ -323,4 +348,49 @@ script = [
${dest}
""",
]
script_runner = "@duckscript"
script_runner = "@duckscript"
[tasks.copy-from-build-to-sandbox-folder]
mac_alias = "copy-from-build-to-sandbox-folder-macos"
windows_alias = "copy-from-build-to-sandbox-folder-windows"
linux_alias = "copy-from-build-to-sandbox-folder-linux"
[tasks.copy-from-build-to-sandbox-folder-windows]
private = true
script = [
"""
# Copy the appflowy_backend lib to system temp directory for flutter unit test.
lib = set ${LIB_NAME}.${TEST_LIB_EXT}
dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib}
dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/windows/flutter/dart_ffi
rm ${dest}
cp ${dart_ffi_dir}/${lib} ${dest}
""",
]
script_runner = "@duckscript"
[tasks.copy-from-build-to-sandbox-folder-macos]
private = true
script = [
"""
echo "This is not possible for mac because the tests wont work with .a lib"
exit 127
""",
]
script_runner = "@duckscript"
[tasks.copy-from-build-to-sandbox-folder-linux]
private = true
script = [
"""
# Copy the appflowy_backend lib to system temp directory for flutter unit test.
lib = set lib${LIB_NAME}.${TEST_LIB_EXT}
dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib}
dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/linux/flutter/dart_ffi
rm ${dest}
cp ${dart_ffi_dir}/${lib} ${dest}
""",
]
script_runner = "@duckscript"