FIX: 收敛近期体验与配置修复 #129
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| pull_request: | |
| branches: [main, master] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| env: | |
| FLUTTER_VERSION: '3.41.5' | |
| jobs: | |
| analyze: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| cache: true | |
| cache-key: flutter-${{ runner.os }}-${{ hashFiles('pubspec.lock') }} | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Run analyze | |
| run: flutter analyze --no-fatal-warnings --no-fatal-infos | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: analyze | |
| timeout-minutes: 25 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| cache: true | |
| cache-key: flutter-${{ runner.os }}-${{ hashFiles('pubspec.lock') }} | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Run tests | |
| run: flutter test | |
| build: | |
| needs: [analyze, test] | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [ios, android] | |
| include: | |
| - platform: ios | |
| runner: macos-latest | |
| - platform: android | |
| runner: ubuntu-latest | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| cache: true | |
| cache-key: flutter-${{ runner.os }}-${{ hashFiles('pubspec.lock') }} | |
| - name: Get dependencies | |
| run: flutter pub get | |
| # Pods 缓存键必须同时绑定 pubspec.lock:ffmpeg_kit_flutter_new_min 的 | |
| # FFmpegKit xcframework 由 podspec prepare_command 下载到 pub-cache 包目录, | |
| # 该命令只在 pod 首次安装时执行。若 pub-cache 因 pubspec.lock 变更被重建(Frameworks 丢失), | |
| # 而 Pods 缓存仅按 Podfile.lock 命中,pod install 会跳过 prepare_command, | |
| # 导致 framework 头文件缺失、iOS 构建失败。不用 restore-keys(部分命中会带回旧 | |
| # Manifest.lock,同样跳过 prepare_command)。 | |
| - name: Cache CocoaPods | |
| if: matrix.platform == 'ios' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ios/Pods | |
| key: pods-${{ runner.os }}-${{ hashFiles('ios/Podfile.lock', 'pubspec.lock') }} | |
| - name: Install CocoaPods | |
| if: matrix.platform == 'ios' | |
| run: cd ios && pod install | |
| - name: Build iOS (no codesign) | |
| if: matrix.platform == 'ios' | |
| run: | | |
| flutter build ios --release --no-codesign --flavor=prod \ | |
| --dart-define=API_BASE_URL=${{ vars.API_BASE_URL }} \ | |
| --dart-define=POSTHOG_HOST=${{ vars.POSTHOG_HOST }} \ | |
| --dart-define=SUPABASE_URL=${{ vars.SUPABASE_URL }} \ | |
| --dart-define=SUPABASE_PUBLISHABLE_KEY=${{ vars.SUPABASE_PUBLISHABLE_KEY }} \ | |
| --dart-define=GOOGLE_WEB_CLIENT_ID=${{ vars.GOOGLE_WEB_CLIENT_ID }} | |
| - name: Setup Java | |
| if: matrix.platform == 'android' | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Restore Android signing config | |
| if: matrix.platform == 'android' | |
| env: | |
| ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
| ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| run: | | |
| echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > android/app/upload-keystore.jks | |
| cat > android/key.properties <<EOF | |
| storePassword=$ANDROID_KEYSTORE_PASSWORD | |
| keyPassword=$ANDROID_KEY_PASSWORD | |
| keyAlias=$ANDROID_KEY_ALIAS | |
| storeFile=../app/upload-keystore.jks | |
| EOF | |
| - name: Build Android APK | |
| if: matrix.platform == 'android' | |
| run: | | |
| flutter clean | |
| flutter build apk --release --flavor=prod \ | |
| --target-platform android-arm64 \ | |
| --dart-define=API_BASE_URL=${{ vars.API_BASE_URL }} \ | |
| --dart-define=POSTHOG_HOST=${{ vars.POSTHOG_HOST }} \ | |
| --dart-define=SUPABASE_URL=${{ vars.SUPABASE_URL }} \ | |
| --dart-define=SUPABASE_PUBLISHABLE_KEY=${{ vars.SUPABASE_PUBLISHABLE_KEY }} \ | |
| --dart-define=GOOGLE_WEB_CLIENT_ID=${{ vars.GOOGLE_WEB_CLIENT_ID }} |