This repository has been archived by the owner on Sep 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.sh
71 lines (61 loc) · 1.39 KB
/
ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
VERSION="3.0.2"
echo "Swift $VERSION Continuous Integration";
# Determine OS
UNAME=`uname`;
if [[ $UNAME == "Darwin" ]];
then
OS="macos";
else
if [[ $UNAME == "Linux" ]];
then
UBUNTU_RELEASE=`lsb_release -a 2>/dev/null`;
if [[ $UBUNTU_RELEASE == *"15.10"* ]];
then
OS="ubuntu1510";
else
OS="ubuntu1404";
fi
else
echo "Unsupported Operating System: $UNAME";
fi
fi
echo "🖥 Operating System: $OS";
if [[ $OS != "macos" ]];
then
echo "📚 Installing Dependencies"
sudo apt-get install -y clang libicu-dev uuid-dev
echo "🐦 Installing Swift";
if [[ $OS == "ubuntu1510" ]];
then
SWIFTFILE="swift-$VERSION-RELEASE-ubuntu15.10";
else
SWIFTFILE="swift-$VERSION-RELEASE-ubuntu14.04";
fi
wget https://swift.org/builds/swift-$VERSION-release/$OS/swift-$VERSION-RELEASE/$SWIFTFILE.tar.gz
tar -zxf $SWIFTFILE.tar.gz
export PATH=$PWD/$SWIFTFILE/usr/bin:"${PATH}"
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"