This commit is contained in:
Dmitry 2025-11-27 19:43:33 +03:00
parent 0b2cd193a9
commit 276e35999b

View file

@ -279,7 +279,7 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/cirruslabs/flutter:3.35.5
options: --memory=1280m --memory-swap=2560m
options: --memory=2048m --memory-swap=4096m
needs: deploy-backend
if: always() && needs.deploy-backend.result == 'success'
steps:
@ -294,8 +294,8 @@ jobs:
apt-get install -y nodejs
echo "Node.js version: $(node --version)"
echo "NPM version: $(npm --version)"
# Set minimal Node.js memory limits for low-memory environment (256MB)
echo "NODE_OPTIONS=--max-old-space-size=256" >> $GITHUB_ENV || echo "NODE_OPTIONS=--max-old-space-size=256" >> ~/.bashrc || true
# Set Node.js memory limits for increased container memory (512MB)
echo "NODE_OPTIONS=--max-old-space-size=512" >> $GITHUB_ENV || echo "NODE_OPTIONS=--max-old-space-size=512" >> ~/.bashrc || true
- name: Setup SSH
run: |
@ -319,8 +319,8 @@ jobs:
- name: Build Web App
working-directory: mnemo_cards_web_v2
env:
# Ultra-aggressive memory optimization for low-memory environment
DART_VM_OPTIONS: "--old-gen-heap-size=512 --max-old-space-size=512 --gc-on-threshold --low-memory-mode --enable-isolate-groups --use-slow-path --no-lazy-dispatchers"
# Memory optimization for increased container limits
DART_VM_OPTIONS: "--old-gen-heap-size=1024 --max-old-space-size=1024 --gc-on-threshold --low-memory-mode --enable-isolate-groups --use-slow-path"
# Minimal Node.js memory
NODE_OPTIONS: "--max-old-space-size=256"
# Limit parallel compilation to reduce memory pressure
@ -382,45 +382,34 @@ jobs:
# Use HTML renderer instead of CanvasKit for better memory efficiency
export FLUTTER_WEB_USE_SKIA=false
echo "🔨 Собираем веб-приложение (оптимизировано для 1.5GB памяти)..."
echo "🔨 Собираем веб-приложение (оптимизировано для 2GB памяти)..."
# Use only profile mode - most memory efficient
echo "⚡ Используем profile mode (наиболее эффективный по памяти)..."
# Try multiple build modes from least to most memory intensive
echo "🔄 Пробуем разные режимы сборки по возрастанию сложности..."
export DART_VM_OPTIONS="$DART_VM_OPTIONS --gc-on-threshold --low-memory-mode --enable-isolate-groups --use-slow-path"
echo "🔧 Настройки памяти: $DART_VM_OPTIONS"
# First try debug mode (least memory intensive)
echo "🐛 Попытка 1: Debug mode..."
if timeout 1800 flutter build web --debug \
--dart-define=API_BASE_URL=https://api.mnemo-cards.online \
--no-tree-shake-icons \
--no-pub \
--suppress-analytics; then
echo "✅ Debug сборка успешна!"
else
echo "⚠️ Debug провалился, попытка 2: Profile mode..."
timeout 2400 bash -c '
# Monitor memory usage during build
(
while true; do
echo "$(date +%H:%M:%S) Memory: $(free -m | grep Mem: | awk '\''{printf "%.1fGB", $3/1024}'\'')" >> /tmp/memory.log
sleep 10
done
) &
MONITOR_PID=$!
# Build with profile mode - much less memory intensive than release
flutter build web --profile \
# Try profile mode
if timeout 2400 flutter build web --profile \
--dart-define=API_BASE_URL=https://api.mnemo-cards.online \
--no-tree-shake-icons \
--no-pub \
--suppress-analytics
BUILD_RESULT=$?
kill $MONITOR_PID 2>/dev/null || true
if [ $BUILD_RESULT -eq 0 ]; then
--suppress-analytics; then
echo "✅ Profile сборка успешна!"
echo "📊 Лог использования памяти:"
cat /tmp/memory.log || true
else
echo "❌ Profile сборка провалилась!"
echo "📊 Лог использования памяти:"
cat /tmp/memory.log || true
echo "❌ Все режимы сборки провалились!"
exit 1
fi
' || (echo "❌ Сборка провалилась!" && exit 1)
fi
echo "✅ Сборка завершена"