chore: add iOS integration test CI (#4822)

This commit is contained in:
Lucas.Xu
2024-03-05 17:20:27 +08:00
committed by GitHub
parent 2ec6250ddd
commit b05897d3ab
95 changed files with 520 additions and 357 deletions

View File

@ -1,13 +1,5 @@
#!/bin/bash
no_pub_get=false
while getopts 's' flag; do
case "${flag}" in
s) no_pub_get=true ;;
esac
done
echo "Generating flowy icon files"
# Store the current working directory

View File

@ -1,13 +1,5 @@
#!/bin/bash
no_pub_get=false
while getopts 's' flag; do
case "${flag}" in
s) no_pub_get=true ;;
esac
done
# Store the current working directory
original_dir=$(pwd)
@ -19,9 +11,7 @@ cd ../../../appflowy_flutter
# Navigate to the appflowy_flutter directory and generate files
echo "Generating files for appflowy_flutter"
if [ "$no_pub_get" = false ]; then
flutter packages pub get >/dev/null 2>&1
fi
flutter packages pub get >/dev/null 2>&1
dart run build_runner build -d
echo "Done generating files for appflowy_flutter"
@ -36,9 +26,7 @@ for d in */; do
if [ -f "pubspec.yaml" ]; then
echo "Generating freezed files in $d..."
echo "Please wait while we clean the project and fetch the dependencies."
if [ "$no_pub_get" = false ]; then
flutter packages pub get >/dev/null 2>&1
fi
flutter packages pub get >/dev/null 2>&1
dart run build_runner build -d
echo "Done running build command in $d"
else

View File

@ -1,13 +1,5 @@
#!/bin/bash
no_pub_get=false
while getopts 's' flag; do
case "${flag}" in
s) no_pub_get=true ;;
esac
done
echo "Generating language files"
# Store the current working directory
@ -24,6 +16,9 @@ rm -rf assets/translations/
mkdir -p assets/translations/
cp -f ../resources/translations/*.json assets/translations/
# the ci alwayas return a 'null check operator used on a null value' error.
# so we force to exec the below command to avoid the error.
# https://github.com/dart-lang/pub/issues/3314
flutter pub get
flutter packages pub get

View File

@ -82,10 +82,10 @@ run_task = { name = [
script_runner = "@shell"
[tasks.appflowy-android-dev-ci]
dependencies = ["appflowy-core-dev-android"]
dependencies = ["appflowy-core-dev-android-ci"]
run_task = { name = [
"code_generation",
"flutter-build-android",
"flutter-build-android-ci",
] }
script_runner = "@shell"

View File

@ -27,11 +27,11 @@ script = [
"""
cd rust-lib/
rustup show
if [ "${BUILD_FLAG}" == "debug" ]; then
echo "🚀 🚀 🚀 Building for debug"
if [ "${BUILD_FLAG}" = "debug" ]; then
echo "🚀 🚀 🚀 Building iOS SDK for debug"
cargo lipo --targets ${RUST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi
else
echo "🚀 🚀 🚀 Building for release"
echo "🚀 🚀 🚀 Building iOS SDK for release"
cargo lipo --release --targets ${RUST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi
fi
cd ../
@ -49,18 +49,28 @@ run_task = { name = [
"restore-crate-type",
] }
# only use in CI job
[tasks.appflowy-core-dev-android-ci]
category = "Build"
dependencies = ["env_check", "set-app-version"]
run_task = { name = [
"setup-crate-type",
"sdk-build-android-ci",
"post-mobile-android",
"restore-crate-type",
] }
[tasks.sdk-build-android]
dependencies = ["set-app-version"]
private = true
script = [
"""
cd rust-lib/
rustup show
if [ "${BUILD_FLAG}" = "debug" ]; then
echo "🚀 🚀 🚀 Building for debug"
cargo ndk -t arm64-v8a -t x86_64 -o ./jniLibs build --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi
echo "🚀 🚀 🚀 Building Android SDK for debug"
cargo ndk -t arm64-v8a -o ./jniLibs build --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi
else
echo "🚀 🚀 🚀 Building for release"
echo "🚀 🚀 🚀 Building Android SDK for release"
cargo ndk -t arm64-v8a -o ./jniLibs build --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi --release
fi
cd ../
@ -68,6 +78,19 @@ script = [
]
script_runner = "@shell"
# only use in CI job
[tasks.sdk-build-android-ci]
dependencies = ["set-app-version"]
private = true
script = [
"""
cd rust-lib/
cargo ndk -t arm64-v8a -o ./jniLibs build --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi
cd ../
""",
]
script_runner = "@shell"
[tasks.post-mobile-ios]
private = true
script = [
@ -76,6 +99,9 @@ script = [
dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/packages/appflowy_backend/${TARGET_OS}
lib = set lib${LIB_NAME}.${LIB_EXT}
ls -a ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}
echo "💻 💻 💻 Copying ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/${lib} to ${dart_ffi_dir}/${lib}"
rm -f ${dart_ffi_dir}/${lib}
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/${lib} \