Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

ci: reduce build time (#3519)

Mohammad Zolfaghari25a98cda81c1
diff --git a/.github/workflows/flutter_ci.yaml b/.github/workflows/flutter_ci.yaml
index 72e169ca70..4d931a1fbe 100644
--- a/.github/workflows/flutter_ci.yaml
+++ b/.github/workflows/flutter_ci.yaml
@@ -22,15 +22,17 @@ on:
- "!frontend/appflowy_tauri/**"
env:
+ CARGO_TERM_COLOR: always
FLUTTER_VERSION: "3.10.1"
RUST_TOOLCHAIN: "1.70"
+ CARGO_MAKE_VERSION: "0.36.6"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
- build:
+ prepare:
if: github.event.pull_request.draft != true
strategy:
fail-fast: false
@@ -83,21 +85,20 @@ jobs:
prefix-key: ${{ matrix.os }}
workspaces: |
frontend/rust-lib
+ cache-all-crates: true
- - uses: davidB/rust-cargo-make@v1
+ - uses: taiki-e/install-action@v2
with:
- version: '0.36.6'
+ tool: cargo-make@${{ env.CARGO_MAKE_VERSION }}, duckscript_cli
- name: Install prerequisites
working-directory: frontend
run: |
- cargo install --force duckscript_cli
if [ "$RUNNER_OS" == "Linux" ]; then
sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
sudo apt-get update
- sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
- sudo apt-get install keybinder-3.0 libnotify-dev
+ sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev
elif [ "$RUNNER_OS" == "Windows" ]; then
vcpkg integrate install
elif [ "$RUNNER_OS" == "macOS" ]; then
@@ -106,6 +107,171 @@ jobs:
cargo make appflowy-flutter-deps-tools
shell: bash
+ - name: Build AppFlowy
+ working-directory: frontend
+ run: |
+ cargo make --profile ${{ matrix.flutter_profile }} appflowy-core-dev
+
+ - name: Run code generation
+ working-directory: frontend
+ run: |
+ cargo make code_generation
+
+ - name: Flutter Analyzer
+ working-directory: frontend/appflowy_flutter
+ run: |
+ flutter analyze .
+
+ - name: Compress appflowy_flutter
+ run: tar -czf appflowy_flutter.tar.gz frontend/appflowy_flutter
+
+ - uses: actions/upload-artifact@v3
+ with:
+ name: ${{ github.run_id }}-${{ matrix.os }}
+ path: appflowy_flutter.tar.gz
+
+ unit_test:
+ needs: [prepare]
+ if: github.event.pull_request.draft != true
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ include:
+ - os: ubuntu-latest
+ flutter_profile: development-linux-x86_64
+ target: x86_64-unknown-linux-gnu
+ - os: macos-latest
+ flutter_profile: development-mac-x86_64
+ target: x86_64-apple-darwin
+ - os: windows-latest
+ flutter_profile: development-windows-x86
+ target: x86_64-pc-windows-msvc
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - name: Checkout source code
+ uses: actions/checkout@v2
+
+ - name: Install Rust toolchain
+ id: rust_toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ env.RUST_TOOLCHAIN }}
+ target: ${{ matrix.target }}
+ override: true
+ profile: minimal
+
+ - name: Install flutter
+ id: flutter
+ uses: subosito/flutter-action@v2
+ with:
+ channel: "stable"
+ flutter-version: ${{ env.FLUTTER_VERSION }}
+ cache: true
+
+ - uses: Swatinem/rust-cache@v2
+ with:
+ prefix-key: ${{ matrix.os }}
+ workspaces: |
+ frontend/rust-lib
+ cache-all-crates: true
+
+ - uses: taiki-e/install-action@v2
+ with:
+ tool: cargo-make@${{ env.CARGO_MAKE_VERSION }}, duckscript_cli
+
+ - name: Install prerequisites
+ working-directory: frontend
+ run: |
+ if [ "$RUNNER_OS" == "macOS" ]; then
+ cargo make appflowy-flutter-deps-tools
+ fi
+ shell: bash
+
+ - uses: actions/download-artifact@v3
+ with:
+ name: ${{ github.run_id }}-${{ matrix.os }}
+
+ - name: Uncompress appflowy_flutter
+ run: tar -xf appflowy_flutter.tar.gz
+
+ - name: Run Flutter unit tests
+ working-directory: frontend
+ run: |
+ if [ "$RUNNER_OS" == "macOS" ]; then
+ cargo make dart_unit_test
+ else
+ cargo make dart_unit_test_no_build
+ fi
+ shell: bash
+
+ - name: Upload coverage to Codecov
+ uses: Wandalen/[email protected]
+ with:
+ action: codecov/codecov-action@v3
+ with: |
+ name: appflowy
+ flags: appflowy_flutter_unit_test
+ fail_ci_if_error: true
+ verbose: true
+ os: ${{ matrix.os }}
+ token: ${{ secrets.CODECOV_TOKEN }}
+ attempt_limit: 20
+ attempt_delay: 10000
+
+ integration_test:
+ needs: [prepare]
+ if: github.event.pull_request.draft != true
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest,windows-latest]
+ include:
+ - os: ubuntu-latest
+ flutter_profile: development-linux-x86_64
+ target: x86_64-unknown-linux-gnu
+ - os: windows-latest
+ flutter_profile: development-windows-x86
+ target: x86_64-pc-windows-msvc
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - name: Checkout source code
+ uses: actions/checkout@v2
+
+ - name: Install Rust toolchain
+ id: rust_toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ env.RUST_TOOLCHAIN }}
+ target: ${{ matrix.target }}
+ override: true
+ profile: minimal
+
+ - name: Install flutter
+ id: flutter
+ uses: subosito/flutter-action@v2
+ with:
+ channel: "stable"
+ flutter-version: ${{ env.FLUTTER_VERSION }}
+ cache: true
+
+ - uses: taiki-e/install-action@v2
+ with:
+ tool: cargo-make@${{ env.CARGO_MAKE_VERSION }}
+
+ - name: Install prerequisites
+ working-directory: frontend
+ run: |
+ if [ "$RUNNER_OS" == "Linux" ]; then
+ sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
+ sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
+ sudo apt-get update
+ sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev
+ fi
+ shell: bash
+
- name: Enable Flutter Desktop
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
@@ -118,20 +284,33 @@ jobs:
fi
shell: bash
- - name: Build AppFlowy
+ - uses: actions/download-artifact@v3
+ with:
+ name: ${{ github.run_id }}-${{ matrix.os }}
+
+ - name: Uncompress appflowy_flutter
+ run: tar -xf appflowy_flutter.tar.gz
+
+ - name: Run code generation
+ if: matrix.os == 'windows-latest'
working-directory: frontend
run: |
- cargo make --profile ${{ matrix.flutter_profile }} appflowy-dev
+ cargo make code_generation
- - name: Flutter Analyzer
+ - name: Run Flutter integration tests
working-directory: frontend/appflowy_flutter
run: |
- flutter analyze .
-
- - name: Run Flutter unit tests
- working-directory: frontend
- run: |
- cargo make dart_unit_test
+ if [ "$RUNNER_OS" == "Linux" ]; then
+ export DISPLAY=:99
+ sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
+ sudo apt-get install network-manager
+ flutter test integration_test/runner.dart -d Linux --coverage
+ elif [ "$RUNNER_OS" == "macOS" ]; then
+ flutter test integration_test/runner.dart -d macOS --coverage
+ elif [ "$RUNNER_OS" == "Windows" ]; then
+ flutter test integration_test/runner.dart -d Windows --coverage
+ fi
+ shell: bash
- name: Upload coverage to Codecov
uses: Wandalen/[email protected]
@@ -139,7 +318,7 @@ jobs:
action: codecov/codecov-action@v3
with: |
name: appflowy
- flags: appflowy_flutter_unit_test
+ flags: appflowy_flutter_integrateion_test
fail_ci_if_error: true
verbose: true
os: ${{ matrix.os }}
@@ -147,3 +326,87 @@ jobs:
attempt_limit: 20
attempt_delay: 10000
+ build:
+ needs: [prepare]
+ if: github.event.pull_request.draft != true
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ include:
+ - os: ubuntu-latest
+ flutter_profile: development-linux-x86_64
+ target: x86_64-unknown-linux-gnu
+ - os: macos-latest
+ flutter_profile: development-mac-x86_64
+ target: x86_64-apple-darwin
+ - os: windows-latest
+ flutter_profile: development-windows-x86
+ target: x86_64-pc-windows-msvc
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - name: Checkout source code
+ uses: actions/checkout@v2
+
+ - name: Install Rust toolchain
+ id: rust_toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ env.RUST_TOOLCHAIN }}
+ target: ${{ matrix.target }}
+ override: true
+ profile: minimal
+
+ - name: Install flutter
+ id: flutter
+ uses: subosito/flutter-action@v2
+ with:
+ channel: "stable"
+ flutter-version: ${{ env.FLUTTER_VERSION }}
+ cache: true
+
+ - uses: taiki-e/install-action@v2
+ with:
+ tool: cargo-make@${{ env.CARGO_MAKE_VERSION }}
+
+ - name: Install prerequisites
+ working-directory: frontend
+ run: |
+ if [ "$RUNNER_OS" == "Linux" ]; then
+ sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
+ sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
+ sudo apt-get update
+ sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev
+ fi
+ shell: bash
+
+ - name: Enable Flutter Desktop
+ run: |
+ if [ "$RUNNER_OS" == "Linux" ]; then
+ flutter config --enable-linux-desktop
+ elif [ "$RUNNER_OS" == "macOS" ]; then
+ flutter config --enable-macos-desktop
+ elif [ "$RUNNER_OS" == "Windows" ]; then
+ git config --system core.longpaths true
+ flutter config --enable-windows-desktop
+ fi
+ shell: bash
+
+ - uses: actions/download-artifact@v3
+ with:
+ name: ${{ github.run_id }}-${{ matrix.os }}
+
+ - name: Uncompress appflowy_flutter
+ run: tar -xf appflowy_flutter.tar.gz
+
+ - name: Run code generation
+ if: matrix.os == 'windows-latest'
+ working-directory: frontend
+ run: |
+ cargo make code_generation
+
+ - name: Build flutter product
+ working-directory: frontend
+ run: |
+ cargo make --profile ${{ matrix.flutter_profile }} appflowy-make-product-dev
diff --git a/frontend/appflowy_flutter/cargokit_options.yaml b/frontend/appflowy_flutter/cargokit_options.yaml
new file mode 100644
index 0000000000..70d10df337
--- /dev/null
+++ b/frontend/appflowy_flutter/cargokit_options.yaml
@@ -0,0 +1 @@
+use_precompiled_binaries: true
diff --git a/frontend/appflowy_flutter/packages/appflowy_backend/lib/ffi.dart b/frontend/appflowy_flutter/packages/appflowy_backend/lib/ffi.dart
index 9d4e17cca1..fef155d2ce 100644
--- a/frontend/appflowy_flutter/packages/appflowy_backend/lib/ffi.dart
+++ b/frontend/appflowy_flutter/packages/appflowy_backend/lib/ffi.dart
@@ -20,7 +20,8 @@ DynamicLibrary _open() {
return DynamicLibrary.open('${prefix}/libdart_ffi.so');
if (Platform.isMacOS)
return DynamicLibrary.open('${prefix}/libdart_ffi.dylib');
- if (Platform.isIOS) return DynamicLibrary.open('${prefix}/libdart_ffi.a');
+ if (Platform.isIOS)
+ return DynamicLibrary.open('${prefix}/libdart_ffi.a');
if (Platform.isWindows)
return DynamicLibrary.open('${prefix}/dart_ffi.dll');
} else {
diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lock
index 6e1359128b..a951b44778 100644
--- a/frontend/appflowy_flutter/pubspec.lock
+++ b/frontend/appflowy_flutter/pubspec.lock
@@ -749,18 +749,18 @@ packages:
dependency: transitive
description:
name: irondash_engine_context
- sha256: "6431b11844472574a90803c02f1e55221e6a390a872786735f6757a67dacd678"
+ sha256: "559d4f156ba4d9a33c48185a1d7d5e887083bb601b0b130180d0aae3c1449338"
url: "https://pub.dev"
source: hosted
- version: "0.3.0"
+ version: "0.4.0-dev.2"
irondash_message_channel:
dependency: transitive
description:
name: irondash_message_channel
- sha256: "4114739083d1c63e6a1a8b93f09dd69b3cf9a9d6ee215ae7f23079307197ebba"
+ sha256: "500daa1fbe679f7d28a5258df3ff47dab6de352e680dc93c1ca9eae1555d8db5"
url: "https://pub.dev"
source: hosted
- version: "0.3.0"
+ version: "0.3.1"
isolates:
dependency: transitive
description:
@@ -1507,18 +1507,18 @@ packages:
dependency: "direct main"
description:
name: super_clipboard
- sha256: ba484eb42ce621b69241d18d2a8494109589e8796eb6a3399e6c8f9cdaab8303
+ sha256: "80f7f42e9778101d77e930dcd9206cf72a1d8b696b3cbc1e3f9cbeb71ac4cde7"
url: "https://pub.dev"
source: hosted
- version: "0.6.3"
+ version: "0.7.0-dev.5"
super_native_extensions:
dependency: transitive
description:
name: super_native_extensions
- sha256: dfe0a1c74430db946be973878da3f8611b8f124137f1dcbdf883e4605db40bd8
+ sha256: e3903ee807e82a930288811cf1b31a0dee30378bb544f30e3ea58d0ed2f884f2
url: "https://pub.dev"
source: hosted
- version: "0.6.3"
+ version: "0.7.0-dev.5"
sync_http:
dependency: transitive
description:
diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yaml
index 7b371bf66d..dcb81df99f 100644
--- a/frontend/appflowy_flutter/pubspec.yaml
+++ b/frontend/appflowy_flutter/pubspec.yaml
@@ -106,7 +106,7 @@ dependencies:
url_protocol:
hive: ^2.2.3
hive_flutter: ^1.1.0
- super_clipboard: ^0.6.3
+ super_clipboard: ^0.7.0-dev.4
go_router: ^10.1.2
string_validator: ^1.0.0
unsplash_client: ^2.1.1
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index c2d899112a..1f7b9ad436 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -3434,9 +3434,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
-version = "300.1.3+3.1.2"
+version = "300.1.5+3.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd2c101a165fff9935e34def4669595ab1c7847943c42be86e21503e482be107"
+checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491"
dependencies = [
"cc",
]
diff --git a/frontend/rust-lib/flowy-server/Cargo.toml b/frontend/rust-lib/flowy-server/Cargo.toml
index 82a79bd89e..45b2b13d49 100644
--- a/frontend/rust-lib/flowy-server/Cargo.toml
+++ b/frontend/rust-lib/flowy-server/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2021"
tracing = { version = "0.1" }
futures = "0.3.26"
futures-util = "0.3.26"
-reqwest = { version = "0.11.20", features = ["native-tls-vendored", "multipart","blocking"] }
+reqwest = { version = "0.11.20", features = ["native-tls-vendored", "multipart", "blocking"] }
hyper = "0.14"
config = { version = "0.10.1", default-features = false, features = ["yaml"] }
serde = { version = "1.0", features = ["derive"] }
diff --git a/frontend/rust-lib/flowy-sqlite/Cargo.toml b/frontend/rust-lib/flowy-sqlite/Cargo.toml
index 81727f8e6e..810be10065 100644
--- a/frontend/rust-lib/flowy-sqlite/Cargo.toml
+++ b/frontend/rust-lib/flowy-sqlite/Cargo.toml
@@ -23,7 +23,6 @@ error-chain = "=0.12.0"
openssl = { version = "0.10.45", optional = true, features = ["vendored"] }
openssl-sys = { version = "0.9.80", optional = true, features = ["vendored"] }
-
[dev-dependencies]
tempfile = "3.5.0"
diff --git a/frontend/scripts/code_generation/env/generate_env.cmd b/frontend/scripts/code_generation/env/generate_env.cmd
deleted file mode 100644
index d15d078ddd..0000000000
--- a/frontend/scripts/code_generation/env/generate_env.cmd
+++ /dev/null
@@ -1,17 +0,0 @@
-@echo off
-
-REM Store the current working directory
-set "original_dir=%CD%"
-
-REM Change the current working directory to the script's location
-cd /d "%~dp0"
-
-REM Navigate to the project root
-cd ..\..\..\appflowy_flutter
-
-REM Navigate to the appflowy_flutter directory and generate files
-echo Generating env files
-call flutter packages pub get >nul 2>&1 && call dart run build_runner clean && call dart run build_runner build --delete-conflicting-outputs
-echo Done generating env files
-
-cd /d "%original_dir%"
diff --git a/frontend/scripts/code_generation/env/generate_env.sh b/frontend/scripts/code_generation/env/generate_env.sh
deleted file mode 100755
index fcadc3b252..0000000000
--- a/frontend/scripts/code_generation/env/generate_env.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-# Store the current working directory
-original_dir=$(pwd)
-
-cd "$(dirname "$0")"
-
-# Navigate to the project root
-cd ../../../appflowy_flutter
-
-# Navigate to the appflowy_flutter directory and generate files
-echo "Generating env files"
-# flutter clean >/dev/null 2>&1 && flutter packages pub get >/dev/null 2>&1 && dart run build_runner clean &&
-flutter packages pub get >/dev/null 2>&1
-dart run build_runner clean && dart run build_runner build --delete-conflicting-outputs
-echo "Done generating env files"
-
-# Return to the original directory
-cd "$original_dir"
diff --git a/frontend/scripts/code_generation/flowy_icons/generate_flowy_icons.cmd b/frontend/scripts/code_generation/flowy_icons/generate_flowy_icons.cmd
index d7ada3b641..72cdd54cae 100644
--- a/frontend/scripts/code_generation/flowy_icons/generate_flowy_icons.cmd
+++ b/frontend/scripts/code_generation/flowy_icons/generate_flowy_icons.cmd
@@ -15,7 +15,7 @@ REM the appflowy_flutter/assets/translation directory
echo Copying resources/flowy_icons to appflowy_flutter/assets/flowy_icons
xcopy /E /Y /I ..\resources\flowy_icons assets\flowy_icons
-call flutter packages pub get
+REM call flutter packages pub get
echo Generating FlowySvg class
call dart run flowy_svg
diff --git a/frontend/scripts/code_generation/flowy_icons/generate_flowy_icons.sh b/frontend/scripts/code_generation/flowy_icons/generate_flowy_icons.sh
index fb6eee67c6..f969e49f44 100755
--- a/frontend/scripts/code_generation/flowy_icons/generate_flowy_icons.sh
+++ b/frontend/scripts/code_generation/flowy_icons/generate_flowy_icons.sh
@@ -1,5 +1,13 @@
#!/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
@@ -14,7 +22,9 @@ rm -rf assets/flowy_icons/
mkdir -p assets/flowy_icons/
rsync -r ../resources/flowy_icons/ assets/flowy_icons/
-flutter packages pub get
+if [ "$no_pub_get" = false ]; then
+ flutter packages pub get
+fi
echo "Generating FlowySvg classes"
dart run flowy_svg
diff --git a/frontend/scripts/code_generation/freezed/generate_freezed.cmd b/frontend/scripts/code_generation/freezed/generate_freezed.cmd
index 4b607948fa..64d7e8754e 100644
--- a/frontend/scripts/code_generation/freezed/generate_freezed.cmd
+++ b/frontend/scripts/code_generation/freezed/generate_freezed.cmd
@@ -11,7 +11,8 @@ cd ..\..\..\appflowy_flutter
REM Navigate to the appflowy_flutter directory and generate files
echo Generating files for appflowy_flutter
-call flutter clean >nul 2>&1 && call flutter packages pub get >nul 2>&1 && call dart run build_runner clean && call dart run build_runner build -d
+REM call flutter packages pub get
+call dart run build_runner clean && call dart run build_runner build -d
echo Done generating files for appflowy_flutter
echo Generating files for packages
@@ -24,7 +25,7 @@ for /D %%d in (*) do (
if exist "pubspec.yaml" (
echo Generating freezed files in %%d...
echo Please wait while we clean the project and fetch the dependencies.
- call flutter clean >nul 2>&1 && call flutter packages pub get >nul 2>&1 && call dart run build_runner clean && call dart run build_runner build -d
+ call dart run build_runner clean && call dart run build_runner build -d
echo Done running build command in %%d
) else (
echo No pubspec.yaml found in %%d, it can't be a Dart project. Skipping.
diff --git a/frontend/scripts/code_generation/freezed/generate_freezed.sh b/frontend/scripts/code_generation/freezed/generate_freezed.sh
index 01f578d3dc..24e4e55fa3 100755
--- a/frontend/scripts/code_generation/freezed/generate_freezed.sh
+++ b/frontend/scripts/code_generation/freezed/generate_freezed.sh
@@ -1,5 +1,13 @@
#!/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)
@@ -10,9 +18,12 @@ cd ../../../appflowy_flutter
# Navigate to the appflowy_flutter directory and generate files
echo "Generating files for appflowy_flutter"
-# flutter clean >/dev/null 2>&1 && flutter packages pub get >/dev/null 2>&1 && dart run build_runner clean &&
-flutter packages pub get >/dev/null 2>&1
-dart run build_runner build -d
+
+if [ "$no_pub_get" = false ]; then
+ flutter packages pub get >/dev/null 2>&1
+fi
+
+dart run build_runner clean && dart run build_runner build -d
echo "Done generating files for appflowy_flutter"
echo "Generating files for packages"
@@ -25,8 +36,10 @@ 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."
- flutter packages pub get >/dev/null 2>&1
- dart run build_runner build -d
+ if [ "$no_pub_get" = false ]; then
+ flutter packages pub get >/dev/null 2>&1
+ fi
+ dart run build_runner clean && dart run build_runner build -d
echo "Done running build command in $d"
else
echo "No pubspec.yaml found in $d, it can\'t be a Dart project. Skipping."
diff --git a/frontend/scripts/code_generation/generate.cmd b/frontend/scripts/code_generation/generate.cmd
index 1dc853d2a2..855c288ab3 100644
--- a/frontend/scripts/code_generation/generate.cmd
+++ b/frontend/scripts/code_generation/generate.cmd
@@ -26,15 +26,6 @@ call generate_freezed.cmd %*
REM Return to the main script directory
cd ..
-echo Generating env files using build_runner
-cd env
-REM Allow execution permissions on CI
-chmod +x generate_env.cmd
-call generate_env.cmd %*
-
-REM Return to the main script directory
-cd ..
-
echo Generating svg files using flowy_svg
cd flowy_icons
REM Allow execution permissions on CI
diff --git a/frontend/scripts/code_generation/generate.sh b/frontend/scripts/code_generation/generate.sh
index 567feddc7d..f71ceba2df 100755
--- a/frontend/scripts/code_generation/generate.sh
+++ b/frontend/scripts/code_generation/generate.sh
@@ -26,15 +26,6 @@ chmod +x ./generate_freezed.sh
# Return to the main script directory
cd ..
-echo "Generating env files using build_runner"
-cd env
-# Allow execution permissions on CI
-chmod +x ./generate_env.sh
-./generate_env.sh "$@"
-
-# Return to the main script directory
-cd ..
-
echo "Generating svg files using flowy_svg"
cd flowy_icons
# Allow execution permissions on CI
diff --git a/frontend/scripts/code_generation/language_files/generate_language_files.cmd b/frontend/scripts/code_generation/language_files/generate_language_files.cmd
index 470f1654e5..7b14503810 100644
--- a/frontend/scripts/code_generation/language_files/generate_language_files.cmd
+++ b/frontend/scripts/code_generation/language_files/generate_language_files.cmd
@@ -15,7 +15,7 @@ REM the appflowy_flutter/assets/translation directory
echo Copying resources/translations to appflowy_flutter/assets/translations
xcopy /E /Y /I ..\resources\translations assets\translations
-call flutter packages pub get
+REM call flutter packages pub get
echo Specifying source directory for AppFlowy Localizations.
call dart run easy_localization:generate -S assets/translations/
diff --git a/frontend/scripts/code_generation/language_files/generate_language_files.sh b/frontend/scripts/code_generation/language_files/generate_language_files.sh
index d93c88d1a3..03bf7a906a 100755
--- a/frontend/scripts/code_generation/language_files/generate_language_files.sh
+++ b/frontend/scripts/code_generation/language_files/generate_language_files.sh
@@ -1,5 +1,13 @@
#!/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
@@ -16,7 +24,9 @@ rm -rf assets/translations/
mkdir -p assets/translations/
cp -f ../resources/translations/*.json assets/translations/
-flutter packages pub get
+if [ "$no_pub_get" = false ]; then
+ flutter packages pub get
+fi
echo "Specifying source directory for AppFlowy Localizations."
dart run easy_localization:generate -S assets/translations/
diff --git a/frontend/scripts/docker-buildfiles/Dockerfile b/frontend/scripts/docker-buildfiles/Dockerfile
index d874ec7805..eecf5fd485 100644
--- a/frontend/scripts/docker-buildfiles/Dockerfile
+++ b/frontend/scripts/docker-buildfiles/Dockerfile
@@ -47,8 +47,10 @@ RUN flutter doctor
RUN dart pub global activate protoc_plugin 20.0.1
# Install build dependencies for AppFlowy
-RUN sudo pacman -S --noconfirm git libkeybinder3 sqlite clang rsync libnotify
-RUN source ~/.cargo/env && cargo install --force cargo-make duckscript_cli
+RUN yay -S --noconfirm jemalloc4 cargo-make cargo-binstall
+RUN sudo pacman -S --noconfirm git libkeybinder3 sqlite clang rsync libnotify rocksdb zstd
+RUN sudo ln -s /usr/bin/sha1sum /usr/bin/shasum
+RUN source ~/.cargo/env && cargo binstall duckscript_cli -y
# Build AppFlowy
COPY . /appflowy
@@ -58,7 +60,7 @@ RUN cd frontend && \
source ~/.cargo/env && \
cargo make appflowy-flutter-deps-tools && \
cargo make flutter_clean && \
- cargo make -p production-linux-x86_64 appflowy-linux
+ OPENSSL_STATIC=1 ZSTD_SYS_USE_PKG_CONFIG=1 ROCKSDB_LIB_DIR="/usr/lib/" cargo make -p production-linux-x86_64 appflowy-linux
#================
diff --git a/frontend/scripts/makefile/flutter.toml b/frontend/scripts/makefile/flutter.toml
index 8d0bd8cd6c..9f6b2a5369 100644
--- a/frontend/scripts/makefile/flutter.toml
+++ b/frontend/scripts/makefile/flutter.toml
@@ -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
""",
diff --git a/frontend/scripts/makefile/tests.toml b/frontend/scripts/makefile/tests.toml
index 0ce5b6f49c..ef06f98a90 100644
--- a/frontend/scripts/makefile/tests.toml
+++ b/frontend/scripts/makefile/tests.toml
@@ -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"
\ No newline at end of file
+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"