forked from stratisproject/Breeze
-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.sh
82 lines (62 loc) · 2.58 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
76
77
78
79
80
81
#!/bin/bash
# exit if error
set -o errexit
if [ "$TRAVIS_OS_NAME" = "osx" ]
then
dotnet_resources_path_in_app=$TRAVIS_BUILD_DIR/breeze_out/breeze-ui-$os_platform-$arch/breeze-ui.app/contents/resources/app/assets/daemon
else
dotnet_resources_path_in_app=$TRAVIS_BUILD_DIR/breeze_out/breeze-ui-$os_platform-$arch/resources/app/assets/daemon
fi
# define a few variables
app_output_name="breeze-$os_identifier-$arch-$configuration"
api_output_name="api-$os_identifier-$arch-$configuration"
echo "current environment variables:"
echo "OS name:" $TRAVIS_OS_NAME
echo "OS identifier:" $os_identifier
echo "Platform:" $os_platform
echo "Build directory:" $TRAVIS_BUILD_DIR
echo "Node version:" $TRAVIS_NODE_VERSION
echo "Architecture:" $arch
echo "Configuration:" $configuration
echo "App output name:" $app_output_name
echo "Api output name:" $api_output_name
echo "dotnet resources path in app:" $dotnet_resources_path_in_app
dotnet --info
# Initialize dependencies
echo $log_prefix STARTED restoring dotnet and npm packages
cd $TRAVIS_BUILD_DIR/Breeze
git submodule update --init --recursive
dotnet restore -v m
cd $TRAVIS_BUILD_DIR/Breeze.UI
npm install
echo $log_prefix FINISHED restoring dotnet and npm packages
# dotnet build
echo $log_prefix running 'dotnet build'
cd $TRAVIS_BUILD_DIR/Breeze/src/Breeze.Daemon
dotnet build -c $configuration -r $os_identifier-$arch -v m
echo $log_prefix running 'dotnet publish'
dotnet publish -c $configuration -r $os_identifier-$arch -v m -o $TRAVIS_BUILD_DIR/dotnet_out/$TRAVIS_OS_NAME
echo $log_prefix chmoding the Breeze.Daemon file
chmod +x $TRAVIS_BUILD_DIR/dotnet_out/$TRAVIS_OS_NAME/Breeze.Daemon
echo $log_prefix zipping results of 'dotnet publish' into $TRAVIS_BUILD_DIR/dotnet_out/$api_output_name.zip
mkdir -p $TRAVIS_BUILD_DIR/deploy/
cd $TRAVIS_BUILD_DIR/dotnet_out
zip -r $TRAVIS_BUILD_DIR/deploy/$api_output_name.zip $TRAVIS_OS_NAME/*
# node Build
cd $TRAVIS_BUILD_DIR/Breeze.UI
echo $log_prefix running 'npm run'
npm run build:prod
# node packaging
echo $log_prefix packaging breeze
node package.js --platform=$os_platform --arch=$arch --path=$TRAVIS_BUILD_DIR/breeze_out
# copy api libs into app
echo $log_prefix copying the Breeze api into the app
mkdir -p $dotnet_resources_path_in_app
cp -r $TRAVIS_BUILD_DIR/dotnet_out/$TRAVIS_OS_NAME/* $dotnet_resources_path_in_app
# zip result
echo $log_prefix zipping the app into $TRAVIS_BUILD_DIR/breeze_out/$app_output_name.zip
cd $TRAVIS_BUILD_DIR/breeze_out
zip -r $TRAVIS_BUILD_DIR/deploy/$app_output_name.zip breeze-ui-$os_platform-$arch/*
#tests
echo $log_prefix no tests to run
echo $log_prefix FINISHED build