name: Flutter

on:
  push:
    paths-ignore:
      - "**.md"
      - "docs/**"
  pull_request:

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: subosito/flutter-action@v2
        with:
          flutter-version: ${{ vars.FLUTTER_VERSION }}
          cache: true

      - name: Install dependencies
        run: flutter pub get

      - name: Format
        run: find . -name '*.dart' -not -path './lib/src/generated/i18n/*' | xargs dart format --output=none --set-exit-if-changed

      - name: Analyze
        run: flutter analyze

      - name: Test
        run: flutter test

  build-android:
    uses: ./.github/workflows/android-build.yml
    secrets: inherit
    with:
      flutter_version: ${{ vars.FLUTTER_VERSION }}
      workflow_profile: ci
      build_mode: ci_full_dev
      artifact_name: Apk
      enable_build_cache: true
      enable_gradle_cache: true
      signing_required: false
      include_metadata_defines: true
      include_dev_define: true

  build-windows:
    uses: ./.github/workflows/windows-build.yml
    with:
      flutter_version: ${{ vars.FLUTTER_VERSION }}
      workflow_profile: ci
      artifact_name: Windows
      enable_build_cache: true
      include_metadata_defines: true
      include_dev_define: true
      package_release_artifacts: false

  build-linux:
    uses: ./.github/workflows/linux-build.yml
    with:
      flutter_version: ${{ vars.FLUTTER_VERSION }}
      workflow_profile: ci
      artifact_name: Linux
      include_metadata_defines: true
      include_dev_define: true
