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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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