SwiftGit2/script/cibuild
Matt Rubin 30c6452d99 Update scripts from Objective-Git, including commits:
commit fbc6bb0c42c3f35725fbe98db4e537e22c9a3aed
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Apr 11 09:40:00 2016 -0600

    Add clean_externals script

commit f250c3dd8330732d27b49af93a7defae6df0629e
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Apr 4 22:32:04 2016 -0600

    Enable pipefail

commit 7813f12c75381d87d5ab345c591d00f7184ab150
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Apr 4 22:19:42 2016 -0600

    Configure cibuild to echo commands and fail on first error

commit 6f802a4b82c634f115b7f941d697ccee3f557a8b
Author: Ben Chatelain <ben@octop.ad>
Date:   Sun Apr 3 13:01:45 2016 -0600

    Overhaul cibuild

    - Replaced xctool with xcodebuild + xcpretty
    - Removed unused cruft and awk scripts

commit 5978a65d53def353ab34d63f02553d7ff7622d1f
Merge: 41d4e28 de7f644
Author: Ben Chatelain <ben@octop.ad>
Date:   Sun Feb 28 21:06:56 2016 -0700

    Merge pull request #554 from libgit2/piet/travis-matrix

    Add matrix build for iOS and Mac

commit 1e3f6c5bdf38c1da26c7cc2b5bd4f6b3098bca2e
Author: Piet Brauer <piet@nerdishbynature.com>
Date:   Wed Feb 24 17:40:52 2016 +0800

    Add matrix build for iOS and Mac

commit 9c13681d06decdb8de327633dc80d9b742a54423
Author: Piet Brauer <piet@nerdishbynature.com>
Date:   Wed Feb 24 16:23:11 2016 +0800

    Enable Bitcode
2016-12-09 13:26:57 -08:00

78 lines
2.0 KiB
Bash
Executable File

#!/bin/bash -ex
#
# script/cibuild
# ObjectiveGit
#
# Executes the build and runs tests for Mac and iOS. Designed to be invoked by
# Travis as a matrix build so that the two platform builds can run in parallel.
#
# Dependent tools & scripts:
# - script/bootstrap
# - script/update_libssl_ios
# - [xcodebuild](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html)
# - xcpretty (gem)
# - xcpretty-travis-formatter (gem)
#
# Environment Variables:
# - SCHEME: specifies which Xcode scheme to build. Set to one of the following:
# - ObjectiveGit Mac
# - ObjectiveGit iOS
# - TRAVIS: indicates when the build is being run by travis, used to invoke
# the xcpretty-travis-formatter gem for output.
if [ -z "$SCHEME" ]; then
echo "The SCHEME environment variable is empty. Please set this to one of:"
echo "- ObjectiveGit Mac"
echo "- ObjectiveGit iOS"
exit 1
fi
##
## Configuration Variables
##
set -o pipefail
SCRIPT_DIR=$(dirname "$0")
XCWORKSPACE="ObjectiveGitFramework.xcworkspace"
XCODE_OPTIONS=$(RUN_CLANG_STATIC_ANALYZER=NO ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO)
if [ -n "$TRAVIS" ]; then
# Use a special formatter when running on TravisCI
XCPRETTY_FORMAT_OPTIONS="-f `xcpretty-travis-formatter`"
else
XCPRETTY_FORMAT_OPTIONS="--color"
fi
##
## Build Process
##
echo "*** Bootstrapping..."
"$SCRIPT_DIR/bootstrap"
if [ "$SCHEME" == "ObjectiveGit Mac" ]; then
echo "*** Building and testing $SCHEME..."
echo
xcodebuild -workspace "$XCWORKSPACE" \
-scheme "$SCHEME" \
${XCODE_OPTIONS[*]} \
build test \
2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS
elif [ "$SCHEME" == "ObjectiveGit iOS" ]; then
echo "*** Prebuilding OpenSSL"
"$SCRIPT_DIR/update_libssl_ios"
echo "*** Building and testing $SCHEME..."
echo
xcodebuild -workspace "$XCWORKSPACE" \
-scheme "$SCHEME" \
-destination "platform=iOS Simulator,name=iPhone 5" \
-sdk iphonesimulator \
${XCODE_OPTIONS[*]} \
build test \
2>&1 | xcpretty $XCPRETTY_FORMAT_OPTIONS
fi