Skip to content

Commit 5c1000f

Browse files
committed
Launch simulators using xcrun instruments
1 parent bde96cf commit 5c1000f

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ cache:
66
before_install:
77
- export LANG=en_US.UTF-8
88
- xcrun instruments -s devices
9-
- open -a /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
109
install:
1110
- bundle install --without development --deployment --jobs=3 --retry=3
11+
- bundle exec rake launch:simulators
1212
- bundle exec pod install
1313
before_script:
1414
- if [ -n "$DANGER_GITHUB_API_TOKEN" ]; then bundle exec danger; fi

Rakefile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
require "fileutils"
22

3+
ios_device = "iPhone X"
4+
ios_version = "12.1"
5+
tvos_device = "Apple TV"
6+
tvos_version = "12.1"
7+
8+
39
def xcodebuild(params)
410
return ":" unless params[:scheme]
511
[
@@ -14,6 +20,15 @@ def xcodebuild(params)
1420
end
1521

1622

23+
namespace :launch do
24+
desc "Launch iOS and tvOS simulators"
25+
task :simulators do
26+
sh %(xcrun instruments -w "#{ios_device} (#{ios_version}) [" || true)
27+
sh %(xcrun instruments -w "#{tvos_device} (#{tvos_version}) [" || true)
28+
end
29+
end
30+
31+
1732
namespace :build do
1833
desc "Build an iOS target with the specified scheme"
1934
task :ios, [:scheme] do |t, args|
@@ -46,7 +61,7 @@ namespace :test do
4661

4762
sh xcodebuild(args.to_hash.merge({
4863
action: "-enableCodeCoverage YES clean test",
49-
destination: %(-destination "name=iPhone 8,OS=latest"),
64+
destination: %(-destination "name=#{ios_device},OS=#{ios_version}"),
5065
simulator: "iphonesimulator"
5166
}))
5267
exit $?.exitstatus if not $?.success?
@@ -58,7 +73,7 @@ namespace :test do
5873

5974
sh xcodebuild(args.to_hash.merge({
6075
action: "-enableCodeCoverage YES clean test",
61-
destination: %(-destination "name=Apple TV,OS=latest"),
76+
destination: %(-destination "name=#{tvos_device},OS=#{tvos_version}"),
6277
simulator: "appletvsimulator"
6378
}))
6479
exit $?.exitstatus if not $?.success?

0 commit comments

Comments
 (0)