feat: Enhance mobile CI workflow to compare all changes in PRs and streamline analysis commands

This commit is contained in:
Achintha Isuru
2026-02-19 17:13:03 -05:00
parent 1dd3699373
commit 1510b69d59

View File

@@ -29,10 +29,10 @@ jobs:
id: detect
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# For PR, compare with base branch
# For PR, compare all changes against base branch (not just latest commit)
# Using three-dot syntax (...) shows all files changed in the PR branch
BASE_REF="${{ github.event.pull_request.base.ref }}"
HEAD_REF="${{ github.event.pull_request.head.ref }}"
CHANGED_FILES=$(git diff --name-only origin/$BASE_REF..origin/$HEAD_REF 2>/dev/null || echo "")
CHANGED_FILES=$(git diff --name-only origin/$BASE_REF...HEAD 2>/dev/null || echo "")
else
# For push, compare with previous commit
if [[ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]]; then
@@ -80,32 +80,12 @@ jobs:
- name: 📦 Get Flutter dependencies
run: |
cd apps/mobile
flutter pub get
make mobile-install
- name: 🔨 Run compilation check
run: |
cd apps/mobile
echo "⚙️ Running build_runner..."
melos run gen:build 2>&1 || true
echo ""
echo "🔬 Running flutter analyze on all packages..."
# 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 "⚙️ Running mobile analyze..."
make mobile-analyze 2>&1 | tee analyze_output.txt || true
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@@ -140,13 +120,10 @@ jobs:
- name: 📦 Get Flutter dependencies
run: |
cd apps/mobile
flutter pub get
make mobile-install
- name: 🔍 Lint changed Dart files
run: |
cd apps/mobile
# Get the list of changed files
CHANGED_FILES="${{ needs.detect-changes.outputs.changed-files }}"
@@ -159,9 +136,6 @@ jobs:
echo "$CHANGED_FILES"
echo ""
# Ensure flutter pub get in workspace
melos bootstrap --no-git-tag-version
# Run dart analyze on each changed file
HAS_ERRORS=false
FAILED_FILES=()