-
Notifications
You must be signed in to change notification settings - Fork 2
/
tests.rb
executable file
·51 lines (42 loc) · 1.06 KB
/
tests.rb
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
#!/usr/bin/env ruby
DEVICE = "iPhone 7"
IOS_VERSION = "10.1"
def run(command)
puts(command)
@any_failures ||= !system(command)
end
def xcodebuildCommand(command)
if command == :build then
"clean build"
elsif command == :test then
"test"
else
raise "Unhandled xcodebuild command"
end
end
def xcodebuildCodeCoverage(command)
command == :test ? "-enableCodeCoverage YES" : ""
end
def xcodebuildScheme(scheme)
if [:ExampleApp, :UIKitFringes, :SpecUIKitFringes].include? scheme
scheme
else
raise "Unhandled xcodebuild scheme"
end
end
def xcodebuild(command, scheme)
run "set -o pipefail && \
xcodebuild #{xcodebuildCommand(command)} \
-workspace HolistiKit.xcworkspace \
-scheme '#{xcodebuildScheme(scheme)}' \
-destination 'platform=iOS Simulator,name=#{DEVICE},OS=#{IOS_VERSION}' \
#{xcodebuildCodeCoverage(command)} \
| xcpretty"
end
[:SpecUIKitFringes, :UIKitFringes, :ExampleApp].each do |scheme|
xcodebuild(:build, scheme)
xcodebuild(:test, scheme)
end
if @any_failures then
raise "Tests failed"
end