This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathconfig.yml
396 lines (377 loc) · 11.1 KB
/
config.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
---
# Modified by SignalFx
version: 2.1
references:
goexecutor: &goexecutor
image: circleci/golang:1.16
workdir: &workdir
working_directory: /home/circleci/signalfx-go-tracing
executors:
go:
<<: *workdir
docker:
- *goexecutor
go_cassandra:
<<: *workdir
docker:
- *goexecutor
- image: cassandra:3.7
environment:
MAX_HEAP_SIZE: 256m
HEAP_NEWSIZE: 64m
go_elasticsearch:
<<: *workdir
docker:
- *goexecutor
- image: elasticsearch:2
environment:
ES_JAVA_OPTS: "-Xms256m -Xmx256m" # https://github.com/10up/wp-local-docker/issues/6
- image: elasticsearch:5
environment:
ES_JAVA_OPTS: "-Xms256m -Xmx256m" # https://github.com/10up/wp-local-docker/issues/6
go_kafka_zookeeper:
<<: *workdir
docker:
- *goexecutor
- image: confluentinc/cp-zookeeper:5.0.0
environment:
ZOOKEEPER_CLIENT_PORT: "2181"
- image: confluentinc/cp-kafka:5.0.0
environment:
KAFKA_ZOOKEEPER_CONNECT: localhost:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
KAFKA_CREATE_TOPICS: gotest:1:1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: "1"
go_memcached:
<<: *workdir
docker:
- *goexecutor
- image: memcached:1.5.9
go_mongo:
<<: *workdir
docker:
- *goexecutor
- image: circleci/mongo:latest-ram
go_redis:
<<: *workdir
docker:
- *goexecutor
- image: redis:3.2
go_sql:
<<: *workdir
docker:
- *goexecutor
- image: circleci/mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_PASSWORD: test
MYSQL_USER: test
MYSQL_DATABASE: test
- image: circleci/postgres:9.5
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres
commands:
install_rdkafka:
description: Install rdkafka
parameters:
version:
description: rdkafka branch, tag, or commit id
type: string
default: 0d525ba1252074732aac575f88f04831f2656b8f
dest:
description: git clone destination directory
type: string
default: /tmp/rdkafka
steps:
- restore_cache:
keys:
- v1-rdkafka-<< parameters.version >>
- run:
name: Install rdkafka
command: |
if [ ! -d << parameters.dest >> ] ; then
echo "building librdkafka"
git clone -n https://github.com/edenhill/librdkafka.git << parameters.dest >>
cd << parameters.dest >> && git checkout << parameters.version >> && ./configure && make
fi
echo "installing librdkafka"
cd << parameters.dest >> && sudo make install
sudo ldconfig
- save_cache:
key: v1-rdkafka-<< parameters.version >>
paths:
- << parameters.dest >>
go_get:
parameters:
options:
type: string
default: -v -t
packages:
type: string
default: ./...
retries:
type: integer
default: 3
steps:
- run:
name: Fetching dependencies
command: |
RETRIES=<< parameters.retries >>
for (( i=0; i<$RETRIES; i++ )); do
go get << parameters.options >> << parameters.packages >> && exit 0
sleep 5
done
exit 1
get_deps:
description: Get project dependencies
steps:
- restore_cache:
keys:
- v1-gomod-{{ checksum "go.sum" }}-{{ checksum "contrib/google.golang.org/grpc.v12/go.sum" }}
- run:
name: Download packages
command: |
go mod download
cd contrib/google.golang.org/grpc.v12; go mod download
go install github.com/tebeka/[email protected]
- install_rdkafka:
version: 4ffe54b4f59ee5ae3767f9f25dc14651a3384d62
- save_cache:
key: v1-gomod-{{ checksum "go.sum" }}-{{ checksum "contrib/google.golang.org/grpc.v12/go.sum" }}
paths:
- /go/pkg/
dockerize_wait:
description: Wait for docker service to be ready
parameters:
address:
type: string
default: ""
timeout:
type: string
default: 1m
steps:
- run: dockerize -wait << parameters.address >> -timeout << parameters.timeout >>
save_test_results:
description: Collect and archive test results from `dir`.
parameters:
dir:
type: string
default: "~/testresults"
steps:
- store_test_results:
path: << parameters.dir >>
- store_artifacts:
path: << parameters.dir >>
jobs:
go_test:
description: Run go tests
parameters:
executor:
type: executor
default: go
before_deps:
type: steps
default: []
after_deps:
type: steps
default: []
options:
type: string
default: -v -race
module:
type: string
default: .
packages:
type: string
default: ./...
integration:
type: integer
default: 1
executor: << parameters.executor >>
steps:
- checkout
- steps: << parameters.before_deps >>
- get_deps
- steps: << parameters.after_deps >>
- run:
name: Run go tests
command: |
mkdir ~/testresults
export INTEGRATION=<< parameters.integration >>
cd << parameters.module >>
bash -euo pipefail -c "go test << parameters.options >> << parameters.packages >> | tee /dev/stderr | grep -v '\[no test files\]' | go2xunit" > ~/testresults/unit.xml
- save_test_results
lint_vet:
executor: go
steps:
- checkout
- get_deps
- run:
name: Run linter
command: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.24.0
ALL_MODULES=`find . -type f -name "go.mod" -exec dirname {} \; | sort`
for dir in ${ALL_MODULES}; do
echo "golangci-lint in ${dir}"
cd "${dir}"
GOGC=40 golangci-lint run --deadline 5m
cd - >/dev/null
done
workflows:
build_test:
jobs:
- lint_vet
- go_test:
name: test
- go_test:
name: test_aws
module: ./contrib/aws/aws-sdk-go/aws
- go_test:
name: test_memcached
executor: go_memcached
module: ./contrib/bradfitz/gomemcache/memcache
after_deps:
- dockerize_wait:
address: tcp://localhost:11211
- go_test:
name: test_confluent-kafka-go
executor: go_kafka_zookeeper
module: ./contrib/confluentinc/confluent-kafka-go/kafka
after_deps:
- dockerize_wait:
address: tcp://localhost:2181
- dockerize_wait:
address: tcp://localhost:9092
- go_test:
name: test_sql
executor: go_sql
module: ./contrib/database/sql
after_deps:
- dockerize_wait:
address: tcp://localhost:3306
- dockerize_wait:
address: tcp://localhost:5432
- go_test:
name: test_go-restful
module: ./contrib/emicklei/go-restful
- go_test:
name: test_redigo_old
executor: go_redis
module: ./contrib/garyburd/redigo
after_deps:
- dockerize_wait:
address: tcp://localhost:6379
- go_test:
name: test_gin
module: ./contrib/gin-gonic/gin
- go_test:
name: test_mongo_globalsign
executor: go_mongo
module: ./contrib/globalsign/mgo
after_deps:
- dockerize_wait:
address: tcp://localhost:27017
- go_test:
name: test_chi
module: ./contrib/go-chi/chi
- go_test:
name: test_redis
executor: go_redis
module: ./contrib/go-redis/redis
after_deps:
- dockerize_wait:
address: tcp://localhost:6379
# - go_test:
# name: test_cassandra
# executor: go_cassandra
# module: ./contrib/gocql/gocql
# after_deps:
# - dockerize_wait:
# address: tcp://localhost:9042
# timeout: 2m
- go_test:
name: test_redigo
executor: go_redis
module: ./contrib/gomodule/redigo
after_deps:
- dockerize_wait:
address: tcp://localhost:6379
- go_test:
name: test_google-api
module: ./contrib/google.golang.org/api
- go_test:
name: test_google-grpc
module: ./contrib/google.golang.org/grpc
- go_test:
name: test_google-grpc.v12
module: ./contrib/google.golang.org/grpc.v12
- go_test:
name: test_gorilla-mux
module: ./contrib/gorilla/mux
- go_test:
name: test_graphql-go
module: ./contrib/graph-gophers/graphql-go
- go_test:
name: test_gorm
executor: go_sql
module: ./contrib/jinzhu/gorm
after_deps:
- dockerize_wait:
address: tcp://localhost:3306
- dockerize_wait:
address: tcp://localhost:5432
- go_test:
name: test_sqlx
executor: go_sql
module: ./contrib/jmoiron/sqlx
after_deps:
- dockerize_wait:
address: tcp://localhost:3306
- dockerize_wait:
address: tcp://localhost:5432
- go_test:
name: test_julienschmidt-httprouter
module: ./contrib/julienschmidt/httprouter
- go_test:
name: test_kubernetes
module: ./contrib/k8s.io/client-go/kubernetes
- go_test:
name: test_echo
module: ./contrib/labstack/echo
- go_test:
name: test_echo.v4
module: ./contrib/labstack/echo.v4
- go_test:
name: test_miekg-dns
module: ./contrib/miekg/dns
- go_test:
name: test_mongo
executor: go_mongo
module: ./contrib/mongodb/mongo-go-driver/mongo
after_deps:
- dockerize_wait:
address: tcp://localhost:27017
- go_test:
name: test_http
module: ./contrib/net/http
- go_test:
name: test_elasticsearch
executor: go_elasticsearch
module: ./contrib/olivere/elastic
after_deps:
- dockerize_wait:
address: http://localhost:9200
- dockerize_wait:
address: http://localhost:9201
- go_test:
name: test_sarama
module: ./contrib/Shopify/sarama
- go_test:
name: test_leveldb
module: ./contrib/syndtr/goleveldb/leveldb
- go_test:
name: test_buntdb
module: ./contrib/tidwall/buntdb