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

@ -22,15 +22,17 @@ on:
- "!frontend/appflowy_tauri/**" - "!frontend/appflowy_tauri/**"
env: env:
CARGO_TERM_COLOR: always
FLUTTER_VERSION: "3.10.1" FLUTTER_VERSION: "3.10.1"
RUST_TOOLCHAIN: "1.70" RUST_TOOLCHAIN: "1.70"
CARGO_MAKE_VERSION: "0.36.6"
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
build: prepare:
if: github.event.pull_request.draft != true if: github.event.pull_request.draft != true
strategy: strategy:
fail-fast: false fail-fast: false
@ -83,21 +85,20 @@ jobs:
prefix-key: ${{ matrix.os }} prefix-key: ${{ matrix.os }}
workspaces: | workspaces: |
frontend/rust-lib frontend/rust-lib
cache-all-crates: true
- uses: davidB/rust-cargo-make@v1 - uses: taiki-e/install-action@v2
with: with:
version: '0.36.6' tool: cargo-make@${{ env.CARGO_MAKE_VERSION }}, duckscript_cli
- name: Install prerequisites - name: Install prerequisites
working-directory: frontend working-directory: frontend
run: | run: |
cargo install --force duckscript_cli
if [ "$RUNNER_OS" == "Linux" ]; then 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/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 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 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 -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev
sudo apt-get install keybinder-3.0 libnotify-dev
elif [ "$RUNNER_OS" == "Windows" ]; then elif [ "$RUNNER_OS" == "Windows" ]; then
vcpkg integrate install vcpkg integrate install
elif [ "$RUNNER_OS" == "macOS" ]; then elif [ "$RUNNER_OS" == "macOS" ]; then
@ -106,32 +107,104 @@ jobs:
cargo make appflowy-flutter-deps-tools cargo make appflowy-flutter-deps-tools
shell: bash 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
- name: Build AppFlowy - name: Build AppFlowy
working-directory: frontend working-directory: frontend
run: | run: |
cargo make --profile ${{ matrix.flutter_profile }} appflowy-dev cargo make --profile ${{ matrix.flutter_profile }} appflowy-core-dev
- name: Run code generation
working-directory: frontend
run: |
cargo make code_generation
- name: Flutter Analyzer - name: Flutter Analyzer
working-directory: frontend/appflowy_flutter working-directory: frontend/appflowy_flutter
run: | run: |
flutter analyze . 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 - name: Run Flutter unit tests
working-directory: frontend working-directory: frontend
run: | run: |
if [ "$RUNNER_OS" == "macOS" ]; then
cargo make dart_unit_test cargo make dart_unit_test
else
cargo make dart_unit_test_no_build
fi
shell: bash
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: Wandalen/wretry.action@v1.0.36 uses: Wandalen/wretry.action@v1.0.36
@ -147,3 +220,193 @@ jobs:
attempt_limit: 20 attempt_limit: 20
attempt_delay: 10000 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
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: Run Flutter integration tests
working-directory: frontend/appflowy_flutter
run: |
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/wretry.action@v1.0.36
with:
action: codecov/codecov-action@v3
with: |
name: appflowy
flags: appflowy_flutter_integrateion_test
fail_ci_if_error: true
verbose: true
os: ${{ matrix.os }}
token: ${{ secrets.CODECOV_TOKEN }}
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

View File

@ -0,0 +1 @@
use_precompiled_binaries: true

View File

