feat: Update mobile CI workflow to use melos for build and analysis

This commit is contained in:
Achintha Isuru
2026-02-19 17:05:56 -05:00
parent b6c3fb8487
commit 1dd3699373

View File

@@ -87,17 +87,31 @@ jobs:
run: | run: |
cd apps/mobile cd apps/mobile
echo "⚙️ Running build_runner..." echo "⚙️ Running build_runner..."
flutter pub run build_runner build --delete-conflicting-outputs 2>&1 || true melos run gen:build 2>&1 || true
echo "" echo ""
echo "🔬 Running flutter analyze on all files..." echo "🔬 Running flutter analyze on all packages..."
flutter analyze lib/ --no-fatal-infos 2>&1 | tee analyze_output.txt || true # Analyze all packages in the workspace
for dir in packages/*/; do
if [ -d "$dir/lib" ]; then
echo "Analyzing: $dir"
flutter analyze "$dir/lib" --no-fatal-infos 2>&1 | tee -a analyze_output.txt || true
fi
done
# Also analyze apps
for app_dir in apps/*/lib; do
if [ -d "$app_dir" ]; then
echo "Analyzing: $app_dir"
flutter analyze "$app_dir" --no-fatal-infos 2>&1 | tee -a analyze_output.txt || true
fi
done
echo "" echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Check for actual errors (not just warnings) # Check for actual errors (not just warnings)
if grep -E "^\s*(error|SEVERE):" analyze_output.txt > /dev/null; then if grep -E "^\s*(error|SEVERE):" analyze_output.txt > /dev/null 2>&1; then
echo "❌ COMPILATION ERRORS FOUND:" echo "❌ COMPILATION ERRORS FOUND:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
grep -B 2 -A 1 -E "^\s*(error|SEVERE):" analyze_output.txt | sed 's/^/ /' grep -B 2 -A 1 -E "^\s*(error|SEVERE):" analyze_output.txt | sed 's/^/ /'
@@ -145,6 +159,9 @@ jobs:
echo "$CHANGED_FILES" echo "$CHANGED_FILES"
echo "" echo ""
# Ensure flutter pub get in workspace
melos bootstrap --no-git-tag-version
# Run dart analyze on each changed file # Run dart analyze on each changed file
HAS_ERRORS=false HAS_ERRORS=false
FAILED_FILES=() FAILED_FILES=()
@@ -153,7 +170,7 @@ jobs:
if [[ -n "$file" && "$file" == *.dart ]]; then if [[ -n "$file" && "$file" == *.dart ]]; then
echo "📝 Analyzing: $file" echo "📝 Analyzing: $file"
if ! flutter analyze "$file" --no-fatal-infos 2>&1 | tee -a lint_output.txt; then if ! dart analyze "$file" --no-fatal-infos 2>&1 | tee -a lint_output.txt; then
HAS_ERRORS=true HAS_ERRORS=true
FAILED_FILES+=("$file") FAILED_FILES+=("$file")
fi fi