From 51d9ee0c6a926fdb52d9143eff60c41a23736631 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 6 Jun 2019 16:56:30 +0300 Subject: [PATCH] Travis CI script was changed (#196) --- .travis.yml | 9 ++++--- scripts/buildPrebidMobile.sh | 7 +++--- scripts/testPrebidDemo.sh | 20 +++++++++++++++ scripts/testPrebidMobile.sh | 25 +++++++------------ .../PrebidMobile.xcodeproj/project.pbxproj | 2 +- .../FetchingLogictests/BidManagerTests.swift | 2 +- 6 files changed, 40 insertions(+), 25 deletions(-) create mode 100755 scripts/testPrebidDemo.sh diff --git a/.travis.yml b/.travis.yml index e2749c9be..320a70ca7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ language: swift -osx_image: xcode8 +osx_image: xcode10.2 before_script: "./scripts/add-keys.sh" after_script: "./scripts/remove-key.sh" script: -- "./scripts/swiftLint.sh" -- "./scripts/buildPrebidMobile.sh" -- "./scripts/testPrebidMobile.sh" + - "./scripts/swiftLint.sh" + - "./scripts/buildPrebidMobile.sh" + - "./scripts/testPrebidMobile.sh" + - "./scripts/testPrebidDemo.sh" diff --git a/scripts/buildPrebidMobile.sh b/scripts/buildPrebidMobile.sh index 496480d59..8f4eac015 100755 --- a/scripts/buildPrebidMobile.sh +++ b/scripts/buildPrebidMobile.sh @@ -30,10 +30,11 @@ touch "$LOGFILE" # 4 # Build the framework for device and for simulator (using # all needed architectures). -xcodebuild -target "${FRAMEWORK_NAME}" -configuration Release -arch arm64 -arch -arch only_active_arch=yes defines_module=yes -sdk "iphoneos" > "$LOGFILE" 2>&1 || { echo "Error in build check log "$LOGFILE""; exit;} - -xcodebuild -target "${FRAMEWORK_NAME}" -configuration Release -arch x86_64 -arch i386 only_active_arch=yes defines_module=yes -sdk "iphonesimulator" > "$LOGFILE" 2>&1 || { echo "Error in build check log "$LOGFILE""; exit;} +echo "Building the framework for device" +xcodebuild -target "${FRAMEWORK_NAME}" -configuration Release -arch arm64 only_active_arch=no defines_module=yes -sdk "iphoneos" > "$LOGFILE" 2>&1 || { echo "Error in build check log "$LOGFILE""; exit 1;} +echo "Building the framework for simulator" +xcodebuild -target "${FRAMEWORK_NAME}" -configuration Release -arch x86_64 only_active_arch=no defines_module=yes -sdk "iphonesimulator" > "$LOGFILE" 2>&1 || { echo "Error in build check log "$LOGFILE""; exit 1;} # 5 # Remove .framework file if exists on Desktop from previous run. if [ -d "${HOME}/Desktop/${FRAMEWORK_NAME}.framework" ]; then diff --git a/scripts/testPrebidDemo.sh b/scripts/testPrebidDemo.sh new file mode 100755 index 000000000..3f69a9ce8 --- /dev/null +++ b/scripts/testPrebidDemo.sh @@ -0,0 +1,20 @@ +if [ -d "scripts" ]; then +cd scripts/ +fi + +echo "Running integration tests" +cd ../example/Swift/PrebidDemo/ +echo $PWD +gem install cocoapods --pre +pod install --repo-update +xcodebuild -workspace PrebidDemo.xcworkspace test -scheme "PrebidDemoTests" -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=12.2' | xcpretty -f `xcpretty-travis-formatter` --color --test + +# Make the keychain the default so identities are found +security default-keychain -s ios-build.keychain + +# Unlock the keychain +security unlock-keychain -p travis ios-build.keychain + +# Set keychain locking timeout to 3600 seconds +security set-keychain-settings -t 3600 -u ios-build.keychain + diff --git a/scripts/testPrebidMobile.sh b/scripts/testPrebidMobile.sh index 5847c9954..84d71aea7 100755 --- a/scripts/testPrebidMobile.sh +++ b/scripts/testPrebidMobile.sh @@ -5,25 +5,18 @@ fi cd ../src/PrebidMobile/ echo $PWD echo "Running unit tests" + gem install xcpretty -xcodebuild test -project PrebidMobile.xcodeproj -scheme "PrebidMobileTests" -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=11.0.1' | xcpretty +gem install xcpretty-travis-formatter +xcodebuild test -project PrebidMobile.xcodeproj -scheme "PrebidMobileTests" -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=12.2' | xcpretty -f `xcpretty-travis-formatter` --color --test +if [[ ${PIPESTATUS[0]} == 0 ]]; then + echo "✅ Unit Tests Passed" +else + echo "🔴 Unit Tests Failed" + exit 1 +fi cd ../src/PrebidMobile/ echo $PWD echo "Running swiftlint tests" swiftlint --config .swiftlint.yml - -#echo "Running integration tests" -cd ../../example/Swift/PrebidDemo/ -echo $PWD -xcodebuild -workspace PrebidDemo.xcworkspace test -scheme "PrebidDemoTests" -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=12.1' | xcpretty - -# Make the keychain the default so identities are found -security default-keychain -s ios-build.keychain - -# Unlock the keychain -security unlock-keychain -p travis ios-build.keychain - -# Set keychain locking timeout to 3600 seconds -security set-keychain-settings -t 3600 -u ios-build.keychain - diff --git a/src/PrebidMobile/PrebidMobile.xcodeproj/project.pbxproj b/src/PrebidMobile/PrebidMobile.xcodeproj/project.pbxproj index 9bccb50a0..ef2f9d6ff 100644 --- a/src/PrebidMobile/PrebidMobile.xcodeproj/project.pbxproj +++ b/src/PrebidMobile/PrebidMobile.xcodeproj/project.pbxproj @@ -143,7 +143,7 @@ F543D52E220E101A00F1EF8F /* responseValidTwoBidsOnTheSameSeat.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = responseValidTwoBidsOnTheSameSeat.json; sourceTree = ""; }; F543D530220E193200F1EF8F /* noBidResponseTmaxTooLarge.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = noBidResponseTmaxTooLarge.json; sourceTree = ""; }; F543D531220E193200F1EF8F /* noBidResponseNoTmax.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = noBidResponseNoTmax.json; sourceTree = ""; }; - FA7C3EB4225E464300D2F128 /* PrebidServerOneBidFromAppNexusOneBidFromRubicon.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = PrebidServerOneBidFromAppNexusOneBidFromRubicon.json; path = ../../../../../../../../../../android/SDKPrebid/contributing/PrebidMobile/API1.0/src/test/resources/PrebidServerOneBidFromAppNexusOneBidFromRubicon.json; sourceTree = ""; }; + FA7C3EB4225E464300D2F128 /* PrebidServerOneBidFromAppNexusOneBidFromRubicon.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = PrebidServerOneBidFromAppNexusOneBidFromRubicon.json; path = PrebidServerOneBidFromAppNexusOneBidFromRubicon.json; sourceTree = ""; }; FA7C3EB6225E4C2200D2F128 /* responseRubiconPBM.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = responseRubiconPBM.json; sourceTree = ""; }; FA7C3EB8225E518000D2F128 /* noBidResponseRubicon.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = noBidResponseRubicon.json; sourceTree = ""; }; /* End PBXFileReference section */ diff --git a/src/PrebidMobile/PrebidMobileTests/FetchingLogictests/BidManagerTests.swift b/src/PrebidMobile/PrebidMobileTests/FetchingLogictests/BidManagerTests.swift index eb83d7169..5cd4db34e 100644 --- a/src/PrebidMobile/PrebidMobileTests/FetchingLogictests/BidManagerTests.swift +++ b/src/PrebidMobile/PrebidMobileTests/FetchingLogictests/BidManagerTests.swift @@ -93,7 +93,7 @@ class BidManagerTests: XCTestCase { XCTAssertEqual(resultCode, ResultCode.prebidDemandFetchSuccess) XCTAssertNotNil(bidResponse) let keywords = bidResponse?.customKeywords - XCTAssertEqual(16, keywords?.count) + XCTAssertEqual(15, keywords?.count) self.loadAdSuccesfulException?.fulfill() } loadAdSuccesfulException = expectation(description: "\(#function)")