name: Flutter Code Check

on:
  push:
    branches: [main, dev, feature/*, hotfix]
  pull_request:
    branches: [main, dev]

jobs:
  flutter-check:
    name: Analyse & Test Flutter
    runs-on: ubuntu-latest

    steps:
      - name: ⬇️ Checkout code
        uses: actions/checkout@v3

      - name: 💡 Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          flutter-version: '3.19.0'  # ou celle que tu utilises
          channel: stable

      - name: 📦 Install dependencies
        run: flutter pub get

      - name: 🔍 Dart Analyzer
        run: flutter analyze

      # - name: 🧪 Run tests (if present)
      #   run: flutter test || echo "No tests found"

      - name: 🧱 Build (Flutter Web)
        run: flutter build web --release
