-
Notifications
You must be signed in to change notification settings - Fork 33
/
Fastfile
149 lines (133 loc) · 3.89 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
desc "Runs tests on the primary platforms and configurations"
lane :test do
verify(
scheme: "FormValidatorSwift iOS"
)
verify(
scheme: "FormValidatorSwift tvOS"
)
verify(
scheme: "FormValidatorSwift macOS",
destination: "platform=macOS"
)
verify(
scheme: "iOS Example"
)
if is_ci?
# Unable to run macOS UI Tests on Travis CI. See https://github.com/travis-ci/travis-ci/issues/7075
build(
scheme: "macOS Example",
destination: "platform=macOS"
)
else
verify(
scheme: "macOS Example",
destination: "platform=macOS"
)
end
pod_lib_lint
end
desc "Runs tests"
lane :verify do |options|
scheme = options[:scheme]
destination = options[:destination]
sdk = options[:sdk]
output_directory = "fastlane/test_output/" + scheme + "/"
opts = {
:workspace => 'FormValidatorSwift.xcworkspace',
:scheme => scheme,
:destination => destination,
:sdk => sdk,
:code_coverage => true,
:xcargs => "ONLY_ACTIVE_ARCH=YES",
:output_directory => output_directory,
:clean => true
}
scan(opts)
upload_cov
end
desc "Builds scheme"
lane :build do |options|
scheme = options[:scheme]
destination = options[:destination]
sdk = options[:sdk]
xcodebuild(
workspace: 'FormValidatorSwift.xcworkspace',
scheme: scheme,
destination: destination,
sdk: sdk,
xcargs: 'ONLY_ACTIVE_ARCH=YES',
build: true,
clean: true
)
end
desc "Upload code coverage reports (if running on CI)"
lane :upload_cov do
if is_ci?
sh "bash ./codecov.sh"
else
say "No need to upload code coverage. Not running from CI."
end
end
desc "Updates the GitHub Pages documentation"
lane :update_docs do
jazzy
end
desc "Bumps the version number of the project and podspec"
desc "This action does the following:"
desc ""
desc "- Ensures a clean git status"
desc "- Increment the version number (Project & Podspec)"
desc "- Lints the CocoaPods Library"
desc "- Commit and push the version bump"
desc "- Creates a GitHub Release and git tag"
desc "- Lints the CocoaPods Spec"
desc ""
desc "This action does NOT do the following:"
desc ""
desc "- Add the changelog notes to the GitHub release"
desc "- Submit the updated podspec to CocoaPods"
lane :bump_version do |options|
version = options[:version]
raise "You must specify a version in A.B.X format to deploy." if version.nil? || version.scan(/\d+\.\d+\.\d+/).length == 0
ensure_git_status_clean
version_bump_podspec(
path: "FormValidatorSwift.podspec",
version_number: version
)
increment_version_number_in_plist(
version_number: version,
xcodeproj: './FormValidatorSwift.xcodeproj',
target: 'FormValidatorSwift iOS'
)
increment_version_number_in_plist(
version_number: version,
xcodeproj: './iOS Example.xcodeproj',
target: 'iOS Example'
)
increment_version_number_in_plist(
version_number: version,
xcodeproj: './macOS Example.xcodeproj',
target: 'macOS Example'
)
pod_lib_lint
git_add(
path: ['./Sources/Info.plist', './Example/iOS/Info.plist', './Example/macOS/Info.plist', './FormValidatorSwift.podspec']
)
commit_version_bump(
force: true,
xcodeproj: './FormValidatorSwift.xcodeproj'
)
update_docs
sh 'cd ../ && git add ./docs/*'
sh 'cd ../ && git commit -m \'Update documentation for v' + version + '\''
push_to_git_remote
set_github_release(
repository_name: "ustwo/formvalidator-swift",
api_token: ENV["GITHUB_TOKEN"],
description: 'Version Bump to ' + version,
name: "Version " + version,
tag_name: version
)
sh 'cd ../ && bundle exec pod spec lint'
end