-
Notifications
You must be signed in to change notification settings - Fork 692
/
build.sh
executable file
·73 lines (60 loc) · 1.68 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
#!/usr/bin/env bash
CONFIGURATION=
CI=0
BUILD_NUMBER=
RELEASE_LABEL=zlocal
while true ; do
case "$1" in
-c) CONFIGURATION=$2 ; shift ;;
--ci) CI=1 ; shift ;;
--clear-cache) CLEAR_CACHE=1 ; shift ;;
-n) BUILD_NUMBER=$2 ; shift ;;
-l) RELEASE_LABEL=$2 ; shift ;;
--) shift ; break ;;
*) shift ; break ;;
esac
done
# Run configure which installs the .NET SDK
. ./configure.sh
if [ $? -ne 0 ]; then
echo "configure.sh failed !!"
exit 1
fi
# init the repo
git submodule init
git submodule update
# clear caches
if [ "$CLEAR_CACHE" == "1" ]; then
# echo "Clearing the nuget web cache folder"
# rm -r -f ~/.local/share/NuGet/*
echo "Clearing the nuget packages folder"
rm -r -f ~/.nuget/packages/*
fi
if [ "$BUILD_NUMBER" != "" ]; then
build_number_arg="/p:BuildNumber=$BUILD_NUMBER"
fi
if [ "$RELEASE_LABEL" != "" ]; then
release_label_arg="/p:ReleaseLabel=$RELEASE_LABEL"
fi
# CI build is Release by default, local builds are Debug by default
if [ "$CONFIGURATION" == "" ]; then
if [ "$CI" == "1" ]; then
CONFIGURATION=Release
else
CONFIGURATION=Debug
fi
fi
# restore packages
echo "dotnet msbuild build/build.proj /t:Restore /p:Configuration=$CONFIGURATION $build_number_arg $release_label_arg"
dotnet msbuild build/build.proj /t:Restore /p:Configuration=$CONFIGURATION $build_number_arg $release_label_arg
if [ $? -ne 0 ]; then
echo "Restore failed!!"
exit 1
fi
# run tests
echo "dotnet msbuild build/build.proj /t:CoreUnitTests /p:Configuration=$CONFIGURATION $build_number_arg $release_label_arg"
dotnet msbuild build/build.proj /t:CoreUnitTests /p:Configuration=$CONFIGURATION $build_number_arg $release_label_arg
if [ $? -ne 0 ]; then
echo "Tests failed!!"
exit 1
fi