Skip to content

Commit

Permalink
Merge pull request iZettle#1 from iZettle/build-script
Browse files Browse the repository at this point in the history
Add build script and .travis.yml file
  • Loading branch information
Måns Bernhardt authored Nov 28, 2017
2 parents 72a3a9e + c2fede6 commit d506e13
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: objective-c
osx_image: xcode9.1
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
matrix:
- COMMAND="test-iOS"
- COMMAND="test-native"
script:
- set -o pipefail
- xcodebuild -version
- xcodebuild -showsdks
- swift -version
- sh build.sh "$COMMAND"
76 changes: 76 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/sh

set -o errexit
set -o errtrace
set -o pipefail

PROJECT="Lift.xcodeproj"
SCHEME="Lift"

IOS_SDK="iphonesimulator11.1"
IOS_DESTINATION="OS=11.1,name=iPhone 8"

usage() {
cat << EOF
Usage: sh $0 command
[Building]
iOS Build iOS framework
native Build using `swift build`
clean Clean up all un-neccesary files
[Testing]
test-iOS Run tests on iOS host
test-native Run tests using `swift test`
EOF
}

COMMAND="$1"

case "$COMMAND" in
"clean")
find . -type d -name build -exec rm -r "{}" +\;
exit 0;
;;

"iOS" | "ios")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${IOS_SDK}" \
-destination "${IOS_DESTINATION}" \
-configuration Debug ONLY_ACTIVE_ARCH=YES \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
build | xcpretty -c
exit 0;
;;

"native" | "")
swift build
exit 0;
;;

"test-iOS" | "test-ios")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${IOS_SDK}" \
-destination "${IOS_DESTINATION}" \
-configuration Release \
ONLY_ACTIVE_ARCH=YES \
CODE_SIGNING_REQUIRED=NO \
ENABLE_TESTABILITY=YES \
build test | xcpretty -c
exit 0;
;;

"test-native")
swift package clean
swift build
swift test
exit 0;
;;
esac

usage

0 comments on commit d506e13

Please sign in to comment.