@ -20,7 +20,8 @@ DynamicLibrary _open() {
return DynamicLibrary.open('${prefix}/libdart_ffi.so'); return DynamicLibrary.open('${prefix}/libdart_ffi.so');
if (Platform.isMacOS) if (Platform.isMacOS)
return DynamicLibrary.open('${prefix}/libdart_ffi.dylib'); 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) if (Platform.isWindows)
return DynamicLibrary.open('${prefix}/dart_ffi.dll'); return DynamicLibrary.open('${prefix}/dart_ffi.dll');
} else { } else {

View File

@ -749,18 +749,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: irondash_engine_context name: irondash_engine_context
sha256: "6431b11844472574a90803c02f1e55221e6a390a872786735f6757a67dacd678" sha256: "559d4f156ba4d9a33c48185a1d7d5e887083bb601b0b130180d0aae3c1449338"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.0" version: "0.4.0-dev.2"
irondash_message_channel: irondash_message_channel:
dependency: transitive dependency: transitive
description: description:
name: irondash_message_channel name: irondash_message_channel
sha256: "4114739083d1c63e6a1a8b93f09dd69b3cf9a9d6ee215ae7f23079307197ebba" sha256: "500daa1fbe679f7d28a5258df3ff47dab6de352e680dc93c1ca9eae1555d8db5"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.0" version: "0.3.1"
isolates: isolates:
dependency: transitive dependency: transitive
description: description:
@ -1507,18 +1507,18 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: super_clipboard name: super_clipboard
sha256: ba484eb42ce621b69241d18d2a8494109589e8796eb6a3399e6c8f9cdaab8303 sha256: "80f7f42e9778101d77e930dcd9206cf72a1d8b696b3cbc1e3f9cbeb71ac4cde7"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.3" version: "0.7.0-dev.5"
super_native_extensions: super_native_extensions:
dependency: transitive dependency: transitive
description: description:
name: super_native_extensions name: super_native_extensions
sha256: dfe0a1c74430db946be973878da3f8611b8f124137f1dcbdf883e4605db40bd8 sha256: e3903ee807e82a930288811cf1b31a0dee30378bb544f30e3ea58d0ed2f884f2
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.3" version: "0.7.0-dev.5"
sync_http: sync_http:
dependency: transitive dependency: transitive
description: description:

View File

@ -106,7 +106,7 @@ dependencies:
url_protocol: url_protocol:
hive: ^2.2.3 hive: ^2.2.3
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0
super_clipboard: ^0.6.3 super_clipboard: ^0.7.0-dev.4
go_router: ^10.1.2 go_router: ^10.1.2
string_validator: ^1.0.0 string_validator: ^1.0.0
unsplash_client: ^2.1.1 unsplash_client: ^2.1.1

View File

@ -3434,9 +3434,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "openssl-src" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd2c101a165fff9935e34def4669595ab1c7847943c42be86e21503e482be107" checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491"
dependencies = [ dependencies = [
"cc", "cc",
] ]

View File

@ -23,7 +23,6 @@ error-chain = "=0.12.0"
openssl = { version = "0.10.45", optional = true, features = ["vendored"] } openssl = { version = "0.10.45", optional = true, features = ["vendored"] }
openssl-sys = { version = "0.9.80", optional = true, features = ["vendored"] } openssl-sys = { version = "0.9.80", optional = true, features = ["vendored"] }
[dev-dependencies] [dev-dependencies]
tempfile = "3.5.0" tempfile = "3.5.0"

View File

@ -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%"

View File

@ -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"

View File

@ -15,7 +15,7 @@ REM the appflowy_flutter/assets/translation directory
echo Copying resources/flowy_icons to appflowy_flutter/assets/flowy_icons echo Copying resources/flowy_icons to appflowy_flutter/assets/flowy_icons
xcopy /E /Y /I ..\resources\flowy_icons 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 echo Generating FlowySvg class
call dart run flowy_svg call dart run flowy_svg

View File

@ -1,5 +1,13 @@
#!/bin/bash #!/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" echo "Generating flowy icon files"
# Store the current working directory # Store the current working directory
@ -14,7 +22,9 @@ rm -rf assets/flowy_icons/
mkdir -p assets/flowy_icons/ mkdir -p assets/flowy_icons/
rsync -r ../resources/flowy_icons/ assets/flowy_icons/ rsync -r ../resources/flowy_icons/ assets/flowy_icons/
if [ "$no_pub_get" = false ]; then
flutter packages pub get flutter packages pub get
fi
echo "Generating FlowySvg classes" echo "Generating FlowySvg classes"
dart run flowy_svg dart run flowy_svg

View File

@ -11,7 +11,8 @@ cd ..\..\..\appflowy_flutter
REM Navigate to the appflowy_flutter directory and generate files REM Navigate to the appflowy_flutter directory and generate files
echo Generating files for appflowy_flutter 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 Done generating files for appflowy_flutter
echo Generating files for packages echo Generating files for packages
@ -24,7 +25,7 @@ for /D %%d in (*) do (
if exist "pubspec.yaml" ( if exist "pubspec.yaml" (
echo Generating freezed files in %%d... echo Generating freezed files in %%d...
echo Please wait while we clean the project and fetch the dependencies. 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 echo Done running build command in %%d
) else ( ) else (
echo No pubspec.yaml found in %%d, it can't be a Dart project. Skipping. echo No pubspec.yaml found in %%d, it can't be a Dart project. Skipping.

View File

@ -1,5 +1,13 @@
#!/bin/bash #!/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 # Store the current working directory
original_dir=$(pwd) original_dir=$(pwd)
@ -10,9 +18,12 @@ cd ../../../appflowy_flutter
# Navigate to the appflowy_flutter directory and generate files # Navigate to the appflowy_flutter directory and generate files
echo "Generating files for appflowy_flutter" 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 &&
if [ "$no_pub_get" = false ]; then
flutter packages pub get >/dev/null 2>&1 flutter packages pub get >/dev/null 2>&1
dart run build_runner build -d fi
dart run build_runner clean && dart run build_runner build -d
echo "Done generating files for appflowy_flutter" echo "Done generating files for appflowy_flutter"
echo "Generating files for packages" echo "Generating files for packages"
@ -25,8 +36,10 @@ for d in */; do
if [ -f "pubspec.yaml" ]; then if [ -f "pubspec.yaml" ]; then
echo "Generating freezed files in $d..." echo "Generating freezed files in $d..."
echo "Please wait while we clean the project and fetch the dependencies." 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 flutter packages pub get >/dev/null 2>&1
dart run build_runner build -d fi
dart run build_runner clean && dart run build_runner build -d
echo "Done running build command in $d" echo "Done running build command in $d"
else else
echo "No pubspec.yaml found in $d, it can\'t be a Dart project. Skipping." echo "No pubspec.yaml found in $d, it can\'t be a Dart project. Skipping."

View File

@ -26,15 +26,6 @@ call generate_freezed.cmd %*
REM Return to the main script directory REM Return to the main script directory
cd .. 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 echo Generating svg files using flowy_svg
cd flowy_icons cd flowy_icons
REM Allow execution permissions on CI REM Allow execution permissions on CI

View File

@ -26,15 +26,6 @@ chmod +x ./generate_freezed.sh
# Return to the main script directory # Return to the main script directory
cd .. 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" echo "Generating svg files using flowy_svg"
cd flowy_icons cd flowy_icons
# Allow execution permissions on CI # Allow execution permissions on CI

View File

@ -15,7 +15,7 @@ REM the appflowy_flutter/assets/translation directory
echo Copying resources/translations to appflowy_flutter/assets/translations echo Copying resources/translations to appflowy_flutter/assets/translations
xcopy /E /Y /I ..\resources\translations 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. echo Specifying source directory for AppFlowy Localizations.
call dart run easy_localization:generate -S assets/translations/ call dart run easy_localization:generate -S assets/translations/

View File

@ -1,5 +1,13 @@
#!/bin/bash #!/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" echo "Generating language files"
# Store the current working directory # Store the current working directory
@ -16,7 +24,9 @@ rm -rf assets/translations/
mkdir -p assets/translations/ mkdir -p assets/translations/
cp -f ../resources/translations/*.json assets/translations/ cp -f ../resources/translations/*.json assets/translations/
if [ "$no_pub_get" = false ]; then
flutter packages pub get flutter packages pub get
fi
echo "Specifying source directory for AppFlowy Localizations." echo "Specifying source directory for AppFlowy Localizations."
dart run easy_localization:generate -S assets/translations/ dart run easy_localization:generate -S assets/translations/

View File

@ -47,8 +47,10 @@ RUN flutter doctor
RUN dart pub global activate protoc_plugin 20.0.1 RUN dart pub global activate protoc_plugin 20.0.1
# Install build dependencies for AppFlowy # Install build dependencies for AppFlowy
RUN sudo pacman -S --noconfirm git libkeybinder3 sqlite clang rsync libnotify RUN yay -S --noconfirm jemalloc4 cargo-make cargo-binstall
RUN source ~/.cargo/env && cargo install --force cargo-make duckscript_cli 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 # Build AppFlowy
COPY . /appflowy COPY . /appflowy
@ -58,7 +60,7 @@ RUN cd frontend && \
source ~/.cargo/env && \ source ~/.cargo/env && \
cargo make appflowy-flutter-deps-tools && \ cargo make appflowy-flutter-deps-tools && \
cargo make flutter_clean && \ 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
#================ #================

View File

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