-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (32 loc) · 1.4 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
# DOCKER_UDS arg is required, which is, in my case, is the output of 'echo /run/user/"$(id -u)"/docker.sock'
DOCKER_UDS="/run/user/1000/docker.sock"
install_devtools: # export PATH="$PATH:$(go env GOPATH)/bin" should be run manually, go compiler is considered to be installed
sudo apt update \
&& sudo apt install -y protobuf-compiler \
&& go install google.golang.org/protobuf/cmd/[email protected] \
&& go install google.golang.org/grpc/cmd/[email protected]
codegen:
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative proto/chat.proto
run_server:
go run ./server/
run_client:
go run ./client/ --sender_id=$(me) --receiver_id=$(them)
test_local:
go test ./server/storage/ ./server/chatmanager/
test:
docker run --name=chat_tests --rm -v $(DOCKER_UDS):/var/run/docker.sock chat-tests:latest
build_server:
docker build --tag chat-server -f dockerfiles/server.Dockerfile .
build_client:
docker build --tag chat-client -f dockerfiles/client.Dockerfile .
build_tests_only:
docker build -f dockerfiles/tests.Dockerfile --tag chat-tests .
build_tests: build_server build_client build_tests_only
run_server_d:
docker run -d --name=chat_server --rm chat-server:latest
stop_server:
docker kill chat_server
run_client_d:
docker run -i --net=container:chat_server chat-client:latest /client --receiver_id $(them) --sender_id $(me)
format:
black tests/ ; isort tests/