Skip to content

Commit fcba139

Browse files
committed
Use Xcode 8.3 on Travis CI
1 parent 2895506 commit fcba139

File tree

2 files changed

+27
-35
lines changed

2 files changed

+27
-35
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode8.2
2+
osx_image: xcode8.3
33
cache:
44
bundler: true
55
directories:

Rakefile

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,44 @@
11
task default: "ci:test"
22

3-
latest = "10.1"
4-
53
namespace :ci do
6-
desc "Build targets on Travis CI with a specified OS version, default OS=#{latest}"
4+
desc "Build targets on Travis CI with a specified OS version, default OS=latest"
75
task :build, [:os] do |t, args|
8-
version = args[:os] || latest
9-
Rake::Task["framework:build"].invoke version
10-
Rake::Task["example:build"].invoke version
6+
Rake::Task["build"].execute os: args[:os], scheme: "ICInputAccessory-iOS"
7+
Rake::Task["build"].execute os: args[:os], scheme: "Example"
118
end
129

13-
desc "Run tests on Travis CI with a specified OS version, default OS=#{latest}"
10+
desc "Run tests on Travis CI with a specified OS version, default OS=latest"
1411
task :test, [:os] do |t, args|
15-
version = args[:os] || latest
16-
Rake::Task["framework:build"].invoke version
1712
# UI Testing requires iOS Simulator 9.0 or later.
18-
if Gem::Version.new("9.0") <= Gem::Version.new(version)
19-
Rake::Task["example:test"].invoke version
20-
else
21-
Rake::Task["example:build"].invoke version
22-
end
13+
action = !args[:os] || Gem::Version.new("9.0") <= Gem::Version.new(args[:os]) ? "test" : "build"
14+
Rake::Task[action].execute os: args[:os], scheme: "Example"
2315
end
2416
end
2517

2618

27-
namespace :example do
28-
desc "Build the example project"
29-
task :build, [:os] do |t, args|
30-
version = args[:os] || latest
31-
sh %(xcodebuild -workspace ICInputAccessory.xcworkspace -scheme Example -sdk iphonesimulator -destination "name=iPhone 6s,OS=#{version}" clean build | xcpretty -c && exit ${PIPESTATUS[0]})
32-
exit $?.exitstatus if not $?.success?
33-
end
19+
def xcodebuild(params)
20+
[
21+
%(xcodebuild),
22+
%(-workspace ICInputAccessory.xcworkspace),
23+
%(-scheme #{params[:scheme]}),
24+
%(-sdk iphonesimulator),
25+
%(-destination 'name=iPhone 7,OS=#{params[:version] || "latest"}'),
26+
%(#{params[:action]} | xcpretty -c && exit ${PIPESTATUS[0]})
27+
].join " "
28+
end
3429

35-
desc "Run the UI tests in the example project"
36-
task :test, [:os] do |t, args|
37-
version = args[:os] || latest
38-
sh %(xcodebuild -workspace ICInputAccessory.xcworkspace -scheme Example -sdk iphonesimulator -destination "name=iPhone 6s,OS=#{version}" clean test | xcpretty -c && exit ${PIPESTATUS[0]})
39-
exit $?.exitstatus if not $?.success?
40-
end
30+
31+
desc "Build the target with the specified scheme"
32+
task :build, [:os, :scheme] do |t, args|
33+
sh xcodebuild(scheme: args[:scheme], version: args[:os], action: "clean build")
34+
exit $?.exitstatus if not $?.success?
4135
end
4236

43-
namespace :framework do
44-
desc "Build the framework project"
45-
task :build, [:os] do |t, args|
46-
version = args[:os] || "latest"
47-
sh %(xcodebuild -project ICInputAccessory.xcodeproj -scheme ICInputAccessory-iOS -sdk iphonesimulator -destination "name=iPhone 6s,OS=#{version}" clean build | xcpretty -c && exit ${PIPESTATUS[0]})
48-
exit $?.exitstatus if not $?.success?
49-
end
37+
38+
desc "Run the UI tests in the example project"
39+
task :test, [:os] do |t, args|
40+
sh xcodebuild(scheme: "Example", version: args[:os], action: "clean test")
41+
exit $?.exitstatus if not $?.success?
5042
end
5143

5244

0 commit comments

Comments
 (0)