diff --git a/.travis.yml b/.travis.yml index fd688296..0211780e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,25 @@ language: objective-c +osx_image: xcode7.2 -env: - matrix: - - CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="7.0.3" TASK="rake ci" - - CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="7.1" TASK="rake ci" - - CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="8.1" TASK="rake ci" +matrix: + include: + - env: CEDAR_SDK_VERSION="9.2" CEDAR_SDK_RUNTIME_VERSION="8.4" TASK="rake ci" + - env: CEDAR_SDK_VERSION="9.2" CEDAR_SDK_RUNTIME_VERSION="9.2" TASK="rake ci" - # Analyze takes too long -- vary on runtime SDK - - CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="8.1" TASK="rake suites:specs:analyze" - - CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="8.1" TASK="rake suites:uispecs:analyze" - - CEDAR_SDK_VERSION="8.1" CEDAR_SDK_RUNTIME_VERSION="8.1" TASK="rake suites:focused_specs:analyze" + # Analyze takes too long to vary on runtime SDK. Latest is fine. + - env: CEDAR_SDK_VERSION="9.2" TASK="rake suites:specs:analyze" + - env: CEDAR_SDK_VERSION="9.2" TASK="rake suites:uispecs:analyze" + - env: CEDAR_SDK_VERSION="9.2" TASK="rake suites:focused_specs:analyze" - - TASK="./install.sh" - - TASK="./installCodeSnippetsAndTemplates" + - env: TASK="./install.sh" + - env: TASK="./installCodeSnippetsAndTemplates" before_install: brew update install: - bundle install - brew install ios-sim + - ios-sim showsdks + - ios-sim showdevicetypes script: # run a printer task to keep travis from terminating static analysis diff --git a/scripts/rake/helpers/shell.rb b/scripts/rake/helpers/shell.rb index e2d66d46..d17ba9c3 100644 --- a/scripts/rake/helpers/shell.rb +++ b/scripts/rake/helpers/shell.rb @@ -1,8 +1,11 @@ class Shell def self.run(cmd, logfile = nil) + cmd.gsub!(/\s{2,}/, " ") + puts "#{green}==>#{clear} #{cmd}" original_cmd = cmd + if logfile logfile = output_file(logfile) cmd = "export > #{logfile}; (#{cmd}) 2>&1 >> #{logfile}; test ${PIPESTATUS[0]} -eq 0" diff --git a/scripts/rake/helpers/simulator.rb b/scripts/rake/helpers/simulator.rb index 1fe55409..a8831c82 100644 --- a/scripts/rake/helpers/simulator.rb +++ b/scripts/rake/helpers/simulator.rb @@ -37,5 +37,6 @@ def self.kill system %Q[killall -m -KILL "gdb" > /dev/null 2>&1] system %Q[killall -m -KILL "otest" > /dev/null 2>&1] system %Q[killall -m -KILL "iPhone Simulator" > /dev/null 2>&1] + system %Q[killall -m -KILL "Simulator" > /dev/null 2>&1] end end diff --git a/scripts/rake/helpers/xcode.rb b/scripts/rake/helpers/xcode.rb index 96884a93..f779760b 100644 --- a/scripts/rake/helpers/xcode.rb +++ b/scripts/rake/helpers/xcode.rb @@ -9,8 +9,8 @@ def self.developer_dir `xcode-select -print-path`.strip end - def self.build_dir(effective_platform_name = "") - File.join(BUILD_DIR, CONFIGURATION + effective_platform_name) + def self.build_dir(effective_platform_name = "", configuration = CONFIGURATION) + File.join(BUILD_DIR, configuration + effective_platform_name) end def self.sdk_dir_for_version(version) @@ -19,8 +19,12 @@ def self.sdk_dir_for_version(version) path end + def self.iPhone_simulator_name + 'iPhone 5s' + end + def self.destination_for_ios_sdk(version) - "name=iPhone 5s,OS=#{version}" + "name=#{iPhone_simulator_name},OS=#{version}" end def self.swift_build_settings @@ -41,9 +45,10 @@ def self.build(options = nil) args += " -target #{options[:target].inspect}" if options[:target] args += " -sdk #{options[:sdk].inspect}" if options[:sdk] args += " -scheme #{options[:scheme].inspect}" if options[:scheme] + args += " -configuration #{options[:configuration] || CONFIGURATION}" Shell.fold "build.#{options[:scheme] || options[:target]}" do - Shell.run(%Q(xcodebuild -project #{PROJECT_NAME}.xcodeproj -configuration #{CONFIGURATION} SYMROOT=#{BUILD_DIR.inspect} clean build #{args}), logfile) + Shell.run(%Q(xcodebuild -project #{PROJECT_NAME}.xcodeproj SYMROOT=#{BUILD_DIR.inspect} clean build #{args}), logfile) end end @@ -57,8 +62,28 @@ def self.test(options = nil) args += " -sdk #{options[:sdk].inspect}" if options[:sdk] args += " -scheme #{options[:scheme].inspect}" if options[:scheme] + # launch Simulator.app with the uuid matching our device and sdk version + Shell.run(%Q(open -b com.apple.iphonesimulator \ + --args -CurrentDeviceUDID `xcrun instruments -s | \ + grep -o "#{iPhone_simulator_name} (#{SDK_VERSION}) \[.*\]" | \ + grep -o "\[.*\]" | \ + sed "s/^\[\(.*\)\]$/\1/" 2>/dev/null`)) + Shell.run("sleep 5", nil) # need to wait for the simulator to be done "launching" + Shell.fold "test.#{options[:scheme] || options[:target]}" do - Shell.run(%Q(xcodebuild -project #{PROJECT_NAME}.xcodeproj -configuration #{CONFIGURATION} -derivedDataPath #{DERIVED_DATA_DIR.inspect} SYMROOT=#{BUILD_DIR.inspect} clean build test #{args}), logfile) + retry_count = 0 + begin + Shell.run(%Q( + xcodebuild -project #{PROJECT_NAME}.xcodeproj \ + -configuration #{CONFIGURATION} \ + -derivedDataPath #{DERIVED_DATA_DIR.inspect} \ + SYMROOT=#{BUILD_DIR.inspect} \ + clean build test #{args})\ + , logfile) + rescue + retry_count += 1 + raise if retry_count == 3 + end end end diff --git a/scripts/rake/tasks/spec_suites.rb b/scripts/rake/tasks/spec_suites.rb index 38baaadb..bea35402 100644 --- a/scripts/rake/tasks/spec_suites.rb +++ b/scripts/rake/tasks/spec_suites.rb @@ -41,7 +41,7 @@ desc "Build UI specs" task :build do - Xcode.build(target: UI_SPECS_TARGET_NAME, sdk: "iphonesimulator#{SDK_VERSION}", args: 'ARCHS=i386', logfile: "uispecs.build.log") + Xcode.build(target: UI_SPECS_TARGET_NAME, sdk: "iphonesimulator#{SDK_VERSION}", args: 'ARCHS=i386', configuration: "Debug", logfile: "uispecs.build.log") end desc "Run UI specs" @@ -52,7 +52,7 @@ } Shell.with_env(env_vars) do - Simulator.launch(Xcode.build_dir("-iphonesimulator"), UI_SPECS_TARGET_NAME, Xcode.build_dir("-uispecs.run.log")) + Simulator.launch(Xcode.build_dir("-iphonesimulator", "Debug"), UI_SPECS_TARGET_NAME, Xcode.build_dir("-uispecs.run.log")) end end end @@ -123,7 +123,11 @@ desc "Build iOS dynamic framework specs" task :build do - Xcode.build(target: IOS_DYNAMIC_FRAMEWORK_SPECS_TARGET_NAME, sdk: "iphonesimulator#{SDK_VERSION}", args: 'ARCHS=i386 '+Xcode.swift_build_settings, logfile: "frameworks.ios.dynamic.specs.build.log") + Xcode.build(target: IOS_DYNAMIC_FRAMEWORK_SPECS_TARGET_NAME, + sdk: "iphonesimulator#{SDK_VERSION}", + args: 'ARCHS=i386 '+Xcode.swift_build_settings, + configuration: "Debug", + logfile: "frameworks.ios.dynamic.specs.build.log") end desc "Runs iOS dynamic framework specs" @@ -134,7 +138,7 @@ } Shell.with_env(env_vars) do - Simulator.launch(Xcode.build_dir("-iphonesimulator"), IOS_DYNAMIC_FRAMEWORK_SPECS_TARGET_NAME, Xcode.build_dir("-frameworks.ios.dynamic.specs.run.log")) + Simulator.launch(Xcode.build_dir("-iphonesimulator", "Debug"), IOS_DYNAMIC_FRAMEWORK_SPECS_TARGET_NAME, Xcode.build_dir("-frameworks.ios.dynamic.specs.run.log")) end end end