-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
75 lines (52 loc) · 1.33 KB
/
build.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
72
73
74
75
#!/usr/bin/env bash
# Determine OS
UNAME=`uname`;
if [[ $UNAME == "Darwin" ]]; then
OS="macOS";
elif [[ $UNAME == "Linux" ]]; then
OS="Linux";
else
echo "❌ Unsupported Operating System: $UNAME";
exit 1;
fi
if [[ $OS == "macOS" ]]; then
SWIFT="swift"
else
SWIFT="$HOME/.swiftenv/shims/swift"
fi
echo "💼 Building!";
$SWIFT build
if [[ $? != 0 ]]; then
echo "❌ Build Failed!";
exit 1;
fi
echo "🚀 Building Release!";
$SWIFT build -c release
if [[ $? != 0 ]]; then
echo "❌ Release Build Failed!";
exit 1;
fi
echo "🔎 Testing!";
env LD_LIBRARY_PATH='/usr/local/lib:/usr/local/opt/libressl/lib:$LD_LIBRARY_PATH' $SWIFT test
if [[ $? != 0 ]]; then
echo "❌ Tests Failed!";
exit 1;
fi
UNAME=`uname`;
if [[ $OS != "macOS" ]]; then
echo "✅ Done!"
exit 0;
fi
PROJ_OUTPUT=`swift package generate-xcodeproj`;
PROJ_NAME="${PROJ_OUTPUT/generated: .\//}"
SCHEME_NAME="${PROJ_NAME/.xcodeproj/}"
gem install xcpretty > /dev/null
echo "🏗 Building Xcode Scheme: $SCHEME_NAME";
xcodebuild -project $PROJ_NAME -scheme $SCHEME_NAME-Package -configuration Debug -enableCodeCoverage YES test | xcpretty
if [[ $? != 0 ]]; then
echo "❌ Xcode Build Failed!";
exit 1;
fi
echo "🗃 Sending Coverage Reports";
bash <(curl -s https://codecov.io/bash) -X xcodeplist
echo "✅ Done!"