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
This commit is contained in:
Michael Kirk 2016-10-20 11:32:31 -04:00 committed by GitHub
parent 49de772997
commit 8bf4acd78a
2 changed files with 16 additions and 3 deletions

View File

@ -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)

View File

@ -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