From f83f8089867dd09c0ebb80bc15d354f459a6ba50 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 11 Oct 2016 09:05:28 -0400 Subject: [PATCH] Fix ci for xcode 8 * Makefile for builds (CLI FTW) Easier to make sure we're doing the same thing locally as in travis // FREEBIE --- .travis.yml | 21 +++--------- .../TSKitiOSTestApp.xcodeproj/project.pbxproj | 3 ++ Makefile | 33 +++++++++++++++++++ tests/Messages/OWSMessageSenderTest.m | 4 +++ 4 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 Makefile diff --git a/.travis.yml b/.travis.yml index 12028da38..505b5e2f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,14 @@ language: objective-c -osx_image: xcode7.3 -env: - - TEST_DIR=Example/TSKitiOSTestApp +osx_image: xcode8 before_install: - - cd $TEST_DIR - brew update - - brew outdated xctool || brew upgrade xctool - gem install cocoapods xcpretty --no-ri --no-rdoc - pod repo update --silent -install: pod install +after_failure: + - sleep 10 # This prevents the occasional output truncation that happens when piping to xcpretty. -script: -- | - set -o pipefail - xcodebuild -workspace TSKitiOSTestApp.xcworkspace \ - -scheme TSKitiOSTestApp \ - -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 6' \ - build test | xcpretty - -xcode_workspace: TSKitiOSTestApp.xcworkspace -xcode_scheme: TSKitiOSTestApp +script: make diff --git a/Example/TSKitiOSTestApp/TSKitiOSTestApp.xcodeproj/project.pbxproj b/Example/TSKitiOSTestApp/TSKitiOSTestApp.xcodeproj/project.pbxproj index fe621f784..bcb65c0b8 100644 --- a/Example/TSKitiOSTestApp/TSKitiOSTestApp.xcodeproj/project.pbxproj +++ b/Example/TSKitiOSTestApp/TSKitiOSTestApp.xcodeproj/project.pbxproj @@ -372,6 +372,7 @@ }; B6273DE91C13A2E500738558 = { CreatedOnToolsVersion = 7.1.1; + DevelopmentTeam = U68MSDN6DR; TestTargetID = B6273DD01C13A2E500738558; }; }; @@ -694,6 +695,7 @@ baseConfigurationReference = 36DA6C703F99948D553F4E3F /* Pods-TSKitiOSTestAppTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = U68MSDN6DR; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SRCROOT)/$(PROJECT_NAME)/TSKitiOSTestApp-Prefix.pch"; INFOPLIST_FILE = TSKitiOSTestAppTests/Info.plist; @@ -709,6 +711,7 @@ baseConfigurationReference = D3737F7A041D7147015C02C2 /* Pods-TSKitiOSTestAppTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = U68MSDN6DR; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SRCROOT)/$(PROJECT_NAME)/TSKitiOSTestApp-Prefix.pch"; INFOPLIST_FILE = TSKitiOSTestAppTests/Info.plist; diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..55b57704b --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +# 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 +WORKING_DIR = Example/TSKitiOSTestApp +SCHEME = TSKitiOSTestApp +XCODE_BUILD = xcrun xcodebuild -workspace $(SCHEME).xcworkspace -scheme $(SCHEME) -sdk iphonesimulator + +.PHONY: build test retest clean + +default: test + +test: pod_install retest + +pod_install: + cd $(WORKING_DIR) && \ + pod install + +build: pod_install + cd $(WORKING_DIR) && \ + $(XCODE_BUILD) build | xcpretty + +retest: + cd $(WORKING_DIR) && \ + $(XCODE_BUILD) \ + -destination '${BUILD_DESTINATION}' \ + build test + +clean: + cd $(WORKING_DIR) && \ + $(XCODE_BUILD) \ + clean | xcpretty + diff --git a/tests/Messages/OWSMessageSenderTest.m b/tests/Messages/OWSMessageSenderTest.m index c7a4dc1f5..320dfaa82 100644 --- a/tests/Messages/OWSMessageSenderTest.m +++ b/tests/Messages/OWSMessageSenderTest.m @@ -8,6 +8,7 @@ #import "TSContactThread.h" #import "TSNetworkManager.h" #import "TSOutgoingMessage.h" +#import "TSStorageManager+keyingMaterial.h" #import "TSStorageManager.h" #import @@ -94,6 +95,9 @@ NS_ASSUME_NONNULL_BEGIN { [super setUp]; + // Hack to make sure we don't explode when sending sync message. + [TSStorageManager storePhoneNumber:@"+13231231234"]; + self.thread = [[TSContactThread alloc] initWithUniqueId:@"fake-thread-id"]; [self.thread save];