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:
|
deploy-web:
|
||||||
name: Deploy Web App
|
name: Deploy Web App
|
||||||
runs-on: ubuntu-latest
|
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
|
needs: deploy-backend
|
||||||
if: always() && needs.deploy-backend.result == 'success'
|
if: always() && needs.deploy-backend.result == 'success'
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -256,6 +258,8 @@ jobs:
|
||||||
apt-get install -y nodejs
|
apt-get install -y nodejs
|
||||||
echo "Node.js version: $(node --version)"
|
echo "Node.js version: $(node --version)"
|
||||||
echo "NPM version: $(npm --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
|
- name: Setup SSH
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -278,26 +282,59 @@ jobs:
|
||||||
|
|
||||||
- name: Build Web App
|
- name: Build Web App
|
||||||
working-directory: mnemo_cards_web_v2
|
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: |
|
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 "🧹 Очищаем кэш для экономии памяти..."
|
echo "📊 Текущее состояние памяти:"
|
||||||
|
free -h || true
|
||||||
|
|
||||||
|
echo "🧹 Очищаем кэш и временные файлы для экономии памяти..."
|
||||||
flutter clean || true
|
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 "📦 Получаем зависимости..."
|
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 "🔨 Собираем веб-приложение (оптимизировано для ограниченной памяти)..."
|
# Free memory after pub get
|
||||||
# Use O2 optimization instead of O4 to reduce memory usage
|
sync || true
|
||||||
# Set environment variables to limit parallel compilation
|
|
||||||
export DART_VM_OPTIONS="--old-gen-heap-size=2048"
|
echo "🔨 Собираем веб-приложение (оптимизировано для 1.5GB памяти)..."
|
||||||
timeout 900 flutter build web --release \
|
# 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 \
|
--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)
|
--no-tree-shake-icons || (echo "❌ Flutter build failed" && exit 1)
|
||||||
|
|
||||||
echo "✅ Сборка завершена"
|
echo "✅ Сборка завершена"
|
||||||
|
|
||||||
|
echo "📊 Финальное состояние памяти:"
|
||||||
|
free -h || true
|
||||||
|
|
||||||
- name: Deploy Web App
|
- name: Deploy Web App
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue