From 8bf4acd78af9d237d8db7a571399b8d9076e1516 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 20 Oct 2016 11:32:31 -0400 Subject: [PATCH] early boot the simulator to avoid false travis failures Tests were frequently failing, especially during peak travis-ci hours. Also, saved some time by removing redundant build from test script. // FREEBIE --- .travis.yml | 3 +++ Makefile | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6c0cf392b..660a49237 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,9 @@ cache: cocoapods # pod install somtimes takes >20 minutes, so lets cache this osx_image: xcode8 +env: + -EARLY_START_SIMULATOR=1 # early starting simulator reduces false negatives due to test timeouts + before_install: - brew update # we may not be running the latest version so always update - brew outdated xctool || brew upgrade xctool # only upgrade if outdated (saves 2 minutes) diff --git a/Makefile b/Makefile index 4b9491e14..a387dc817 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ # Make sure we're failing even though we pipe to xcpretty SHELL=/bin/bash -o pipefail -o errexit -BUILD_DESTINATION = platform=iOS Simulator,name=iPhone 6,OS=9.3 +# iPhone6, iOS10 +DEVICE_UUID:=$(shell xcrun instruments -s | grep -o "iPhone 6 (10.0) \[.*\]" | grep -o "\[.*\]" | sed "s/^\[\(.*\)\]$$/\1/") +BUILD_DESTINATION = platform=iOS Simulator,id=${DEVICE_UUID} WORKING_DIR = ./ SCHEME = Signal XCODE_BUILD = xcrun xcodebuild -workspace $(SCHEME).xcworkspace -scheme $(SCHEME) -sdk iphonesimulator @@ -20,14 +22,22 @@ build: pod_install cd $(WORKING_DIR) && \ $(XCODE_BUILD) build | xcpretty -retest: +retest: optional_early_start_simulator cd $(WORKING_DIR) && \ $(XCODE_BUILD) \ -destination '${BUILD_DESTINATION}' \ - build test | xcpretty + test | xcpretty clean: cd $(WORKING_DIR) && \ $(XCODE_BUILD) \ clean | xcpretty +optional_early_start_simulator: +ifdef EARLY_START_SIMULATOR + echo "Waiting for simulator to start to help with testing timeouts" &&\ + xcrun instruments -w '${DEVICE_UUID}' || true # xcrun can return irrelevant non-zeroes. +else + echo "Not waiting for simulator." +endif +