-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
74 lines (62 loc) · 1.65 KB
/
Taskfile.yml
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
version: '3'
vars:
BIN_DIR: ./bin
CMD_DIR: ./cmd
tasks:
build:clean:
desc: Clean the build directory
cmds:
- rm -rf {{.BIN_DIR}}
build:setup:
cmds:
- mkdir -p {{.BIN_DIR}}
build:proto:
desc: Build the protobuf files
dir: pb
cmds:
- protoc *.proto --proto_path=. --go_out=. --go_opt=module=github.com/ericslandry/grpc/pb/greeter --go-grpc_out=. --go-grpc_opt=module=github.com/ericslandry/grpc/pb/greeter
build:client:
desc: Build the client application
deps:
- build:setup
cmds:
- go build -o {{.BIN_DIR}}/grpc-client {{.CMD_DIR}}/client
build:server:
desc: Build the server application
deps:
- build:setup
cmds:
- go build -o {{.BIN_DIR}}/grpc-server {{.CMD_DIR}}/server
build:all:
desc: Build both client and server applications
cmds:
- task: build:proto
- task: build:client
- task: build:server
run:server:
desc: Run the server application
cmds:
- "{{.BIN_DIR}}/grpc-server &"
- "until grpcurl -proto ./pb/greeter.proto -plaintext localhost:8080 list > /dev/null; do printf '.'; sleep 1; done"
run:client:
desc: Run the client application
cmds:
- "{{.BIN_DIR}}/grpc-client --name=Mike"
run:kill:
desc: Stop the server application
ignore_error: true
silent: true
cmds:
- "pkill -f grpc-server"
run:all:
desc: Run both client and server applications
cmds:
- task: run:kill
- task: run:server
- task: run:client
- task: run:kill
default:
desc: "Build and run both client and server"
cmds:
- task: build:all
- task: run:all