-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·82 lines (73 loc) · 1.1 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
82
#!/bin/bash
pre() {
go vet ./...
go fmt ./...
/Users/rich_youngkin/Software/repos/go/bin/golint
}
build() {
pre
genProtobuf
cd cmd/accountd
go build
cd -
}
buildARM() {
pre
cd cmd/accountd
genProtobuf
/usr/bin/env GOOS=linux GOARCH=arm GOARM=7 go build
cd -
}
dockerBuild() {
buildARM
genProtobuf
cd cmd/accountd
docker build -t local/accountd .
cd -
}
genProtobuf() {
protoc --go_out=plugins=grpc:. ./pkg/protobuf/accountd/user_service.proto
}
test() {
pre
genProtobuf
go test -race ./... -count=1
}
allLocal() {
pre
build
test
}
allARM() {
pre
dockerBuild
}
if [ $1 = "pre" ]
then
pre
elif [ $1 = "protobuf" ]
then
genProtobuf
elif [ $1 = "build" ]
then
build
elif [ $1 = "buildARM" ]
then
buildARM
elif [ $1 = "dockerBuild" ]
then
dockerBuild
elif [ $1 = "test" ]
then
test
elif [ $1 = "allLocal" ]
then
allLocal
elif [ $1 = "allARM" ]
then
allARM
else
echo "usage:"
echo " build.sh [pre | build | buildARM | dockerBuild | test | allLocal | allARM]"
exit 1
fi