This commit is contained in:
Dmitry 2025-11-23 04:17:24 +03:00
parent e3e3e198a4
commit ff2d48b80c

View file

@ -276,40 +276,27 @@ jobs:
git config --global http.maxRequestBuffer 100M git config --global http.maxRequestBuffer 100M
git config --global core.compression 0 git config --global core.compression 0
- name: Setup Swap for Build
run: |
echo "💾 Setting up swap for Flutter build..."
# Install swap utilities if not available
apt-get update && apt-get install -y util-linux || true
# Check if swap already exists
if swapon --show 2>/dev/null | grep -q "/swapfile"; then
echo "✅ Swap already exists"
swapon --show || true
else
echo "📦 Creating 2GB swap file..."
# Create 2GB swap file (use dd as fallback if fallocate fails)
fallocate -l 2G /swapfile 2>/dev/null || dd if=/dev/zero of=/swapfile bs=1M count=2048 2>/dev/null
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "✅ Swap file created and activated"
swapon --show || true
fi
# Show current memory and swap status
free -h
- name: Build Web App - name: Build Web App
working-directory: mnemo_cards_web_v2 working-directory: mnemo_cards_web_v2
run: | run: |
echo "🔍 Проверяем Flutter..." echo "🔍 Проверяем Flutter..."
which flutter || echo "Flutter not found in PATH" which flutter || echo "Flutter not found in PATH"
flutter --version || echo "Flutter command failed" flutter --version || echo "Flutter command failed"
echo "🧹 Очищаем кэш для экономии памяти..."
flutter clean || true
echo "📦 Получаем зависимости..." echo "📦 Получаем зависимости..."
timeout 300 flutter pub get || (echo "❌ Flutter pub get failed" && exit 1) timeout 300 flutter pub get || (echo "❌ Flutter pub get failed" && exit 1)
echo "🔨 Собираем веб-приложение..."
timeout 600 flutter build web --release \ echo "🔨 Собираем веб-приложение (оптимизировано для ограниченной памяти)..."
# Use O2 optimization instead of O4 to reduce memory usage
# Set environment variables to limit parallel compilation
export DART_VM_OPTIONS="--old-gen-heap-size=2048"
timeout 900 flutter build web --release \
--dart-define=API_BASE_URL=https://api.mnemo-cards.online \ --dart-define=API_BASE_URL=https://api.mnemo-cards.online \
--dart2js-optimization=O4 || (echo "❌ Flutter build failed" && exit 1) --dart2js-optimization=O2 \
--no-tree-shake-icons || (echo "❌ Flutter build failed" && exit 1)
echo "✅ Сборка завершена" echo "✅ Сборка завершена"
- name: Deploy Web App - name: Deploy Web App