forked from fastlane/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fastfile
177 lines (142 loc) · 5.97 KB
/
Fastfile
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
fastlane_version "2.66.2"
require './helpers/zattoo.rb'
#### Setup ####
desc "Fetches development certificates and provisioning profiles"
lane :fetch_dev_certificates do
match(type: 'development', readonly: true, team_id: Zattoo::TeamId, app_identifier: Zattoo::AppIdentifier::Production)
match(type: 'development', readonly: true, team_id: Zattoo::TeamId, app_identifier: Zattoo::TopShelfAppIdentifier::Production)
end
desc "Fetches distribution certificates and provisioning profiles"
lane :fetch_distribution_certificates do
match(type: 'appstore', readonly: true, team_id: Zattoo::TeamId, app_identifier: Zattoo::AppIdentifier::Preview)
match(type: 'appstore', readonly: true, team_id: Zattoo::TeamId, app_identifier: Zattoo::AppIdentifier::AppleStore)
match(type: 'appstore', readonly: true, team_id: Zattoo::TeamId, app_identifier: Zattoo::AppIdentifier::Production)
match(type: 'appstore', readonly: true, team_id: Zattoo::TeamId, app_identifier: Zattoo::TopShelfAppIdentifier::Preview)
match(type: 'appstore', readonly: true, team_id: Zattoo::TeamId, app_identifier: Zattoo::TopShelfAppIdentifier::AppleStore)
match(type: 'appstore', readonly: true, team_id: Zattoo::TeamId, app_identifier: Zattoo::TopShelfAppIdentifier::Production)
end
desc "Update device list"
lane :update_devices do
register_devices(devices_file: 'fastlane/devices.txt', team_id: Zattoo::TeamId)
end
desc "Update localizable strings from webtranslate"
lane :update_localizable_strings do
sh "helpers/updateLocalizableStrings.sh"
end
#### Tests ####
desc "Run all Zattoo TV Tests: Unit, UI, and Top Shelf Extension"
lane :tests do
run_tests(message: "Unit, UI, and Top Shelf")
end
desc "Run Unit tests"
lane :unit_tests do
run_tests(message: "Unit", scheme: "ZattooTests")
end
desc "Run UI Tests"
lane :ui_tests do
run_tests(message: "UI", scheme: "ZattooUITests")
end
desc "Check style and conventions"
lane :lint do
swiftlint(strict: true)
end
#### Releases ####
desc "Release build to TestFlight"
lane :release do
ensure_git_status_clean
increment_build(app_identifier: Zattoo::AppIdentifier::Production)
gym
pilot(app_platform: 'appletvos')
post_to_slack(message: "New *Zattoo* available in TestFlight", success: true)
reset_git_repo
end
desc "Release a Preview version to TestFlight"
lane :release_preview do
ensure_git_status_clean
setup_preview
increment_build(app_identifier: Zattoo::AppIdentifier::Preview)
setup_preview_provisioning_profiles
gym
pilot(app_platform: 'appletvos')
post_to_slack(message: "New *Zattoo Preview* available in TestFlight", success: true)
reset_git_repo
end
desc "Release a new version for boxes on the Apple Stores"
lane :release_applestore do
ensure_git_status_clean
setup_applestore
increment_build(app_identifier: Zattoo::AppIdentifier::AppleStore)
setup_applestore_provisioning_profiles
gym
pilot(app_platform: 'appletvos')
post_to_slack(message: "New *Zattoo AppleStore* available in TestFlight", success: true)
reset_git_repo
end
desc "Generate screenshots"
lane :screenshots do
snapshot
end
#### Error management ####
error do |lane, exception|
case lane
when :lint then post_to_slack(message: "Linter finished with errors", success: false)
when :unit_tests then post_to_slack(message: "UnitTests finished with errors", success: false)
when :ui_tests then post_to_slack(message: "UITests finished with errors", success: false)
else post_to_slack(message: "Finished with errors", success: false)
end
end
#### Private ####
private_lane :run_tests do |opts|
cocoapods(repo_update: true)
scan(scheme: opts[:scheme])
post_to_slack(message: "*#{opts[:message]} Tests*: All tests successfully passed", success: true)
end
private_lane :post_to_slack do |options|
if ENV["SLACK_URL"]
message = options[:message]
success = options[:success]
slack(message: ":tv: tvOS: " + message + (success ? " :beers:" : " :bomb:"), success: success)
end
end
#### Configuration for ZattooPreview ####
private_lane :setup_preview do
setup_preview_icon
setup_preview_display_name
setup_preview_app_identifier
end
private_lane :setup_preview_icon do
sh "helpers/setupPreviewIcon.sh"
end
private_lane :setup_preview_app_identifier do
update_app_identifier(plist_path: "Zattoo/Resources/Info.plist", app_identifier: Zattoo::AppIdentifier::Preview)
update_app_identifier(plist_path: "TopShelfExtension/Resources/Info.plist", app_identifier: Zattoo::TopShelfAppIdentifier::Preview)
end
private_lane :setup_preview_display_name do
update_info_plist(plist_path: "Zattoo/Resources/Info.plist", display_name: Zattoo::DisplayName::Preview)
end
private_lane :setup_preview_provisioning_profiles do
update_provisioning_profile_specifier(profile_specifier: Zattoo::ProvisioningProfiles::Preview)
update_provisioning_profile_specifier(profile_specifier: Zattoo::TopShelfProvisioningProfiles::Preview, target_name: 'TopShelfExtension')
end
#### Configuration for AppleStore ####
private_lane :setup_applestore do
setup_applestore_display_name
setup_applestore_app_identifier
end
private_lane :setup_applestore_app_identifier do
update_app_identifier(plist_path: "Zattoo/Resources/Info.plist", app_identifier: Zattoo::AppIdentifier::AppleStore)
update_app_identifier(plist_path: "TopShelfExtension/Resources/Info.plist", app_identifier: Zattoo::TopShelfAppIdentifier::AppleStore)
end
private_lane :setup_applestore_display_name do
update_info_plist(plist_path: "Zattoo/Resources/Info.plist", display_name: Zattoo::DisplayName::AppleStore)
end
private_lane :setup_applestore_provisioning_profiles do
update_provisioning_profile_specifier(profile_specifier: Zattoo::ProvisioningProfiles::AppleStore)
update_provisioning_profile_specifier(profile_specifier: Zattoo::TopShelfProvisioningProfiles::AppleStore, target_name: 'TopShelfExtension')
end
#### Common ####
private_lane :increment_build do |options|
increment_build_number({
build_number: latest_testflight_build_number(app_identifier: options[:app_identifier], platform: 'appletvos') + 1
})
end