-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFastfile
More file actions
314 lines (272 loc) · 7.66 KB
/
Fastfile
File metadata and controls
314 lines (272 loc) · 7.66 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# Fastlane configuration for OpenMind
# Professional iOS deployment automation
default_platform(:ios)
platform :ios do
# Development lane for internal testing
desc "Build and distribute development build"
lane :dev do
ensure_git_status_clean
# Increment build number
increment_build_number(
build_number: latest_testflight_build_number + 1,
xcodeproj: "OpenMind.xcodeproj"
)
# Run tests
scan(
project: "OpenMind.xcodeproj",
scheme: "OpenMind",
devices: ["iPhone 15", "iPad Pro (12.9-inch) (6th generation)"],
code_coverage: true,
output_directory: "build/test_output",
output_types: "html,junit",
slack_url: ENV["SLACK_WEBHOOK_URL"],
slack_message: "OpenMind Dev Tests"
)
# Build app
gym(
project: "OpenMind.xcodeproj",
scheme: "OpenMind",
configuration: "Debug",
export_method: "development",
output_directory: "build",
output_name: "OpenMind_Dev",
include_bitcode: false,
include_symbols: true
)
# Distribute to testers
if ENV["FIREBASE_APP_ID"]
firebase_app_distribution(
app: ENV["FIREBASE_APP_ID"],
release_notes: changelog_from_git_commits,
groups: "internal-testers"
)
end
# Send notification
notification(
title: "OpenMind Dev Build",
message: "Build #{get_build_number} ready for testing"
)
end
# Beta lane for TestFlight
desc "Submit beta build to TestFlight"
lane :beta do
ensure_git_status_clean
# Run all tests first
test
# Sync certificates
sync_code_signing(
type: "appstore",
app_identifier: "com.openmind.app",
readonly: is_ci
)
# Update version
increment_version_number(
bump_type: "patch",
xcodeproj: "OpenMind.xcodeproj"
)
increment_build_number(
build_number: latest_testflight_build_number + 1,
xcodeproj: "OpenMind.xcodeproj"
)
# Build
gym(
project: "OpenMind.xcodeproj",
scheme: "OpenMind",
configuration: "Release",
export_method: "app-store",
export_options: {
provisioningProfiles: {
"com.openmind.app" => "OpenMind AppStore"
}
},
include_bitcode: false
)
# Upload to TestFlight
pilot(
skip_waiting_for_build_processing: true,
distribute_external: true,
groups: ["Beta Testers"],
changelog: changelog_from_git_commits,
beta_app_description: "Mind mapping application for iOS",
beta_app_feedback_email: "feedback@openmind.app"
)
# Commit version bump
commit_version_bump(
message: "Version Bump to #{get_version_number} (#{get_build_number})",
xcodeproj: "OpenMind.xcodeproj"
)
# Tag release
add_git_tag(
tag: "v#{get_version_number}-beta.#{get_build_number}"
)
push_to_git_remote
slack(
message: "OpenMind #{get_version_number} (#{get_build_number}) submitted to TestFlight! 🚀",
success: true
)
end
# App Store release lane
desc "Deploy to App Store"
lane :release do
ensure_git_branch(branch: "main")
ensure_git_status_clean
# Full test suite
test
# Screenshots
capture_screenshots
# Frame screenshots
frame_screenshots(
use_platform: "IOS",
path: "./fastlane/screenshots"
)
# Sync certificates
sync_code_signing(
type: "appstore",
app_identifier: "com.openmind.app",
readonly: false
)
# Version bump
increment_version_number(
bump_type: "minor",
xcodeproj: "OpenMind.xcodeproj"
)
# Build
gym(
project: "OpenMind.xcodeproj",
scheme: "OpenMind",
configuration: "Release",
export_method: "app-store",
include_bitcode: false
)
# Upload to App Store Connect
deliver(
submit_for_review: false,
force: true,
automatic_release: false,
phased_release: true,
metadata_path: "./fastlane/metadata",
screenshots_path: "./fastlane/screenshots",
submission_information: {
add_id_info_uses_idfa: false,
add_id_info_serves_ads: false,
add_id_info_tracks_install: true,
add_id_info_tracks_action: false,
add_id_info_limits_tracking: true,
export_compliance_uses_encryption: false,
content_rights_contains_third_party_content: false,
content_rights_has_rights: true
}
)
# Post-release
commit_version_bump(
message: "Release v#{get_version_number}",
xcodeproj: "OpenMind.xcodeproj"
)
add_git_tag(
tag: "v#{get_version_number}"
)
push_to_git_remote
slack(
message: "OpenMind #{get_version_number} has been uploaded to App Store Connect! 🎉",
success: true
)
end
# Testing lane
desc "Run all tests"
lane :test do
scan(
project: "OpenMind.xcodeproj",
scheme: "OpenMind",
devices: ["iPhone 15", "iPhone 15 Pro Max", "iPad Pro (12.9-inch) (6th generation)"],
code_coverage: true,
xcargs: "-parallel-testing-enabled YES -maximum-concurrent-test-simulator-destinations 3",
output_directory: "build/test_output",
output_types: "html,junit",
result_bundle: true
)
# Generate coverage report
xcov(
project: "OpenMind.xcodeproj",
scheme: "OpenMind",
output_directory: "build/coverage",
minimum_coverage_percentage: 70.0
)
end
# Screenshot generation
desc "Generate new screenshots"
lane :screenshots do
capture_screenshots(
project: "OpenMind.xcodeproj",
scheme: "OpenMindUITests",
devices: [
"iPhone 15 Pro Max",
"iPhone 15",
"iPad Pro (12.9-inch) (6th generation)",
"iPad Pro (11-inch) (4th generation)"
],
languages: ["en-US", "es-ES", "fr-FR", "de-DE", "ja", "zh-Hans"],
clear_previous_screenshots: true,
override_status_bar: true,
output_directory: "./fastlane/screenshots",
concurrent_simulators: true
)
end
# Certificate management
desc "Sync certificates and profiles"
lane :sync_certs do
if is_ci
create_keychain(
name: "CI_Keychain",
password: ENV["KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 3600,
add_to_search_list: true
)
end
match(
type: "development",
app_identifier: "com.openmind.app",
readonly: is_ci
)
match(
type: "appstore",
app_identifier: "com.openmind.app",
readonly: is_ci
)
end
# Utility lanes
desc "Check code quality"
lane :quality do
swiftlint(
mode: :lint,
config_file: ".swiftlint.yml",
strict: true,
raise_if_swiftlint_error: true
)
# Run periphery for dead code detection
sh("periphery scan --project OpenMind.xcodeproj --schemes OpenMind --format markdown > build/dead_code.md || true")
end
desc "Update dependencies"
lane :update_deps do
sh("xcodebuild -resolvePackageDependencies -project OpenMind.xcodeproj")
end
# Error handling
error do |lane, exception|
slack(
message: "Error in lane #{lane}: #{exception.message}",
success: false
) if ENV["SLACK_WEBHOOK_URL"]
end
# Private lanes
private_lane :changelog_from_git_commits do
changelog = changelog_from_git_commits(
between: [last_git_tag, "HEAD"],
pretty: "- %s",
date_format: "short",
match_lightweight_tag: false,
merge_commit_filtering: "exclude_merges"
)
changelog.empty? ? "Bug fixes and improvements" : changelog
end
end