Last active
May 1, 2017 10:49
-
-
Save BrettRToomey/0c67d9a356deab21a52b195a24200b3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
VERSION="3.1" | |
echo "Swift $VERSION Continuous Integration"; | |
# Determine OS | |
UNAME=`uname`; | |
if [[ $UNAME == "Darwin" ]]; | |
then | |
OS="macos"; | |
OS_FILE="osx"; | |
else | |
if [[ $UNAME == "Linux" ]]; | |
then | |
UBUNTU_RELEASE=`lsb_release -a 2>/dev/null`; | |
if [[ $UBUNTU_RELEASE == *"16.10"* ]]; | |
then | |
OS="ubuntu1610"; | |
OS_FILE="ubuntu16.10"; | |
elif [[ $UBUNTU_RELEASE == *"16.04"* ]]; | |
then | |
OS="ubuntu1604"; | |
OS_FILE="ubuntu16.04"; | |
elif [[ $UBUNTU_RELEASE == *"14.04"* ]]; | |
then | |
OS="ubuntu1404"; | |
OS_FILE="ubuntu14.04"; | |
else | |
echo "Unsupported Operating System: $UBUNTU_RELEASE"; | |
exit 1; | |
fi | |
else | |
echo "Unsupported Operating System: $UNAME"; | |
exit 1; | |
fi | |
fi | |
echo "π₯ Operating System: $OS"; | |
if [[ $OS != "macos" ]]; | |
then | |
echo "π Installing Swift Dependencies" | |
sudo apt-get install -y clang libicu-dev uuid-dev | |
echo "π¦ Installing Swift"; | |
SWIFTFILE=swift-3.1-RELEASE-$OS_FILE | |
wget https://swift.org/builds/swift-3.1-release/$OS/swift-3.1-RELEASE/$SWIFTFILE.tar.gz | |
tar -zxf $SWIFTFILE.tar.gz | |
export PATH=$PWD/$SWIFTFILE/usr/bin:"${PATH}" | |
echo "π¦ Installing Vapor Dependencies" | |
sudo apt-get install -y openssl libmysqlclient-dev | |
else | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew tap vapor/homebrew-tap | |
brew update | |
brew install ctls | |
fi | |
echo "π Version: `swift --version`"; | |
echo "π Building"; | |
swift build -Xcc -D_GNU_SOURCE | |
if [[ $? != 0 ]]; | |
then | |
echo "β Build failed"; | |
exit 1; | |
fi | |
echo "πΌ Building Release"; | |
swift build -Xcc -D_GNU_SOURCE -c release | |
if [[ $? != 0 ]]; | |
then | |
echo "β Build for release failed"; | |
exit 1; | |
fi | |
echo "π Testing"; | |
swift test -Xcc -D_GNU_SOURCE | |
if [[ $? != 0 ]]; | |
then | |
echo "β Tests failed"; | |
exit 1; | |
fi | |
echo "β Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment