Skip to content

Instantly share code, notes, and snippets.

@BrettRToomey
Last active May 1, 2017 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrettRToomey/0c67d9a356deab21a52b195a24200b3d to your computer and use it in GitHub Desktop.
Save BrettRToomey/0c67d9a356deab21a52b195a24200b3d to your computer and use it in GitHub Desktop.
#!/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