-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
71 lines (56 loc) · 1.65 KB
/
Makefile
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
# 安装
install:
go mod download
cd website; yarn install
# 代码风格检验
fix:
gocheckstyle -config=scripts/golangstyle.json -reporter=plain src 2>&1 | tee -a fix.log
golint $$(go list ./... | grep -v /vendor/) | tee -a fix.log
# 运行后端服务
serve:
reflex -s -R '^website*' -R '_test.go$$'\
-- go run ./main.go -f config.yaml
# 运行前端站点
site:
cd website; yarn start
# 测试
test:
CGO_ENABLED=0 go test -v $$(go list ./...)
# 测试报告
report:
CGO_ENABLED=0 go install -v github.com/axw/gocov/gocov
CGO_ENABLED=0 go install -v github.com/AlekSi/gocov-xml
CGO_ENABLED=0 go install -v gopkg.in/matm/v1/gocov-html
rm -rf coverage.html coverage.xml coverage.txt coverage.log
sh ./scripts/coverage.sh --html --xml | tee coverage.log
# 构建
build:
mkdir -p package
rm -rf package/room.cafe
rm -rf package/front
go clean -i ./...
CGO_ENABLED=0 go build -o room.cafe main.go
mv room.cafe package
cd website; yarn install && yarn build
cd website; mv build ../package/front
# 构建
build-production:
mkdir -p package
rm -rf package/room.cafe
rm -rf package/front
go clean -i ./...
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o room.cafe main.go
mv room.cafe ./package
cd website; yarn install && yarn build
cd website; mv build ../package/front
tar zcvf room.cafe.tar.gz package/
# 部署
deploy:
scp room.cafe.tar.gz [email protected]:/home/ubuntu/room.cafe
ssh [email protected] tar zxvf /home/ubuntu/room.cafe/room.cafe.tar.gz -C /home/ubuntu/room.cafe
# 服务状态
status:
ssh [email protected] supervisorctl status room.cafe
# 重启服务
restart:
ssh [email protected] supervisorctl restart room.cafe