forked from Rightpoint/ios-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fastfile
96 lines (80 loc) · 3.12 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
fastlane_version "1.104.0"
default_platform :ios
# Set by build environment
# FL_HOCKEY_API_TOKEN
# RZ_KEYCHAIN_PASSWORD
#ENV['SLACK_URL'] = 'https://hooks.slack.com/services/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'
ENV['RZ_ARTIFACTS'] ||= ENV['CIRCLE_ARTIFACTS'] || './build'
ENV['RZ_TEST_REPORTS'] ||= ENV['CIRCLE_TEST_REPORTS'] || './build'
ENV['FASTLANE_XCODE_LIST_TIMEOUT'] = '120'
ENV['CI_BUILD'] = 'yes'
ENV['GYM_OUTPUT_NAME'] = 'PRODUCTNAME'
ENV['FL_HOCKEY_IPA'] = "#{ENV['RZ_ARTIFACTS']}/#{ENV['GYM_OUTPUT_NAME']}.ipa"
ENV['FL_HOCKEY_NOTIFY'] = '0'
platform :ios do
before_all do
if ENV['RZ_ARTIFACTS'] && ENV['RZ_ARTIFACTS'].length > 0
sh 'rm -rf $RZ_ARTIFACTS && mkdir $RZ_ARTIFACTS'
end
unlock_keychain(path: './Signing/Raizlabs-PRODUCTNAME.keychain', password: ENV['RZ_KEYCHAIN_PASSWORD'] )
end
desc "Runs tests"
lane :test do
scan(
output_types: 'junit',
scheme: 'PRODUCTNAME',
output_directory: "#{ENV['RZ_TEST_REPORTS']}",
buildlog_path: "#{ENV['RZ_ARTIFACTS']}",
)
if !ENV['CIRCLE_TEST_REPORTS'].nil?
# CircleCI requires the "xml" extension for test reporting
puts "Fixing JUnit report name"
sh "mv #{ENV['RZ_TEST_REPORTS']}/report.junit #{ENV['RZ_TEST_REPORTS']}/report.xml"
end
end
desc "Builds and submits a Develop release to Hockey"
lane :develop do
build("PRODUCTNAME", 'enterprise')
hockey(public_identifier: 'ZZHOCKEY_DEVELOP_IDZZ')
# upload_symbols_to_crashlytics(:api_token => 'ZZCRASHLYTICS_API_TOKEN_DEVELOPZZ')
slack(message: "Successfully uploaded build #{build_number} to develop", success: true)
end
desc "Builds and submits a Sprint release to Hockey"
lane :sprint do
build("PRODUCTNAME", 'enterprise')
hockey(public_identifier: 'ZZHOCKEY_SPRINT_IDZZ')
# upload_symbols_to_crashlytics(:api_token => 'ZZCRASHLYTICS_API_TOKEN_SPRINTZZ')
slack(message: "Successfully uploaded build #{build_number} to sprint", success: true)
end
# desc "Builds and submits an App Store release to TestFlight"
lane :beta do
end
desc "Builds and submits an App Store release to iTunes Connect"
lane :release do
end
# Helpers ----------------------
desc "Update Swiftgen"
lane :swiftgen do
sh "cd .. && Pods/SwiftGen/bin/swiftgen strings --template swift3 --enumName Localized --output 'PRODUCTNAME/Application/Generated/Localized.swift' 'PRODUCTNAME/Resources/Localizable.strings'"
sh "cd .. && Pods/SwiftGen/bin/swiftgen images --template swift3 --enumName Asset --output PRODUCTNAME/Application/Generated/UIImage+Asset.swift PRODUCTNAME/Resources/Assets.xcassets"
end
desc "Sync Project and Directory Structure"
lane :synx do
sh "cd .. && synx PRODUCTNAME.xcodeproj"
end
def build(scheme, export_method)
gym(
output_directory: "#{ENV['RZ_ARTIFACTS']}",
output_name: "PRODUCTNAME",
export_method: export_method,
scheme: scheme,
include_bitcode: false,
xcargs: "BUILD_NUMBER=#{build_number}",
buildlog_path: "#{ENV['RZ_ARTIFACTS']}",
use_legacy_build_api: true,
)
end
def build_number
`git rev-list HEAD --count`.chomp()
end
end