name: Mobile Apps CI

on:
  push:
    paths:
      - 'apps/app-*/**'
      - 'packages/**'
  pull_request:
    paths:
      - 'apps/app-*/**'
      - 'packages/**'

jobs:
  lint-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup PNPM
        uses: pnpm/action-setup@v2
        with:
          version: 8
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'pnpm'
      
      - name: Install dependencies
        run: pnpm install --frozen-lockfile
      
      - name: Setup Flutter
        uses: subosito/flutter-action@v2
        with:
          flutter-version: '3.16.0'
          channel: 'stable'
      
      - name: Install Flutter dependencies (Admin)
        run: |
          cd apps/app-admin
          flutter pub get
      
      - name: Install Flutter dependencies (Client)
        run: |
          cd apps/app-client
          flutter pub get
      
      - name: Analyze Flutter code (Admin)
        run: |
          cd apps/app-admin
          flutter analyze
      
      - name: Analyze Flutter code (Client)
        run: |
          cd apps/app-client
          flutter analyze
