-
Notifications
You must be signed in to change notification settings - Fork 39
733 lines (683 loc) · 29.1 KB
/
main.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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- "**"
jobs:
workflow-setup:
runs-on: ubuntu-20.04
outputs:
CACHE_KEY_API: ${{ steps.mainstep.outputs.CACHE_KEY_API }}
CACHE_KEY_WEBAPP: ${{ steps.mainstep.outputs.CACHE_KEY_WEBAPP }}
CACHE_KEY_DAEMON: ${{ steps.mainstep.outputs.CACHE_KEY_DAEMON }}
CACHE_KEY_DAEMON_UI: ${{ steps.mainstep.outputs.CACHE_KEY_DAEMON_UI }}
DOCKER_IMG_NAME_API: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_API }}
DOCKER_IMG_NAME_WEBAPP: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_WEBAPP }}
DOCKER_IMG_NAME_DAEMON: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_DAEMON }}
DOCKER_IMG_NAME_DAEMON_UI: ${{ steps.mainstep.outputs.DOCKER_IMG_NAME_DAEMON_UI }}
PUBLISH_VERSION: ${{ steps.mainstep.outputs.PUBLISH_VERSION }}
RELEASE: ${{ steps.mainstep.outputs.RELEASE }}
PRERELEASE: ${{ steps.mainstep.outputs.PRERELEASE }}
steps:
- name: Git checkout
uses: actions/checkout@v1
- name: Set outputs
id: mainstep
run: |
set -x
if [[ -z "$GITHUB_HEAD_REF" ]]; then # is set only if pipeline run is triggered as pull request
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
echo "Setting BRANCH_NAME=$BRANCH_NAME because this pipeline is run as Push"
else
BRANCH_NAME=$GITHUB_HEAD_REF
echo "Setting BRANCH_NAME=$BRANCH_NAME because this pipeline is run as Pull Request"
fi
BRANCH_NAME=`echo $BRANCH_NAME | sed "s/[^[:alnum:]-]//g" | tr '[:upper:]' '[:lower:]'` # lowercase, only alphanumeric and dash
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "PR Labels: ${{ toJson(github.event.pull_request.labels.*.name) }}"
REPO_HEAD="${{ github.event.pull_request.head.repo.full_name }}" # source repository
REPO_BASE="${{ github.event.pull_request.head.base.full_name }}" # target repository
echo "This is pull request from $REPO_HEAD to $REPO_BASE"
if [[ "$REPO_HEAD" == "${{ github.repository }}" ]]; then
echo "This CI run is PR from non-forked repository."
IS_FORK="false";
else
echo "This is fork."
IS_FORK="true";
fi;
else
echo "Not PR so this is not fork."
IS_FORK="false";
fi;
REPO_VERSION_MOST_RECENT=$(git describe --tags --always --abbrev=0)
REPO_VERSION_DESIRED=`bash ./get-version.sh`
echo "Highest released version was: $REPO_VERSION_MOST_RECENT, desired version is: $REPO_VERSION_DESIRED"
RELEASE="false"
PRERELEASE="false"
if [[ "$IS_FORK" == "false" ]]; then
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "This PR has labels: ${{ toJson(github.event.pull_request.labels) }}"
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'pre-release') }}" == "true" ]]; then
PRERELEASE="true"
fi;
elif [[ "${{ github.event_name }}" == "push" ]]; then
if [[ "$BRANCH_NAME" == "master" && "$REPO_VERSION_DESIRED" != "$REPO_VERSION_MOST_RECENT" ]]; then
PUBLISH_VERSION="$REPO_VERSION_DESIRED"
RELEASE="true"
echo "This is push to master, and version was bumped from $REPO_VERSION_MOST_RECENT to $REPO_VERSION_DESIRED. Will publish a release of $REPO_VERSION_DESIRED."
fi;
fi;
if [[ -z "$PUBLISH_VERSION" ]]; then
PUBLISH_VERSION="$REPO_VERSION_MOST_RECENT-$BRANCH_NAME-${{ github.run_number }}"
fi;
echo "CI will publish artifacts at version: $PUBLISH_VERSION"
else
echo "This PR is from fork, nothing will be published because the CI wouldn't be able to access repo secrets to perform publish."
PUBLISH_VERSION=""
fi;
HASH_INDYSCAN_WEBAPP=${{ hashFiles('indyscan-webapp') }}
HASH_INDYSCAN_API=${{ hashFiles('indyscan-api') }}
HASH_INDYSCAN_API_CLIENT=${{ hashFiles('indyscan-api-client') }}
HASH_INDYSCAN_DAEMON=${{ hashFiles('indyscan-daemon') }}
HASH_INDYSCAN_DAEMON_API_CLIENT=${{ hashFiles('indyscan-daemon-api-client') }}
HASH_INDYSCAN_DAEMON_UI=${{ hashFiles('indyscan-daemon-ui') }}
HASH_INDYSCAN_STORAGE=${{ hashFiles('indyscan-storage') }}
HASH_INDYSCAN_TXTYPE=${{ hashFiles('indyscan-txtype') }}
REBUILD_SEED_API=1
REBUILD_SEED_WEBAPP=1
REBUILD_SEED_DAEMON=1
REBUILD_SEED_DAEMON_UI=2
echo "::set-output name=CACHE_KEY_API::$REBUILD_SEED_API-${HASH_INDYSCAN_API:0:12}-${HASH_INDYSCAN_STORAGE:0:12}-${HASH_INDYSCAN_TXTYPE:0:12}"
echo "::set-output name=CACHE_KEY_WEBAPP::$REBUILD_SEED_WEBAPP-${HASH_INDYSCAN_WEBAPP:0:12}-${HASH_INDYSCAN_API_CLIENT:0:12}-${HASH_INDYSCAN_TXTYPE:0:12}"
echo "::set-output name=CACHE_KEY_DAEMON::$REBUILD_SEED_DAEMON-${HASH_INDYSCAN_DAEMON:0:12}-${HASH_INDYSCAN_STORAGE:0:12}-${HASH_INDYSCAN_TXTYPE:0:12}"
echo "::set-output name=CACHE_KEY_DAEMON_UI::$REBUILD_SEED_DAEMON_UI-${HASH_INDYSCAN_DAEMON_UI:0:12}-${HASH_INDYSCAN_DAEMON_API_CLIENT:0:12}"
echo "::set-output name=DOCKER_IMG_NAME_API::indyscan-api"
echo "::set-output name=DOCKER_IMG_NAME_WEBAPP::indyscan-webapp"
echo "::set-output name=DOCKER_IMG_NAME_DAEMON::indyscan-daemon"
echo "::set-output name=DOCKER_IMG_NAME_DAEMON_UI::indyscan-daemon-ui"
echo "::set-output name=PUBLISH_VERSION::$PUBLISH_VERSION"
echo "::set-output name=RELEASE::$RELEASE"
echo "::set-output name=PRERELEASE::$PRERELEASE"
lint-and-test-storage:
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v1
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- name: Install dependencies
run: |
echo "Installing indyscan-storage"
(cd indyscan-storage && npm install)
- name: Linter
run: |
echo "Linting indyscan-storage"
(cd indyscan-storage && npm run lint)
- name: Unit tests
run: |
echo "Unit testing indyscan-storage"
(cd indyscan-storage && npm run test:unit)
lint-and-test-txtype:
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v1
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- name: Install dependencies
run: |
echo "Installing indyscan-txtype"
(cd indyscan-txtype && npm install)
- name: Linter
run: |
echo "Linting indyscan-txtype"
(cd indyscan-txtype && npm run lint)
- name: Unit tests
run: |
echo "Unit testing indyscan-txtype"
(cd indyscan-txtype && npm run test:unit)
lint-and-test-api-client:
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v1
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- name: Install dependencies
run: |
echo "Installing indyscan-api-client"
(cd indyscan-api-client && npm install)
- name: Linter
run: |
echo "Linting indyscan-api-client"
(cd indyscan-api-client && npm run lint)
- name: Unit tests
run: |
echo "Unit testing indyscan-ap-client"
(cd indyscan-api-client && npm run test:unit)
lint-and-test-api:
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v1
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- name: Install dependencies
run: |
echo "Installing indyscan-storage"
(cd indyscan-storage && npm install)
echo "Installing indyscan-txtype"
(cd indyscan-txtype && npm install)
echo "Installing indyscan-api"
(cd indyscan-api && npm install)
- name: Linter
run: |
echo "Linting indyscan-api"
(cd indyscan-api && npm run lint)
- name: Unit tests
run: |
echo "Unit testing indyscan-api"
(cd indyscan-api && npm run test:unit)
lint-and-test-webapp:
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v1
- uses: actions/setup-node@v3
with:
node-version: 12
- name: Branch name
run: echo running on branch ${GITHUB_REF##*/}
- name: Install dependencies
run: |
echo "Installing indyscan-webapp"
(cd indyscan-webapp && npm install)
# - name: Linter # TEMPORARILY DISABLED: Some problems after latest audit fix, standardjs failing to lint on this project
# run: |
# echo "Linting indyscan-webapp"
# (cd indyscan-webapp && npm run lint)
- name: Unit tests
run: |
echo "Unit testing indyscan-webapp"
(cd indyscan-webapp && npm run test:unit)
build-docker-api:
needs: workflow-setup
runs-on: ubuntu-20.04
env:
DOCKER_BUILDKIT: 1
CACHE_KEY_API: ${{ needs.workflow-setup.outputs.CACHE_KEY_API }}
DOCKER_IMG_NAME_API: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_API }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Try load from cache.
id: cache-image
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_API }}
- name: If NOT found in cache, build and cache image.
if: steps.cache-image.outputs.cache-hit != 'true'
run: |
set -x
docker build \
-f indyscan-api/Dockerfile \
-t "$DOCKER_IMG_NAME_API" \
.
mkdir -p /tmp/docker
docker save "$DOCKER_IMG_NAME_API" > "/tmp/docker/$DOCKER_IMG_NAME_API.rar"
- name: Load image from cache
run: |
docker load < "/tmp/docker/$DOCKER_IMG_NAME_API.rar"
- name: Verify image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_API" || { echo "Image $DOCKER_IMG_NAME_API was not found!" ; exit 1; }
build-docker-webapp:
needs: workflow-setup
runs-on: ubuntu-20.04
env:
DOCKER_BUILDKIT: 1
CACHE_KEY_WEBAPP: ${{ needs.workflow-setup.outputs.CACHE_KEY_WEBAPP }}
DOCKER_IMG_NAME_WEBAPP: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_WEBAPP }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Try load from cache.
id: cache-image
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_WEBAPP }}
- name: If NOT found in cache, build and cache image.
if: steps.cache-image.outputs.cache-hit != 'true'
run: |
set -x
docker build \
-f indyscan-webapp/Dockerfile \
-t "$DOCKER_IMG_NAME_WEBAPP" \
.
mkdir -p /tmp/docker
docker save "$DOCKER_IMG_NAME_WEBAPP" > "/tmp/docker/$DOCKER_IMG_NAME_WEBAPP.rar"
- name: Load image from cache
run: |
docker load < "/tmp/docker/$DOCKER_IMG_NAME_WEBAPP.rar"
- name: Verify image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_WEBAPP" || { echo "Image $DOCKER_IMG_NAME_WEBAPP was not found!" ; exit 1; }
build-docker-daemon:
needs: [workflow-setup]
runs-on: ubuntu-20.04
env:
DOCKER_BUILDKIT: 1
CACHE_KEY_DAEMON: ${{ needs.workflow-setup.outputs.CACHE_KEY_DAEMON }}
DOCKER_IMG_NAME_DAEMON: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_DAEMON }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Try load from cache.
id: cache-image
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_DAEMON }}
- name: If NOT found in cache, build and cache image.
if: steps.cache-image.outputs.cache-hit != 'true'
run: |
set -x
docker build \
-f indyscan-daemon/Dockerfile \
-t "$DOCKER_IMG_NAME_DAEMON" \
.
mkdir -p /tmp/docker
docker save "$DOCKER_IMG_NAME_DAEMON" > "/tmp/docker/$DOCKER_IMG_NAME_DAEMON.rar"
- name: Load image from cache
run: |
docker load < "/tmp/docker/$DOCKER_IMG_NAME_DAEMON.rar"
- name: Verify image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_DAEMON" || { echo "Image $DOCKER_IMG_NAME_DAEMON was not found!" ; exit 1; }
build-docker-daemon-ui:
needs: workflow-setup
runs-on: ubuntu-20.04
env:
DOCKER_BUILDKIT: 1
CACHE_KEY_DAEMON_UI: ${{ needs.workflow-setup.outputs.CACHE_KEY_DAEMON_UI }}
DOCKER_IMG_NAME_DAEMON_UI: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_DAEMON_UI }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Try load from cache.
id: cache-image
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_DAEMON_UI }}
- name: If NOT found in cache, build and cache image.
if: steps.cache-image.outputs.cache-hit != 'true'
run: |
set -x
docker build \
-f indyscan-daemon-ui/Dockerfile \
-t "$DOCKER_IMG_NAME_DAEMON_UI" \
.
mkdir -p /tmp/docker
docker save "$DOCKER_IMG_NAME_DAEMON_UI" > "/tmp/docker/$DOCKER_IMG_NAME_DAEMON_UI.rar"
- name: Load image from cache
run: |
docker load < "/tmp/docker/$DOCKER_IMG_NAME_DAEMON_UI.rar"
- name: Verify image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_DAEMON_UI" || { echo "Image $DOCKER_IMG_NAME_DAEMON_UI was not found!" ; exit 1; }
test-e2e-sovrin:
needs:
- workflow-setup
- build-docker-api
- build-docker-webapp
- build-docker-daemon
- build-docker-daemon-ui
runs-on: ubuntu-20.04
env:
DOCKER_BUILDKIT: 1
CACHE_KEY_API: ${{ needs.workflow-setup.outputs.CACHE_KEY_API }}
DOCKER_IMG_NAME_API: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_API }}
CACHE_KEY_WEBAPP: ${{ needs.workflow-setup.outputs.CACHE_KEY_WEBAPP }}
DOCKER_IMG_NAME_WEBAPP: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_WEBAPP }}
CACHE_KEY_DAEMON: ${{ needs.workflow-setup.outputs.CACHE_KEY_DAEMON }}
DOCKER_IMG_NAME_DAEMON: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_DAEMON }}
CACHE_KEY_DAEMON_UI: ${{ needs.workflow-setup.outputs.CACHE_KEY_DAEMON_UI }}
DOCKER_IMG_NAME_DAEMON_UI: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_DAEMON_UI }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Try load from cache.
id: load-image-api
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_API }}
- name: If NOT found in cache, build and cache image.
if: steps.load-image-api.outputs.cache-hit != 'true'
run: |
echo "Image not found"
- name: Load image from cache
run: |
docker load < /tmp/docker/$DOCKER_IMG_NAME_API.rar
- name: Verify image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_API" || { echo "Image $DOCKER_IMG_NAME_API was not found!" ; exit 1; }
- name: Try load from cache.
id: load-image-webapp
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_WEBAPP }}
- name: If NOT found in cache, build and cache image.
if: steps.load-image-webapp.outputs.cache-hit != 'true'
run: |
echo "Image not found"
- name: Load image from cache
run: |
docker load < /tmp/docker/$DOCKER_IMG_NAME_WEBAPP.rar
- name: Verify image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_WEBAPP" || { echo "Image $DOCKER_IMG_NAME_WEBAPP was not found!" ; exit 1; }
- name: Try load from cache.
id: load-image-daemon
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_DAEMON }}
- name: If NOT found in cache, build and cache image.
if: steps.load-image-daemon.outputs.cache-hit != 'true'
run: |
echo "Image not found"
- name: Load image from cache
run: |
docker load < /tmp/docker/$DOCKER_IMG_NAME_DAEMON.rar
- name: Verify image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_DAEMON" || { echo "Image $DOCKER_IMG_NAME_DAEMON was not found!" ; exit 1; }
- name: Try load from cache.
id: load-image-daemon-ui
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_DAEMON_UI }}
- name: If NOT found in cache, build and cache image.
if: steps.load-image-daemon-ui.outputs.cache-hit != 'true'
run: |
echo "Image not found"
- name: Load image from cache
run: |
docker load < /tmp/docker/$DOCKER_IMG_NAME_DAEMON_UI.rar
- name: Verify image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_DAEMON_UI" || { echo "Image $DOCKER_IMG_NAME_DAEMON_UI was not found!" ; exit 1; }
- name: Run indyscan
run: |
cd ci/integration-sovrin && make new && sleep 30
- name: Query indyscan-api
run: |
curl -vv -H "Content-Type: application/json" http://localhost:3708/api/networks/SOVRIN_STAGINGNET/ledgers/domain/txs/5
exit_status=$?
if [ $exit_status -eq 1 ]; then
exit -1
fi
- name: Query indyscan-webapp
run: |
curl -vv -H "Content-Type: application/json" http://localhost:3707/home/SOVRIN_STAGINGNET
exit_status=$?
if [ $exit_status -eq 1 ]; then
exit -1
fi
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
with:
dest: './logs'
- name: Tar logs
if: failure()
run: tar cvzf ./logs.tgz ./logs
- name: Upload logs to GitHub
if: failure()
uses: actions/upload-artifact@v2
with:
name: logs-test-libvcx-mysql-integration
path: ./logs.tgz
publish-docker-api:
runs-on: ubuntu-20.04
needs: [workflow-setup, build-docker-api]
env:
CACHE_KEY_API: ${{ needs.workflow-setup.outputs.CACHE_KEY_API }}
DOCKER_IMG_NAME_API: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_API }}
PUBLISH_VERSION: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Load image cache
id: load-cached-image
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_API }}
- name: If no cached image found
if: steps.load-cached-image.outputs.cache-hit != 'true'
run: echo "ERROR == Expected to find image from cache $CACHE_KEY_API"; exit -1
- name: Load image from cache
run: docker load < /tmp/docker/$DOCKER_IMG_NAME_API.rar
- name: Verify libvcx image were loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_API" || { echo "Image $DOCKER_IMG_NAME_API was not found!" ; exit 1; }
- name: Docker Login
uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: $GITHUB_ACTOR
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish image
run: |
if [[ "$PUBLISH_VERSION" ]]
then
IFS=$':' read -a arr <<< $DOCKER_IMG_NAME_API
DOCKER_IMG_NAME_TAGLESS=${arr[0]}
GITHUB_REPOSITORY_LOWERCASE=`echo $GITHUB_REPOSITORY | awk '{print tolower($0)}'`
REMOTE_DOCKER_IMG_NAME="docker.pkg.github.com/${GITHUB_REPOSITORY_LOWERCASE}/${DOCKER_IMG_NAME_TAGLESS}:${PUBLISH_VERSION}"
echo "Publishing image $REMOTE_DOCKER_IMG_NAME"
docker tag "$DOCKER_IMG_NAME_API" "$REMOTE_DOCKER_IMG_NAME"
docker push "$REMOTE_DOCKER_IMG_NAME" || true
else
echo "New version was not defined, skipping release."
fi
publish-docker-webapp:
runs-on: ubuntu-20.04
needs: [workflow-setup, build-docker-webapp]
env:
CACHE_KEY_WEBAPP: ${{ needs.workflow-setup.outputs.CACHE_KEY_WEBAPP }}
DOCKER_IMG_NAME_WEBAPP: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_WEBAPP }}
PUBLISH_VERSION: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Load image cache
id: load-cached-image
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_WEBAPP }}
- name: If no cached image found
if: steps.load-cached-image.outputs.cache-hit != 'true'
run: echo "ERROR == Expected to find image from cache $CACHE_KEY_WEBAPP"; exit -1
- name: Load image from cache
run: docker load < /tmp/docker/$DOCKER_IMG_NAME_WEBAPP.rar
- name: Verify libvcx image were loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_WEBAPP" || { echo "Image $DOCKER_IMG_NAME_WEBAPP was not found!" ; exit 1; }
- name: Docker Login
uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: $GITHUB_ACTOR
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish image
run: |
if [[ "$PUBLISH_VERSION" ]]
then
IFS=$':' read -a arr <<< $DOCKER_IMG_NAME_WEBAPP
DOCKER_IMG_NAME_TAGLESS=${arr[0]}
GITHUB_REPOSITORY_LOWERCASE=`echo $GITHUB_REPOSITORY | awk '{print tolower($0)}'`
REMOTE_DOCKER_IMG_NAME="docker.pkg.github.com/${GITHUB_REPOSITORY_LOWERCASE}/${DOCKER_IMG_NAME_TAGLESS}:${PUBLISH_VERSION}"
echo "Publishing image $REMOTE_DOCKER_IMG_NAME"
docker tag "$DOCKER_IMG_NAME_WEBAPP" "$REMOTE_DOCKER_IMG_NAME"
docker push "$REMOTE_DOCKER_IMG_NAME" || true
else
echo "New version was not defined, skipping release."
fi
publish-docker-daemon:
runs-on: ubuntu-20.04
needs: [workflow-setup, build-docker-daemon]
env:
CACHE_KEY_DAEMON: ${{ needs.workflow-setup.outputs.CACHE_KEY_DAEMON }}
DOCKER_IMG_NAME_DAEMON: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_DAEMON }}
PUBLISH_VERSION: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Load image cache
id: load-cached-image
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_DAEMON }}
- name: If no cached image found
if: steps.load-cached-image.outputs.cache-hit != 'true'
run: echo "ERROR == Expected to find image from cache $CACHE_KEY_DAEMON"; exit -1
- name: Load image from cache
run: docker load < /tmp/docker/$DOCKER_IMG_NAME_DAEMON.rar
- name: Verify libvcx image were loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_DAEMON" || { echo "Image $DOCKER_IMG_NAME_DAEMON was not found!" ; exit 1; }
- name: Docker Login
uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: $GITHUB_ACTOR
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish image
run: |
if [[ "$PUBLISH_VERSION" ]]
then
IFS=$':' read -a arr <<< $DOCKER_IMG_NAME_DAEMON
DOCKER_IMG_NAME_TAGLESS=${arr[0]}
GITHUB_REPOSITORY_LOWERCASE=`echo $GITHUB_REPOSITORY | awk '{print tolower($0)}'`
REMOTE_DOCKER_IMG_NAME="docker.pkg.github.com/${GITHUB_REPOSITORY_LOWERCASE}/${DOCKER_IMG_NAME_TAGLESS}:${PUBLISH_VERSION}"
echo "Publishing image $REMOTE_DOCKER_IMG_NAME"
docker tag "$DOCKER_IMG_NAME_DAEMON" "$REMOTE_DOCKER_IMG_NAME"
docker push "$REMOTE_DOCKER_IMG_NAME" || true
else
echo "New version was not defined, skipping release."
fi
publish-docker-daemon-ui:
runs-on: ubuntu-20.04
needs: [workflow-setup, build-docker-daemon-ui]
env:
CACHE_KEY_DAEMON_UI: ${{ needs.workflow-setup.outputs.CACHE_KEY_DAEMON_UI }}
DOCKER_IMG_NAME_DAEMON_UI: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_DAEMON_UI }}
PUBLISH_VERSION: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Load image cache
id: load-cached-image
uses: actions/cache@v2
with:
path: /tmp/docker
key: ${{ env.CACHE_KEY_DAEMON_UI }}
- name: If no cached image found
if: steps.load-cached-image.outputs.cache-hit != 'true'
run: echo "ERROR == Expected to find image from cache $CACHE_KEY_DAEMON_UI"; exit -1
- name: Load image from cache
run: docker load < /tmp/docker/$DOCKER_IMG_NAME_DAEMON_UI.rar
- name: Verify libvcx image were loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_DAEMON_UI" || { echo "Image $DOCKER_IMG_NAME_DAEMON_UI was not found!" ; exit 1; }
- name: Docker Login
uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: $GITHUB_ACTOR
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish image
run: |
if [[ "$PUBLISH_VERSION" ]]
then
IFS=$':' read -a arr <<< $DOCKER_IMG_NAME_DAEMON_UI
DOCKER_IMG_NAME_TAGLESS=${arr[0]}
GITHUB_REPOSITORY_LOWERCASE=`echo $GITHUB_REPOSITORY | awk '{print tolower($0)}'`
REMOTE_DOCKER_IMG_NAME="docker.pkg.github.com/${GITHUB_REPOSITORY_LOWERCASE}/${DOCKER_IMG_NAME_TAGLESS}:${PUBLISH_VERSION}"
echo "Publishing image $REMOTE_DOCKER_IMG_NAME"
docker tag "$DOCKER_IMG_NAME_DAEMON_UI" "$REMOTE_DOCKER_IMG_NAME"
docker push "$REMOTE_DOCKER_IMG_NAME" || true
else
echo "New version was not defined, skipping release."
fi
make-release:
runs-on: ubuntu-20.04
needs:
- workflow-setup
- lint-and-test-storage
- lint-and-test-txtype
- lint-and-test-api-client
- lint-and-test-api
- lint-and-test-webapp
- publish-docker-api
- publish-docker-webapp
- publish-docker-daemon
- publish-docker-daemon-ui
if: ${{ needs.workflow-setup.outputs.RELEASE == 'true' || needs.workflow-setup.outputs.PRERELEASE == 'true' }}
outputs:
RELEASE_UPLOAD_URL: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Generate changelog
uses: heinrichreimer/github-changelog-generator-action@v2.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
futureRelease: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}
releaseBranch: master
pullRequests: true
unreleased: true
unreleasedOnly: true
issuesWoLabels: true
prWoLabels: true
stripGeneratorNotice: true
stripHeaders: false
maxIssues: 50
excludeLabels: duplicate,question,invalid,wontfix,changelog-excluded
breakingLabels: backwards-incompatible,breaking
deprecatedLabels: deprecated
headerLabel: "# Changelog"
breakingLabel: '### Breaking changes'
enhancementLabel: '### Enhancements'
bugsLabel: '### Bug fixes'
deprecatedLabel: '### Deprecations'
removedLabel: '### Removals'
securityLabel: '### Security fixes'
issuesLabel: '### Other issues'
prLabel: '### Other pull requests'
addSections: '{"ci":{"prefix":"### CI changes","labels":["ci"]}}'
excludeTagsRegex: '^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))+)?)$'
- name: Create a new release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}
release_name: Release ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }}
body_path: ./CHANGELOG.md
draft: ${{ needs.workflow-setup.outputs.PRERELEASE == 'true' }}
prerelease: ${{ needs.workflow-setup.outputs.PRERELEASE == 'true' }}