forked from polydice/ICInputAccessory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
42 lines (34 loc) · 1.35 KB
/
Rakefile
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
task default: "ci:test"
namespace :ci do
desc "Build targets on Travis CI with a specified OS version, default OS=latest"
task :build, [:os] do |t, args|
Rake::Task["build"].execute os: args[:os], scheme: "ICInputAccessory-iOS"
Rake::Task["build"].execute os: args[:os], scheme: "Example"
end
desc "Run tests on Travis CI with a specified OS version, default OS=latest"
task :test, [:os] do |t, args|
# UI Testing requires iOS Simulator 9.0 or later.
action = !args[:os] || Gem::Version.new("9.0") <= Gem::Version.new(args[:os]) ? "test" : "build"
Rake::Task[action].execute os: args[:os], scheme: "Example"
end
end
def xcodebuild(params)
[
%(xcodebuild),
%(-workspace ICInputAccessory.xcworkspace),
%(-scheme #{params[:scheme]}),
%(-sdk iphonesimulator),
%(-destination 'name=iPhone 8,OS=#{params[:version] || "latest"}'),
%(#{params[:action]} | xcpretty -c && exit ${PIPESTATUS[0]})
].join " "
end
desc "Build the target with the specified scheme"
task :build, [:os, :scheme] do |t, args|
sh xcodebuild(scheme: args[:scheme], version: args[:os], action: "clean build")
exit $?.exitstatus if not $?.success?
end
desc "Run the UI tests in the example project"
task :test, [:os] do |t, args|
sh xcodebuild(scheme: "Example", version: args[:os], action: "clean test")
exit $?.exitstatus if not $?.success?
end