Skip to content

test: add actual flutter test for mobile #7

test: add actual flutter test for mobile

test: add actual flutter test for mobile #7

Workflow file for this run

name: Mobile CI
on:
push:
branches: [main]
paths:
- "apps/mobile/**"
- ".github/workflows/mobile-ci.yml"
pull_request:
branches: [main]
paths:
- "apps/mobile/**"
workflow_dispatch:
env:
FLUTTER_VERSION: "3.38.5"
RUBY_VERSION: "3.3"
jobs:
analyze:
name: Analyze & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/mobile
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
- name: Install dependencies
run: flutter pub get
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
working-directory: apps/mobile
- name: Run lint
run: bundle exec fastlane lint
- name: Run tests
run: bundle exec fastlane test
- name: Upload coverage
uses: codecov/codecov-action@v5
if: github.event_name == 'push'
with:
files: apps/mobile/coverage/lcov.info
flags: mobile
fail_ci_if_error: false
build-android:
name: Build Android
needs: analyze
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
defaults:
run:
working-directory: apps/mobile
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
- name: Install dependencies
run: flutter pub get
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
working-directory: apps/mobile
- name: Build Android APK
run: bundle exec fastlane android build
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: android-release
path: apps/mobile/build/app/outputs/flutter-apk/*.apk
retention-days: 7
build-ios:
name: Build iOS
needs: analyze
runs-on: macos-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
defaults:
run:
working-directory: apps/mobile
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
- name: Install dependencies
run: flutter pub get
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
working-directory: apps/mobile
- name: Build iOS (no codesign)
run: bundle exec fastlane ios build
- name: Upload iOS build
uses: actions/upload-artifact@v4
with:
name: ios-release
path: apps/mobile/build/ios/iphoneos
retention-days: 7
deploy-firebase:
name: Deploy to Firebase
needs: [build-android, build-ios]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment: staging
defaults:
run:
working-directory: apps/mobile
steps:
- uses: actions/checkout@v4
- name: Download Android artifact
uses: actions/download-artifact@v4
with:
name: android-release
path: apps/mobile/build/app/outputs/flutter-apk
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
working-directory: apps/mobile
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
- name: Deploy to Firebase App Distribution
env:
FIREBASE_ANDROID_APP_ID: ${{ secrets.FIREBASE_ANDROID_APP_ID }}
FIREBASE_TESTERS_GROUP: ${{ vars.FIREBASE_TESTERS_GROUP }}
run: |
bundle exec fastlane android firebase