-
-
Notifications
You must be signed in to change notification settings - Fork 33
191 lines (158 loc) · 4.83 KB
/
Copy pathdeploy-mobile.yml
File metadata and controls
191 lines (158 loc) · 4.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Mobile CI
# Cost controls (Actions minutes):
# - path filters so non-mobile monorepo edits skip this workflow
# - concurrency cancel-in-progress (macos is 10x billable — cancel stale)
# - PR runs analyze/test only; build-android/ios/deploy stay main-push only
# - prefer ubuntu for analyze; never matrix macos on every PR
on:
push:
branches: [main]
paths:
- "apps/mobile/**"
- ".github/workflows/deploy-mobile.yml"
pull_request:
branches: [main]
paths:
- "apps/mobile/**"
workflow_dispatch:
concurrency:
group: mobile-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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@v6
- 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@v7
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@v6
- name: Set up Java
uses: actions/setup-java@v5
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@v7
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@v6
- 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@v7
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@v6
- name: Download Android artifact
uses: actions/download-artifact@v8
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@v3
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