forked from fastlane/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fastfile
186 lines (152 loc) · 4.41 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
177
178
179
180
181
182
183
184
185
186
ENV["SLACK_URL"] ||= "https://hooks.slack.com/services/..."
fastlane_version "1.3.0"
def build_app
project_file = 'iOS/MindNode for iOS.xcodeproj'
increment_build_number(xcodeproj: project_file) # version bump
# Get the latest provisionnig profiles from the Dev Portal and
# More information about code signing: https://github.com/KrauseFx/fastlane/blob/master/docs/CodeSigning.md
udid = sigh(app_identifier: "com.mindnode.mindnodetouch.watchkitextension", output_path: "/tmp")
ENV["WATCHKIT_EXTENSIONS_UDID"] = udid
udid = sigh(app_identifier: "com.mindnode.mindnodetouch.watchkitapp", output_path: "/tmp")
ENV["WATCHKIT_APP_UDID"] = udid
udid = sigh(app_identifier: "com.mindnode.mindnodetouch", output_path: "/tmp")
ENV["PROJECT_UDID"] = udid
gym(
workspace: 'MindNode-iOS.xcworkspace',
scheme: 'MindNode for iOS (Release)'
)
commit_version_bump(
message: 'Version Bump by fastlane',
xcodeproj: project_file,
force: true
)
push_to_git_remote
end
def ios_tests
begin
sh "cd .. && xctool test"
rescue => ex
puts ex
raise "iOS Unit Tests failed:\n\n #{ex.to_s}"
end
end
def mac_tests
# First clean the project, then test it
begin
xcclean(
workspace: "MindNode-Mac.xcworkspace",
scheme: "MindNode for Mac",
destination: "platform=OS X"
)
xctest(
workspace: "MindNode-Mac.xcworkspace",
scheme: "MindNode for Mac",
destination: "platform=OS X"
)
rescue => ex
raise "Mac Unit Tests failed:\n\n #{ex.to_s}"
end
end
def run_tests
ios_tests
mac_tests
end
################
# All the lanes:
################
before_all do
run_tests
end
desc "Run both iOS and Mac Tests"
lane :test do
# this is done in `before_all` already
end
platform :ios do
desc "Run the static analyzer on the iOS project"
lane :analyze do
analyze
# TODO: Analyze Mac as well, once this is running on Jenkins
end
desc "Create new screenshots for the App Store in all languages and device types"
desc "Additionally, this will add device frames around the screenshots and add the correct titles"
lane :screenshots do
snapshot
frameit(white: true, path: './fastlane/screenshots')
end
desc "Uploads metadata only - no ipa file will be uploaded"
desc "You'll get a summary of the collected metadata before it's uploaded"
lane :upload_metadata do
deliver(metadata_only: true)
end
desc "Build, sign and upload a new beta build to Apple TestFlight"
desc "This will **not** send an email to all testers, it will only be uploaded to the new TestFlight. "
lane :beta do
build_app
deliver(
skip_deploy: true,
beta: true
)
end
desc "Build, sign and upload a new build to the App Store."
desc "This will do the following:"
desc ""
desc "- Create new screenshots and store them in `./fastlane/screenshots`"
desc "- Collect the app metadata from `./fastlane/metadata`"
desc "- Upload screenshots + app metadata"
desc "- Build, sign and upload the app"
desc ""
desc "This will **not** submit the app for review."
lane :appstore do
snapshot
build_app
deliver(
skip_deploy: true,
force: true
)
end
end
platform :mac do
desc "[WIP] Upload App Metadata of the Mac App to iTunes Connect"
lane :metadata do
deliver(
skip_deploy: true,
force: true,
deliver_file_path: File.join(Dir.pwd, 'Mac') # Mac specific app metadata
)
end
desc "Adds frames around the screenshots located in `./fastlane/Mac/screenshots`"
desc "This will not generate new screenshots, but only frame the existing ones"
lane :screenshots do
frameit(path: './fastlane/Mac/screenshots', force_device_type: "Mac")
end
desc "Uploads metadata only (Mac) - no binary will be uploaded"
desc "You'll get a summary of the collected metadata before it's uploaded"
lane :upload_metadata do
deliver(
metadata_only: true,
deliver_file_path: File.join(Dir.pwd, 'Mac') # Mac specific app metadata)
)
end
end
################
# Success/Error:
################
after_all do |lane|
# This block is called, only if the executed lane was successful
if ENV["SLACK_URL"]
slack(
message: nil,
success: true,
default_payloads: [:test_result, :git_branch]
)
end
clean_build_artifacts
end
error do |lane, exception|
if ENV["SLACK_URL"]
slack(
message: exception.to_s,
success: false
)
end
end