-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
98 lines (68 loc) · 2.5 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
build:
make -j 3 buildServer buildClient buildHomepage
watch:
make -j 3 watchServer watchHomepage watchClient
grpc:
protoc -I server/protos server/protos/* --go_out=plugins=grpc:server/go/services
buildClient:
cd ./client/badmars/ && webpack --debug
watchClient:
cd ./client/badmars/ && webpack --debug -w
buildHomepage:
cd ./client/homepage/ && webpack --debug
watchHomepage:
cd ./client/homepage/ && webpack --debug -w
check:
go vet .
./node_modules/.bin/tslint -p server/nodejs/
test:
yarn test
# make -j 2 apiTest run
apiTest:
bash -c 'while [[ "`curl -s -o /dev/null -w '%{http_code}' localhost:3002/_health`" != "200" ]]; do sleep 1; done'
echo 'SERVER READY'
bash -c 'cd ./tests && EPHEMERAL=true BADMARS_SERVER="localhost:3002" go run *.go'
# hacky, kills the test server
# this used so the CI server can run 'make test' and automagically work
ps aux | grep 'node standalone.js' | grep -v grep | awk '{print $$2}' | xargs kill
# bash -c "ps aux | grep 'node standalone.js' | awk '{print $$2}' | xargs kill -9"
run:
bash -c 'cd ./bin/server/nodejs && node standalone.js'
nodeSetup:
npm install
# go deps are listed in here to streamline docker image rebuilding
goSetup:
go get github.com/gorilla/mux
go get github.com/gorilla/handlers
go get github.com/pkg/errors
go get github.com/google/uuid
go get google.golang.org/grpc
go get gopkg.in/dancannon/gorethink.v2
setup: goSetup nodeSetup
prepareBin:
cp -r server/protos bin/
mkdir -p bin/server/nodejs/config/
cp server/nodejs/config/*.json bin/server/nodejs/config/
mkdir -p bin/server/nodejs/web/views/
cp -r server/nodejs/web/views bin/server/nodejs/web/
cp -r ./public bin/
buildServer: prepareBin buildNode
buildNode:
cd ./server/nodejs/ && ../../node_modules/typescript/bin/tsc
# TODO build for go services
buildTypedRuntime:
cd ./server/nodejs && tsr -c tsconfig.json *.ts -f
watchServer: prepareBin watchNode
watchNode:
cd ./server/nodejs/ && ../../node_modules/typescript/bin/tsc -w
# TODO add watch for go services
#--------------------------------------------
# commands that use docker
dockerBuildPrepare:
docker-compose -f docker-compose-build.yml build
dockerBuild: dockerBuildPrepare
docker-compose -f docker-compose-build.yml run node-build make buildServer
dockerWatch: dockerBuildPrepare
docker-compose -f docker-compose-build.yml run node-build make watchServer
dockerTest:
docker-compose run standalone yarn test