-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathconfig.yml
More file actions
405 lines (341 loc) · 13.1 KB
/
config.yml
File metadata and controls
405 lines (341 loc) · 13.1 KB
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
397
398
399
400
401
402
403
404
405
version: 2
jobs:
build:
working_directory: /go/src/github.com/FactomProject/factomd
docker:
- image: circleci/golang:1.17.2
steps:
- checkout
- restore_cache:
keys:
- v3-factomd-go-build-cache-{{ checksum "go.sum" }}
- run:
name: Get goveralls
command: |
go get github.com/mattn/goveralls
- run:
name: Build and install the executable
command: make install && cp -r $GOPATH/ /tmp
- persist_to_workspace:
root: /tmp
paths: go
- save_cache:
key: v3-factomd-go-build-cache-{{ checksum "go.sum" }}
paths:
- "/tmp/go/pkg/mod"
test:
working_directory: /tmp
docker:
- image: circleci/golang:1.17.2
parallelism: 1
steps:
- attach_workspace:
at: /tmp
- run:
name: Run Tests!
no_output_timeout: 2400
command: |
export PATH="/tmp/go/bin:$PATH"
export GOPATH=/tmp/go
export GOROOT=/usr/local/go
cd /tmp/go/src/github.com/FactomProject/factomd/
./test.sh short
test_full:
working_directory: /tmp
docker:
- image: circleci/golang:1.17.2
parallelism: 1
steps:
- attach_workspace:
at: /tmp
- run:
name: Run Full Tests!
no_output_timeout: 2400
command: |
export PATH="/tmp/go/bin:$PATH"
export GOPATH=/tmp/go
cd /tmp/go/src/github.com/FactomProject/factomd/
./test.sh full
coveralls:
working_directory: /tmp
docker:
- image: circleci/golang:1.17.2
steps:
- attach_workspace:
at: /tmp
- run:
name: Go Test with Coverage
no_output_timeout: 2400
command: |
export PATH="/tmp/go/bin:$PATH"
export GOPATH=/tmp/go
cd /tmp/go/src/github.com/FactomProject/factomd/
go test $( go list ./... | grep -v 'Utilities|longTest|peerTest|simTest') -vet=off -v -cover -coverprofile=coverage.out
goveralls -coverprofile=coverage.out -service=circle-ci -repotoken=$COVERALLS_TOKEN
gofmt:
working_directory: /tmp
docker:
- image: circleci/golang:1.17.2
steps:
- attach_workspace:
at: /tmp
- run:
name: Gofmt test
no_output_timeout: 60
command: |
export PATH="/tmp/go/bin:$PATH"
export GOPATH=/tmp/go
cd /tmp/go/src/github.com/FactomProject/factomd/
./test.sh gofmt
# Docker builds
docker_build:
working_directory: /go/src/github.com/FactomProject/factomd
docker:
- image: factominc/elixir_python
steps:
- checkout
- setup_remote_docker:
version: 20.10.7
- restore_cache:
keys:
- v6-factomd-cache-{{ checksum "go.sum" }}
# Load the images if the cache hit
- run:
name: Load Docker image layer cache
command: |
set +o pipefail
docker load -i /images/factomd-alpine.tar | true
docker load -i /images/factomd.tar | true
# Build the containers
- run:
name: Build the baseline images
command: |
docker build -t factomd-alpine -f Dockerfile.alpine .
docker build -t factomd -f Dockerfile .
# Push, depending on branch/tag
- run:
name: Push special branches to DockerHub
command: |
# Login to DockerHub
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
# If there is a tag, use it
if [ "$CIRCLE_TAG" != "" ]; then
docker tag factomd factominc/factomd:${CIRCLE_TAG}
docker push factominc/factomd:${CIRCLE_TAG}
docker tag factomd-alpine factominc/factomd:${CIRCLE_TAG}-alpine
docker push factominc/factomd:${CIRCLE_TAG}-alpine
fi
# Legacy master/develop images. Continue building and pushing until we know they aren't being used
if [ "${CIRCLE_BRANCH}" == "master" ]; then
# Tag master as latest
docker tag factomd factominc/factomd:latest
docker push factominc/factomd:latest
docker tag factomd-alpine factominc/factomd:alpine
docker push factominc/factomd:alpine
fi
if [ "${CIRCLE_BRANCH}" == "develop" ]; then
# Tag develop as develop anyhow
docker tag factomd factominc/factomd:develop
docker push factominc/factomd:develop
docker tag factomd-alpine factominc/factomd:alpine-develop
docker push factominc/factomd:alpine-develop
fi
# Push alternate named versions of the master and develop branches
if [ "${CIRCLE_BRANCH}" == "master" ]; then
# Tag master as master, although it is alredy pushed as the latest
# using the latest branch is frowned upon by some docer experts, so explicitly push master
docker tag factomd factominc/factomd:master
docker push factominc/factomd:master
docker tag factomd-alpine factominc/factomd:master-alpine
docker push factominc/factomd:master-alpine
fi
if [ "${CIRCLE_BRANCH}" == "develop" ]; then
# push develop on ansible again, but with the name concatenated like the rest of the tags
docker tag factomd-alpine factominc/factomd:develop-alpine
docker push factominc/factomd:develop-alpine
fi
#push special branches if they exist
if [ "${CIRCLE_BRANCH}" == "master-staging" ]; then
# push a branch that can be used to test a pre-release version of master just before it is released.
docker tag factomd factominc/factomd:master-staging
docker push factominc/factomd:master-staging
docker tag factomd-alpine factominc/factomd:master-staging-alpine
docker push factominc/factomd:master-staging-alpine
fi
if [ "${CIRCLE_BRANCH}" == "community-testnet-staging" ]; then
docker tag factomd factominc/factomd:community-testnet-staging
docker push factominc/factomd:community-testnet-staging
docker tag factomd-alpine factominc/factomd:community-testnet-staging-alpine
docker push factominc/factomd:community-testnet-staging-alpine
fi
if [ "${CIRCLE_BRANCH}" == "community-testnet" ]; then
docker tag factomd factominc/factomd:community-testnet
docker push factominc/factomd:community-testnet
docker tag factomd-alpine factominc/factomd:community-testnet-alpine
docker push factominc/factomd:community-testnet-alpine
fi
if [ "${CIRCLE_BRANCH}" == "experimental1" ]; then
docker tag factomd factominc/factomd:experimental1
docker push factominc/factomd:experimental1
docker tag factomd-alpine factominc/factomd:experimental1-alpine
docker push factominc/factomd:experimental1-alpine
fi
if [ "${CIRCLE_BRANCH}" == "experimental2" ]; then
docker tag factomd factominc/factomd:experimental2
docker push factominc/factomd:experimental2
docker tag factomd-alpine factominc/factomd:experimental2-alpine
docker push factominc/factomd:experimental2-alpine
fi
if [ "${CIRCLE_BRANCH}" == "qa1" ]; then
docker tag factomd factominc/factomd:qa1
docker push factominc/factomd:qa1
docker tag factomd-alpine factominc/factomd:qa1-alpine
docker push factominc/factomd:qa1-alpine
fi
if [ "${CIRCLE_BRANCH}" == "qa2" ]; then
docker tag factomd factominc/factomd:qa2
docker push factominc/factomd:qa2
docker tag factomd-alpine factominc/factomd:qa2-alpine
docker push factominc/factomd:qa2-alpine
fi
if [ "${CIRCLE_BRANCH}" == "qa3" ]; then
docker tag factomd factominc/factomd:qa3
docker push factominc/factomd:qa3
docker tag factomd-alpine factominc/factomd:qa3-alpine
docker push factominc/factomd:qa3-alpine
fi
if [ "${CIRCLE_BRANCH}" == "devnet1" ]; then
docker tag factomd factominc/factomd:devnet1
docker push factominc/factomd:devnet1
docker tag factomd-alpine factominc/factomd:devnet1-alpine
docker push factominc/factomd:devnet1-alpine
fi
if [ "${CIRCLE_BRANCH}" == "devnet2" ]; then
docker tag factomd factominc/factomd:devnet2
docker push factominc/factomd:devnet2
docker tag factomd-alpine factominc/factomd:devnet2-alpine
docker push factominc/factomd:devnet2-alpine
fi
if [ "${CIRCLE_BRANCH}" == "devnet3" ]; then
docker tag factomd factominc/factomd:devnet3
docker push factominc/factomd:devnet3
docker tag factomd-alpine factominc/factomd:devnet3-alpine
docker push factominc/factomd:devnet3-alpine
fi
docker logout
- run:
name: Push images to AWS ECR
command: |
# Login to AWS ECR
login="$(aws ecr get-login --no-include-email --region $AWS_REGION)"
${login}
# If there is a tag, use it
if [ "$CIRCLE_TAG" != "" ]; then
docker tag factomd ${AWS_REPO_BASE_URI}/factomd:${CIRCLE_TAG}
docker push ${AWS_REPO_BASE_URI}/factomd:${CIRCLE_TAG}
docker tag factomd-alpine ${AWS_REPO_BASE_URI}/factomd:${CIRCLE_TAG}-alpine
docker push ${AWS_REPO_BASE_URI}/factomd:${CIRCLE_TAG}-alpine
fi
if [ "${CIRCLE_BRANCH}" == "master" ]; then
# Tag master as latest
docker tag factomd ${AWS_REPO_BASE_URI}/factomd:latest
docker push ${AWS_REPO_BASE_URI}/factomd:latest
docker tag factomd-alpine ${AWS_REPO_BASE_URI}/factomd:alpine
docker push ${AWS_REPO_BASE_URI}/factomd:alpine
fi
if [ "${CIRCLE_BRANCH}" == "develop" ]; then
# Tag develop as develop anyhow
docker tag factomd ${AWS_REPO_BASE_URI}/factomd:develop
docker push ${AWS_REPO_BASE_URI}/factomd:develop
docker tag factomd-alpine ${AWS_REPO_BASE_URI}/factomd:alpine-develop
docker push ${AWS_REPO_BASE_URI}/factomd:alpine-develop
fi
docker logout
- run:
name: Save the image cache
command: |
mkdir -p /images
docker save -o /images/factomd-alpine.tar factomd-alpine $(docker history -q factomd-alpine |grep -v missing | grep -v none)
docker save -o /images/factomd.tar factomd $(docker history -q factomd |grep -v missing | grep -v none)
- save_cache:
key: v6-factomd-cache-{{ checksum "go.sum" }}
paths:
- /images
govet:
docker:
- image: circleci/golang:1.17.2
steps:
- checkout
- run:
name: "Go vet"
command: go vet $(go list ./... | grep -v -e /Utilities -e /ET2)
workflows:
version: 2
commit-workflow:
jobs:
- build:
filters:
tags:
only: /.*/
- gofmt:
filters:
tags:
only: /.*/
requires:
- build
- govet:
filters:
tags:
only: /.*/
requires:
- build
- test:
filters:
tags:
only: /.*/
requires:
- build
- docker_build:
filters:
branches:
only:
- develop
- master
- master-staging
- community-testnet-staging
- community-testnet
- experimental1
- experimental2
- qa1
- qa2
- qa3
- devnet1
- devnet2
- devnet3
tags:
only: /.*/
context: org-global
requires:
- test
scheduled-workflow:
triggers:
- schedule:
cron: "20 5 * * *"
filters:
branches:
only: /.*develop.*/
jobs:
- build
- gofmt:
requires:
- build
- govet:
requires:
- build
- test_full:
requires:
- build
- docker_build:
context: org-global
requires:
- test_full