stuff
This commit is contained in:
parent
ff2d48b80c
commit
02a55d2bc7
1 changed files with 45 additions and 8 deletions
|
|
@ -241,7 +241,9 @@ jobs:
|
|||
deploy-web:
|
||||
name: Deploy Web App
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/cirruslabs/flutter:3.35.5
|
||||
container:
|
||||
image: ghcr.io/cirruslabs/flutter:3.35.5
|
||||
options: --memory=1536m --memory-swap=1536m --shm-size=256m
|
||||
needs: deploy-backend
|
||||
if: always() && needs.deploy-backend.result == 'success'
|
||||
steps:
|
||||
|
|
@ -256,6 +258,8 @@ jobs:
|
|||
apt-get install -y nodejs
|
||||
echo "Node.js version: $(node --version)"
|
||||
echo "NPM version: $(npm --version)"
|
||||
# Set Node.js memory limits for dart2js compilation (512MB to fit in 1.5GB container)
|
||||
echo "NODE_OPTIONS=--max-old-space-size=512" >> $GITHUB_ENV || echo "NODE_OPTIONS=--max-old-space-size=512" >> ~/.bashrc || true
|
||||
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
|
|
@ -278,26 +282,59 @@ jobs:
|
|||
|
||||
- name: Build Web App
|
||||
working-directory: mnemo_cards_web_v2
|
||||
env:
|
||||
# Limit Dart VM memory usage (1GB for Dart, 512MB for Node.js)
|
||||
DART_VM_OPTIONS: "--old-gen-heap-size=1024 --max-old-space-size=1024"
|
||||
# Limit Node.js memory for dart2js compilation
|
||||
NODE_OPTIONS: "--max-old-space-size=512"
|
||||
# Limit parallel compilation to reduce memory pressure
|
||||
FLUTTER_BUILD_PARALLEL: "1"
|
||||
# Disable analytics to save memory
|
||||
FLUTTER_ANALYTICS_DISABLED: "true"
|
||||
# Reduce GC pressure
|
||||
DART_FLAGS: "--disable-dart-dev"
|
||||
run: |
|
||||
echo "🔍 Проверяем Flutter..."
|
||||
which flutter || echo "Flutter not found in PATH"
|
||||
flutter --version || echo "Flutter command failed"
|
||||
|
||||
echo "🧹 Очищаем кэш для экономии памяти..."
|
||||
echo "📊 Текущее состояние памяти:"
|
||||
free -h || true
|
||||
|
||||
echo "🧹 Очищаем кэш и временные файлы для экономии памяти..."
|
||||
flutter clean || true
|
||||
# Clear additional caches
|
||||
rm -rf ~/.pub-cache/hosted/pub.dev/.cache || true
|
||||
rm -rf ~/.dartServer || true
|
||||
rm -rf ~/.flutter-devtools || true
|
||||
rm -rf /tmp/dart* || true
|
||||
rm -rf /tmp/flutter* || true
|
||||
|
||||
# Drop caches to free memory (if available)
|
||||
echo 3 > /proc/sys/vm/drop_caches 2>/dev/null || true
|
||||
|
||||
# Sync memory to disk to free up RAM
|
||||
sync || true
|
||||
|
||||
echo "📦 Получаем зависимости..."
|
||||
timeout 300 flutter pub get || (echo "❌ Flutter pub get failed" && exit 1)
|
||||
|
||||
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 \
|
||||
# Free memory after pub get
|
||||
sync || true
|
||||
|
||||
echo "🔨 Собираем веб-приложение (оптимизировано для 1.5GB памяти)..."
|
||||
# Use O1 optimization (lowest memory usage, still production-ready)
|
||||
# Build with minimal parallelization to avoid OOM
|
||||
# Additional flags to reduce memory footprint
|
||||
timeout 1800 flutter build web --release \
|
||||
--dart-define=API_BASE_URL=https://api.mnemo-cards.online \
|
||||
--dart2js-optimization=O2 \
|
||||
--dart2js-optimization=O1 \
|
||||
--no-tree-shake-icons || (echo "❌ Flutter build failed" && exit 1)
|
||||
|
||||
echo "✅ Сборка завершена"
|
||||
|
||||
echo "📊 Финальное состояние памяти:"
|
||||
free -h || true
|
||||
|
||||
- name: Deploy Web App
|
||||
run: |
|
||||
|
|
|
|||
Loading…
Reference in a new issue