Skip to content

Commit

Permalink
Merge pull request #305 from ikesyo/travis-test-tvos
Browse files Browse the repository at this point in the history
[Travis] Test tvOS too
  • Loading branch information
ashfurrow authored Jun 15, 2016
2 parents d890063 + 69a86a3 commit 5c5c798
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ matrix:
env: TYPE=podspec
- os: osx
env: NIMBLE_RUNTIME_IOS_SDK_VERSION=9.0 TYPE=ios
- os: osx
env: NIMBLE_RUNTIME_TVOS_SDK_VERSION=9.0 TYPE=tvos
- os: osx
env: NIMBLE_RUNTIME_OSX_SDK_VERSION=10.10 TYPE=osx
- os: osx
Expand Down
22 changes: 19 additions & 3 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ if which xcodebuild > /dev/null; then
echo -e "Gathering ${GREEN}xcodebuild sdk versions${CLEAR}..."
BUILD_DIR=`pwd`/build
LATEST_IOS_SDK_VERSION=`xcodebuild -showsdks | grep iphonesimulator | cut -d ' ' -f 4 | ruby -e 'puts STDIN.read.chomp.split("\n").last'`
LATEST_TVOS_SDK_VERSION=`xcodebuild -showsdks | grep appletvsimulator | cut -d ' ' -f 4 | ruby -e 'puts STDIN.read.chomp.split("\n").last'`
LATEST_OSX_SDK_VERSION=`xcodebuild -showsdks | grep 'macosx' | cut -d ' ' -f 3 | ruby -e 'puts STDIN.read.chomp.split("\n").last'`
BUILD_IOS_SDK_VERSION=${NIMBLE_BUILD_IOS_SDK_VERSION:-$LATEST_IOS_SDK_VERSION}
RUNTIME_IOS_SDK_VERSION=${NIMBLE_RUNTIME_IOS_SDK_VERSION:-$LATEST_IOS_SDK_VERSION}
BUILD_TVOS_SDK_VERSION=${NIMBLE_BUILD_TVOS_SDK_VERSION:-$LATEST_TVOS_SDK_VERSION}
RUNTIME_TVOS_SDK_VERSION=${NIMBLE_RUNTIME_TVOS_SDK_VERSION:-$LATEST_TVOS_SDK_VERSION}
BUILD_OSX_SDK_VERSION=${NIMBLE_BUILD_OSX_SDK_VERSION:-$LATEST_OSX_SDK_VERSION}
fi

Expand All @@ -32,6 +35,11 @@ function print_env {
echo " Building with iOS SDK: `color_if_overridden $BUILD_IOS_SDK_VERSION $NIMBLE_BUILD_IOS_SDK_VERSION`"
echo " Running with iOS SDK: `color_if_overridden $RUNTIME_IOS_SDK_VERSION $NIMBLE_RUNTIME_IOS_SDK_VERSION`"
echo
echo " tvOS:"
echo " Latest tvOS SDK: $LATEST_TVOS_SDK_VERSION"
echo " Building with tvOS SDK: `color_if_overridden $BUILD_TVOS_SDK_VERSION $NIMBLE_BUILD_TVOS_SDK_VERSION`"
echo " Running with tvOS SDK: `color_if_overridden $RUNTIME_TVOS_SDK_VERSION $NIMBLE_RUNTIME_TVOS_SDK_VERSION`"
echo
echo " Mac OS X:"
echo " Latest OS X SDK: $LATEST_OSX_SDK_VERSION"
echo " Building with OS X SDK: `color_if_overridden $BUILD_OSX_SDK_VERSION $NIMBLE_BUILD_OSX_SDK_VERSION`"
Expand All @@ -46,13 +54,18 @@ function run {
}

function test_ios {
run osascript -e 'tell app "iOS Simulator" to quit'
run osascript -e 'tell app "Simulator" to quit'
run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPad Air,OS=$RUNTIME_IOS_SDK_VERSION" build test

run osascript -e 'tell app "iOS Simulator" to quit'
run osascript -e 'tell app "Simulator" to quit'
run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-iOS" -configuration "Debug" -sdk "iphonesimulator$BUILD_IOS_SDK_VERSION" -destination "name=iPhone 5s,OS=$RUNTIME_IOS_SDK_VERSION" build test
}

function test_tvos {
run osascript -e 'tell app "Simulator" to quit'
run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-tvOS" -configuration "Debug" -sdk "appletvsimulator$BUILD_TVOS_SDK_VERSION" -destination "name=Apple TV 1080p,OS=$RUNTIME_TVOS_SDK_VERSION" build test
}

function test_osx {
run xcodebuild -project Nimble.xcodeproj -scheme "Nimble-OSX" -configuration "Debug" -sdk "macosx$BUILD_OSX_SDK_VERSION" build test
}
Expand All @@ -70,6 +83,7 @@ function test_swiftpm {

function test() {
test_ios
test_tvos
test_osx

if which swift-test; then
Expand All @@ -89,9 +103,10 @@ function help {
echo "COMMANDS:"
echo " clean - Cleans the derived data directory of Xcode. Assumes default location"
echo " ios - Runs the tests as an iOS device"
echo " tvos - Runs the tests as an tvOS device"
echo " osx - Runs the tests on Mac OS X 10.10 (Yosemite and newer only)"
echo " podspec - Runs pod lib lint against the podspec to detect breaking changes"
echo " all - Runs both ios and osx tests"
echo " all - Runs the all tests of ios, tvos and osx"
echo " swiftpm - Runs the tests built by the Swift Package Manager"
echo " help - Displays this help"
echo
Expand All @@ -105,6 +120,7 @@ function main {
case "$arg" in
clean) clean ;;
ios) test_ios ;;
tvos) test_tvos ;;
osx) test_osx ;;
podspec) test_podspec ;;
test) test ;;
Expand Down

0 comments on commit 5c5c798

Please sign in to comment.