Merge pull request #441 from Oloodi/github-action

feat: Update Flutter version handling in CI and adjust pubspec files for compatibility
This commit is contained in:
Achintha Isuru
2026-02-20 02:29:07 -05:00
committed by GitHub
3 changed files with 38 additions and 26 deletions

View File

@@ -29,10 +29,10 @@ jobs:
id: detect id: detect
run: | run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then 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 }}" 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...HEAD 2>/dev/null || echo "")
CHANGED_FILES=$(git diff --name-only origin/$BASE_REF..origin/$HEAD_REF 2>/dev/null || echo "")
else else
# For push, compare with previous commit # For push, compare with previous commit
if [[ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]]; then if [[ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]]; then
@@ -74,39 +74,47 @@ jobs:
- name: 🦋 Set up Flutter - name: 🦋 Set up Flutter
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:
flutter-version: '3.19.x' flutter-version: '3.38.x'
channel: 'stable' channel: 'stable'
cache: true cache: true
- name: 🔧 Install Firebase CLI
run: |
npm install -g firebase-tools
- name: 📦 Get Flutter dependencies - name: 📦 Get Flutter dependencies
run: | run: |
cd apps/mobile make mobile-install
flutter pub get
- name: 🔨 Run compilation check - name: 🔨 Run compilation check
run: | run: |
cd apps/mobile set -o pipefail
echo "⚙️ Running build_runner..."
flutter pub run build_runner build --delete-conflicting-outputs 2>&1 || true echo "🏗️ Building client app for Android (dev mode)..."
if ! make mobile-client-build PLATFORM=apk MODE=debug 2>&1 | tee client_build.txt; then
echo "" echo ""
echo "🔬 Running flutter analyze on all files..." echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
flutter analyze lib/ --no-fatal-infos 2>&1 | tee analyze_output.txt || true echo "❌ CLIENT APP BUILD FAILED"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
exit 1
fi
echo "" echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Check for actual errors (not just warnings) echo "🏗️ Building staff app for Android (dev mode)..."
if grep -E "^\s*(error|SEVERE):" analyze_output.txt > /dev/null; then if ! make mobile-staff-build PLATFORM=apk MODE=debug 2>&1 | tee staff_build.txt; then
echo "❌ COMPILATION ERRORS FOUND:" echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
grep -B 2 -A 1 -E "^\s*(error|SEVERE):" analyze_output.txt | sed 's/^/ /' echo "❌ STAFF APP BUILD FAILED"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
exit 1 exit 1
else
echo "✅ Compilation check PASSED - No errors found"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
fi fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "✅ Build check PASSED - Both apps built successfully"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
lint: lint:
name: 🧹 Lint Changed Files name: 🧹 Lint Changed Files
@@ -120,18 +128,21 @@ jobs:
- name: 🦋 Set up Flutter - name: 🦋 Set up Flutter
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:
flutter-version: '3.19.x' flutter-version: '3.38.x'
channel: 'stable' channel: 'stable'
cache: true cache: true
- name: 🔧 Install Firebase CLI
run: |
npm install -g firebase-tools
- name: 📦 Get Flutter dependencies - name: 📦 Get Flutter dependencies
run: | run: |
cd apps/mobile make mobile-install
flutter pub get
- name: 🔍 Lint changed Dart files - name: 🔍 Lint changed Dart files
run: | run: |
cd apps/mobile set -o pipefail
# Get the list of changed files # Get the list of changed files
CHANGED_FILES="${{ needs.detect-changes.outputs.changed-files }}" CHANGED_FILES="${{ needs.detect-changes.outputs.changed-files }}"
@@ -153,7 +164,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" 2>&1 | tee -a lint_output.txt; then
HAS_ERRORS=true HAS_ERRORS=true
FAILED_FILES+=("$file") FAILED_FILES+=("$file")
fi fi

View File

@@ -1530,4 +1530,4 @@ packages:
version: "2.2.3" version: "2.2.3"
sdks: sdks:
dart: ">=3.10.3 <4.0.0" dart: ">=3.10.3 <4.0.0"
flutter: ">=3.38.4" flutter: ">=3.38.4 <4.0.0"

View File

@@ -3,6 +3,7 @@ publish_to: 'none'
description: "A sample project using melos and modular scaffold." description: "A sample project using melos and modular scaffold."
environment: environment:
sdk: '>=3.10.0 <4.0.0' sdk: '>=3.10.0 <4.0.0'
flutter: '>=3.38.0 <4.0.0'
workspace: workspace:
- packages/design_system - packages/design_system
- packages/core - packages/core