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:
65
.github/workflows/mobile-ci.yml
vendored
65
.github/workflows/mobile-ci.yml
vendored
@@ -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
|
||||
@@ -74,40 +74,48 @@ jobs:
|
||||
- name: 🦋 Set up Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.19.x'
|
||||
flutter-version: '3.38.x'
|
||||
channel: 'stable'
|
||||
cache: true
|
||||
|
||||
- name: 🔧 Install Firebase CLI
|
||||
run: |
|
||||
npm install -g firebase-tools
|
||||
|
||||
- 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..."
|
||||
flutter pub run build_runner build --delete-conflicting-outputs 2>&1 || true
|
||||
|
||||
echo ""
|
||||
echo "🔬 Running flutter analyze on all files..."
|
||||
flutter analyze lib/ --no-fatal-infos 2>&1 | tee analyze_output.txt || true
|
||||
set -o pipefail
|
||||
|
||||
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 "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Check for actual errors (not just warnings)
|
||||
if grep -E "^\s*(error|SEVERE):" analyze_output.txt > /dev/null; then
|
||||
echo "❌ COMPILATION ERRORS FOUND:"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
grep -B 2 -A 1 -E "^\s*(error|SEVERE):" analyze_output.txt | sed 's/^/ /'
|
||||
echo "❌ CLIENT APP BUILD FAILED"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
exit 1
|
||||
else
|
||||
echo "✅ Compilation check PASSED - No errors found"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
echo "🏗️ Building staff app for Android (dev mode)..."
|
||||
if ! make mobile-staff-build PLATFORM=apk MODE=debug 2>&1 | tee staff_build.txt; then
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "❌ STAFF APP BUILD FAILED"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "✅ Build check PASSED - Both apps built successfully"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
lint:
|
||||
name: 🧹 Lint Changed Files
|
||||
runs-on: macos-latest
|
||||
@@ -120,18 +128,21 @@ jobs:
|
||||
- name: 🦋 Set up Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.19.x'
|
||||
flutter-version: '3.38.x'
|
||||
channel: 'stable'
|
||||
cache: true
|
||||
|
||||
- name: 🔧 Install Firebase CLI
|
||||
run: |
|
||||
npm install -g firebase-tools
|
||||
|
||||
- name: 📦 Get Flutter dependencies
|
||||
run: |
|
||||
cd apps/mobile
|
||||
flutter pub get
|
||||
make mobile-install
|
||||
|
||||
- name: 🔍 Lint changed Dart files
|
||||
run: |
|
||||
cd apps/mobile
|
||||
set -o pipefail
|
||||
|
||||
# Get the list of changed files
|
||||
CHANGED_FILES="${{ needs.detect-changes.outputs.changed-files }}"
|
||||
@@ -153,7 +164,7 @@ jobs:
|
||||
if [[ -n "$file" && "$file" == *.dart ]]; then
|
||||
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
|
||||
FAILED_FILES+=("$file")
|
||||
fi
|
||||
|
||||
@@ -1530,4 +1530,4 @@ packages:
|
||||
version: "2.2.3"
|
||||
sdks:
|
||||
dart: ">=3.10.3 <4.0.0"
|
||||
flutter: ">=3.38.4"
|
||||
flutter: ">=3.38.4 <4.0.0"
|
||||
|
||||
@@ -3,6 +3,7 @@ publish_to: 'none'
|
||||
description: "A sample project using melos and modular scaffold."
|
||||
environment:
|
||||
sdk: '>=3.10.0 <4.0.0'
|
||||
flutter: '>=3.38.0 <4.0.0'
|
||||
workspace:
|
||||
- packages/design_system
|
||||
- packages/core
|
||||
|
||||
Reference in New Issue
Block a user