Last active
April 10, 2017 09:06
-
-
Save BrettRToomey/1256d98cce5546c696cc68d9f61ad46f 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 | |
if [[ $? != 0 ]]; | |
then | |
echo "β Build failed"; | |
exit 1; | |
fi | |
echo "πΌ Building Release"; | |
swift build -c release | |
if [[ $? != 0 ]]; | |
then | |
echo "β Build for release failed"; | |
exit 1; | |
fi | |
echo "π Testing"; | |
swift test | |
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