103 lines
2.4 KiB
YAML
103 lines
2.4 KiB
YAML
name: Mobile EDA CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
# Flutter 代码检查和测试
|
|
flutter-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.19.0'
|
|
channel: 'stable'
|
|
cache: true
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Run analyzer
|
|
run: flutter analyze
|
|
|
|
- name: Run tests
|
|
run: flutter test
|
|
|
|
- name: Build APK (Debug)
|
|
run: flutter build apk --debug
|
|
|
|
- name: Upload APK artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-debug-apk
|
|
path: build/app/outputs/flutter-apk/app-debug.apk
|
|
|
|
# iOS 构建(仅在 macOS 上)
|
|
ios-build:
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.19.0'
|
|
channel: 'stable'
|
|
cache: true
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Build iOS
|
|
run: flutter build ios --no-codesign
|
|
|
|
- name: Upload iOS artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ios-build
|
|
path: build/ios/iphoneos/
|
|
|
|
# Android 发布构建
|
|
android-release:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.19.0'
|
|
channel: 'stable'
|
|
cache: true
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Build APK (Release)
|
|
run: flutter build apk --release
|
|
|
|
- name: Build AppBundle
|
|
run: flutter build appbundle --release
|
|
|
|
- name: Upload Release APK
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-release-apk
|
|
path: build/app/outputs/flutter-apk/app-release.apk
|
|
|
|
- name: Upload AppBundle
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-release-aab
|
|
path: build/app/outputs/bundle/release/app-release.aab
|