-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
139 lines (120 loc) · 3.45 KB
/
Taskfile.yaml
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
version: '3'
env:
GOBIN: { sh: pwd }
# OTEL_SDK_DISABLED: true
# OTEL_TRACES_EXPORTER: console
OTEL_EXPORTER_OTLP_ENDPOINT: http://localhost:14318
OTEL_EXPORTER_OTLP_HEADERS: "uptrace-dsn=http://project2_secret_token@localhost:14318?grpc=14317"
OTEL_EXPORTER_OTLP_COMPRESSION: gzip
OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION: BASE2_EXPONENTIAL_BUCKET_HISTOGRAM
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE: DELTA
OTEL_TRACES_SAMPLER: parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG: 0.001
tasks:
run:
deps:
- constructsserver
- optionsserver
- helloworld
- gateway
gateway:
cmds:
- KOD_CONFIG=./example/gateway/config.yaml go run ./cmd/gateway
constructsserver:
cmds:
- go run ./example/gateway/constructsserver
optionsserver:
cmds:
- go run ./example/gateway/optionsserver
helloworld:
cmds:
- go run ./example/gateway/helloworld
bench:
cmds:
- "ab -n 50000 -kc 500 -T 'application/json' -p test/post1.json http://localhost:8080/query"
bench2:
cmds:
- "ab -n 50000 -kc 500 -T 'application/json' -p test/post2.json http://localhost:8080/query"
bench3:
cmds:
- "ab -n 50000 -kc 500 'http://localhost:9090/say/bob'"
curl:
cmds:
- "curl 'http://localhost:8080/playground' -H 'Content-Type: application/json' --data-binary @test/post2.json -v"
curlhttp:
cmds:
- "curl 'http://localhost:9090/say/bob'"
test:
cmds:
- go test -race -cover -coverprofile=coverage.out -covermode=atomic ./... -v
sources:
- "**/**.go"
generates:
- coverage.out
test:coverage:
cmds:
- cat coverage.out | egrep -v "kod_|.pb.go|_test.go|example/gateway|/test|main.go|pkg/generator" > coverage.out.tmp
- mv coverage.out.tmp coverage.out
- go tool cover -func=coverage.out
deps:
- test
install:mockgen:
vars:
VERSION:
sh: |
cat go.mod|grep go.uber.org/mock |awk -F ' ' '{print $2}'
status:
- test -f mockgen
- go version -m $GOBIN/mockgen | grep go.uber.org/mock | grep {{.VERSION}}
cmd: |
go install go.uber.org/mock/mockgen@{{.VERSION}}
install:golangci-lint:
vars:
VERSION: v1.60.1
status:
- test -f golangci-lint
- go version -m $GOBIN/golangci-lint | grep github.com/golangci/golangci-lint | grep {{.VERSION}}
cmd: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@{{.VERSION}}
install:buf:
vars:
VERSION: v1.34.0
status:
- test -f buf
cmd: |
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/{{.VERSION}}/buf-$(uname -s)-$(uname -m)" \
-o "$GOBIN/buf" && \
chmod +x "$GOBIN/buf"
install:kod:
vars:
VERSION:
sh: |
cat go.mod|egrep "github.com/go-kod/kod " |awk -F ' ' '{print $2}'
status:
- test -f kod
- go version -m $GOBIN/kod | grep github.com/go-kod/kod | grep {{.VERSION}}
cmd: |
go install github.com/go-kod/kod/cmd/kod@{{.VERSION}}
mod:
cmds:
- go mod tidy
default:
cmds:
- task generate
- task golangci-lint
- task test:coverage
golangci-lint:
cmds:
- $GOBIN/golangci-lint run -v
deps:
- install:golangci-lint
generate:
cmds:
- $GOBIN/buf generate
- $GOBIN/kod generate -s ./...
deps:
- mod
- install:mockgen
- install:buf
- install:kod