-
Notifications
You must be signed in to change notification settings - Fork 182
980 lines (900 loc) · 33.8 KB
/
ci.yaml
File metadata and controls
980 lines (900 loc) · 33.8 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
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
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
name: CI
on:
push:
tags:
- "v*.*.*"
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
checks: write
pull-requests: write
actions: read
contents: read
env:
BUILD_TARGET: "x86_64-unknown-linux-gnu"
WASM_RQUICKJS_VERSION: "0.0.23"
jobs:
build-and-store:
env:
CARGO_BUILD_JOBS: 20
runs-on: blacksmith-32vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v4-rust
shared-key: debug
cache-all-crates: true
save-if: true
- uses: davidB/rust-cargo-make@v1
- uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: Building all executables
env:
QUIET: true
run: cargo make --profile ci build-all-bins-including-tests
timeout-minutes: 15
# - name: Mount binary store
# uses: useblacksmith/stickydisk@v1
# with:
# key: golem-binaries-${{ github.run_id }}
# path: ~/golem-binaries-cache
- name: Packaging all binaries with cargo-nextest
run: |
mkdir -pv tmp
cargo nextest -v archive --archive-file tmp/golem-binaries.tar.zst --zstd-level -7 --cargo-profile dev-ci
timeout-minutes: 5
- name: Extract archive
run: |
mkdir tmp/golem-binaries
tar --zstd -xvf tmp/golem-binaries.tar.zst -C tmp/golem-binaries
timeout-minutes: 2
# - name: Move archive to sticky disk
# run: mv tmp/golem-binaries.tar.zst ~/golem-binaries-cache/golem-binaries.tar.zst
- name: Save packaged binaries to cache
uses: actions/cache/save@v4
with:
path: tmp/golem-binaries
key: golem-binaries-${{ github.run_id }}
check-clippy-and-format:
env:
CARGO_BUILD_JOBS: 10
runs-on: blacksmith-8vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v4-rust
shared-key: debug
cache-all-crates: true
save-if: false
- uses: davidB/rust-cargo-make@v1
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: Check formatting and clippy rules
run: cargo make --profile ci check
unit-tests-and-checks:
env:
CARGO_BUILD_JOBS: 10
runs-on: blacksmith-8vcpu-ubuntu-2204
needs: build-and-store
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: davidB/rust-cargo-make@v1
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-test-r
run: cargo binstall --force --locked cargo-test-r@2.2.2
# - name: Restore binary archive
# uses: actions/download-artifact@v4
# with:
# name: all-bins-including-tests
# path: tmp/golem-binaries.tar.zst
- name: Restore packaged binaries to cache
uses: actions/cache/restore@v4
with:
path: tmp/golem-binaries
key: golem-binaries-${{ github.run_id }}
# - name: Mount binary store
# uses: useblacksmith/stickydisk@v1
# with:
# key: golem-binaries-${{ github.run_id }}
# path: ~/golem-binaries-cache
- name: Apply binary archive
run: cargo-test-r reuse-nextest-archive --archive-file tmp/golem-binaries
- name: Copy required binaries to target # TODO: this should be encoded in the makefile
run: |
mkdir -pv target/debug
find target/nextest-archive
find target/nextest-archive/target/dev-ci -maxdepth 1 -type f | xargs mv -t target/debug/
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: Check openapi is up to date
run: cargo make --profile ci check-openapi
- name: Check configs are up to date
run: cargo make --profile ci check-configs
- name: Unit tests
run: cargo make --profile ci unit-tests
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
if: always()
with:
report-path: "**/target/ctrf-*.json"
upload-artifact: 'true'
artifact-name: unit-tests-report
summary: true
summary-report: true
failed-report: true
slowest-report: true
github-report: true
# pull-request-report: true
flaky-report: true
collapse-large-reports: true
exit-on-no-files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
worker-tests:
env:
CARGO_BUILD_JOBS: 10
runs-on: blacksmith-8vcpu-ubuntu-2204
needs: build-and-store
strategy:
fail-fast: false
matrix:
group:
- name: misc
- name: group1
- name: group2
name: worker-tests-${{ matrix.group.name }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: davidB/rust-cargo-make@v1
- uses: cargo-bins/cargo-binstall@main
- name: Setup Redis
uses: shogo82148/actions-setup-redis@v1.35.1
with:
redis-version: latest
auto-start: false
- name: Install cargo-test-r
run: cargo binstall --force --locked cargo-test-r@2.2.2
# - name: Restore binary archive
# uses: actions/download-artifact@v4
# with:
# name: all-bins-including-tests
# path: tmp/golem-binaries.tar.zst
- name: Restore packaged binaries to cache
uses: actions/cache/restore@v4
with:
path: tmp/golem-binaries
key: golem-binaries-${{ github.run_id }}
# - name: Mount binary store
# uses: useblacksmith/stickydisk@v1
# with:
# key: golem-binaries-${{ github.run_id }}
# path: ~/golem-binaries-cache
- name: Apply binary archive
run: cargo-test-r reuse-nextest-archive --archive-file tmp/golem-binaries
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: Worker Executor integration tests
run: cargo make --profile ci worker-executor-tests-${{ matrix.group.name }}
timeout-minutes: 15
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
if: always()
with:
report-path: "**/target/ctrf-*.json"
upload-artifact: 'true'
artifact-name: worker-executor-tests-${{ matrix.group.name }}-report
summary: true
summary-report: true
failed-report: true
slowest-report: true
github-report: true
# pull-request-report: true
flaky-report: true
collapse-large-reports: true
exit-on-no-files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
it:
env:
CARGO_BUILD_JOBS: 10
runs-on: ${{ matrix.group.runner || 'blacksmith-8vcpu-ubuntu-2204' }}
needs: build-and-store
strategy:
fail-fast: false
matrix:
group:
- name: integration-tests-group1
description: "IT #1"
- name: integration-tests-group2
description: "IT #2"
- name: integration-tests-group3
description: "IT #3"
- name: integration-tests-group4
description: "IT #4"
- name: cli-integration-tests-group1
description: "CLI tests #1"
- name: cli-integration-tests-group2
description: "CLI tests #2"
runner: blacksmith-16vcpu-ubuntu-2204
- name: cli-integration-tests-group3
description: "CLI tests #3"
runner: blacksmith-16vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: davidB/rust-cargo-make@v1
- name: Setup Redis
uses: shogo82148/actions-setup-redis@v1.35.1
with:
redis-version: latest
auto-start: false
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-component
if: startsWith(matrix.group.name, 'cli-integration-tests')
run: cargo binstall --force cargo-component@0.21.1
- name: Install wasm-tools
if: startsWith(matrix.group.name, 'cli-integration-tests')
run: cargo binstall --force --locked wasm-tools@1.227.1
- name: Install wit-bindgen
if: startsWith(matrix.group.name, 'cli-integration-tests')
run: cargo binstall --force --locked wit-bindgen-cli@0.40.0
- uses: pnpm/action-setup@v2
if: startsWith(matrix.group.name, 'cli-integration-tests')
with:
version: latest
- name: Install wasm-rquickjs
if: startsWith(matrix.group.name, 'cli-integration-tests')
run: cargo install wasm-rquickjs-cli --version $WASM_RQUICKJS_VERSION
- name: Install cargo-test-r
run: cargo binstall --force --locked cargo-test-r@2.2.2
# - name: Restore binary archive
# uses: actions/download-artifact@v4
# with:
# name: all-bins-including-tests
# path: tmp/golem-binaries.tar.zst
- name: Restore packaged binaries to cache
uses: actions/cache/restore@v4
with:
path: tmp/golem-binaries
key: golem-binaries-${{ github.run_id }}
# - name: Mount binary store
# uses: useblacksmith/stickydisk@v1
# with:
# key: golem-binaries-${{ github.run_id }}
# path: ~/golem-binaries-cache
- name: Apply binary archive
run: cargo-test-r reuse-nextest-archive --archive-file tmp/golem-binaries
- name: Copy required binaries to target # TODO: this should be encoded in the makefile
run: |
mkdir -pv target/debug
find target/nextest-archive/target/dev-ci -maxdepth 1 -type f | xargs mv -t target/debug/
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: ${{ matrix.group.description }}
env:
QUIET: true
run: cargo make --profile ci ${{ matrix.group.name }}
timeout-minutes: 20
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
if: always()
with:
report-path: "**/target/ctrf-*.json"
upload-artifact: 'true'
artifact-name: '${{ matrix.group.name }}-report'
summary: true
summary-report: true
failed-report: true
slowest-report: true
github-report: true
# pull-request-report: true
flaky-report: true
collapse-large-reports: true
exit-on-no-files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# cleanup:
# runs-on: blacksmith
# needs:
# - worker-tests
# - it
# - unit-tests-and-checks
# if: always()
# steps:
# - name: Delete sticky disk
# uses: useblacksmith/stickydisk-delete@v1
# with:
# delete-key: golem-binaries-${{ github.run_id }}
wasm-rpc-stub:
runs-on: blacksmith
env:
CARGO_BUILD_JOBS: 10
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-component
run: cargo binstall --force cargo-component@0.21.1
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v4-rust
shared-key: debug
cache-all-crates: true
save-if: false
- uses: davidB/rust-cargo-make@v1
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: Prepare WIT dependencies
run: cargo make wit
- name: Build wasm-rpc in stub mode
run: cargo component build -p golem-wasm --no-default-features --features stub
golem-client:
runs-on: blacksmith
env:
CARGO_BUILD_JOBS: 10
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: cargo-bins/cargo-binstall@main
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v4-rust
shared-key: debug
cache-all-crates: true
save-if: false
- uses: davidB/rust-cargo-make@v1
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: Prepare WIT dependencies
run: cargo make wit
- name: Build golem-client (dependencies in features=client mode)
run: cargo build -p golem-client
build-golem-rust:
runs-on: blacksmith
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v2-golem-rust
shared-key: debug
cache-all-crates: true
save-if: false
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Check formatting
run: cargo fmt -- --check
working-directory: sdks/rust
- name: Clippy
run: cargo clippy -- -Dwarnings
working-directory: sdks/rust
- name: Tests
run: cargo test --all-features
working-directory: sdks/rust
build-golem-ts:
runs-on: blacksmith
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: "20.x"
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-component
run: cargo binstall --force cargo-component@0.21.1
- name: Install wasm-rquickjs
run: cargo install wasm-rquickjs-cli --version $WASM_RQUICKJS_VERSION
- name: Install dependencies
working-directory: sdks/ts
run: |
pnpm install
- name: Check code quality
working-directory: sdks/ts
run: |
pnpm run lint || (
echo "Linting issues found. Please fix them before proceeding. `npm run lint:fix` may help"
exit 1
)
- name: Check code formatting
working-directory: sdks/ts
run: |
pnpm run format:check || (
echo "Code formatting issues found. Please run 'npm run format' to fix them."
exit 1
)
- name: Build the package
working-directory: sdks/ts
run: |
pnpm run build
- name: Verify golem-ts-sdk types are committed
working-directory: sdks/ts
run: |
if ! git diff --exit-code packages/golem-ts-sdk/types; then
echo "❌ The files in packages/golem-ts-sdk/types differ from the committed version."
echo "Please run 'pnpm run build' and commit the updated files."
exit 1
fi
- name: Build the agent template WASM binary
working-directory: sdks/ts
run: pnpm run build-agent-template
- name: Run tests
working-directory: sdks/ts
run: |
pnpm run test
docker-targets-build:
env:
CARGO_BUILD_JOBS: 10
runs-on: blacksmith-16vcpu-ubuntu-2204
if: github.event_name == 'push' && github.ref_type == 'tag'
strategy:
fail-fast: false
matrix:
platform:
- platform: linux/amd64
name: linux/amd64
target: x86_64-unknown-linux-gnu
- platform: linux/arm64
name: linux/arm64
target: aarch64-unknown-linux-gnu
cross: true
name: docker-targets-build (${{ matrix.platform.platform }})
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Fetch tag
run: git fetch origin --deepen=1
- name: Prepare
run: |
platform=${{ matrix.platform.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.platform.target }}
- uses: davidB/rust-cargo-make@v1
- name: Install Rust Target
run: rustup target add ${{ matrix.platform.target }}
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v4-rust
shared-key: debug
cache-all-crates: true
save-if: false
- run: cargo install cross
if: ${{ matrix.platform.cross }}
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: Build executables
run: cargo make --profile ci build-release
env:
PLATFORM_OVERRIDE: ${{ matrix.platform.name }}
- name: Prepare Targets
env:
PLATFORM_OVERRIDE: ${{ matrix.platform.name }}
run: cargo make --profile ci package-release
- uses: actions/upload-artifact@v4
name: Upload Targets
with:
name: docker-targets-build-${{ env.PLATFORM_PAIR }}
path: target/${{ matrix.platform.target }}.tar
docker-publish-1:
runs-on: blacksmith
needs:
- docker-targets-build
if: github.event_name == 'push' && github.ref_type == 'tag'
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Fetch tag
run: git fetch origin --deepen=1
- name: Prepare
run: |
echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
name: Download Targets
with:
pattern: docker-targets-build-*
path: target
merge-multiple: true
- name: Extract Targets
run: |
ls -R target
cd target
for f in *.tar; do tar xvf "$f"; done
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set Docker version
id: set-version
run: |
if [ "${{ github.event_name }}" == 'push' ] && [ "${{ github.ref_type }}" == 'tag' ]; then
DOCKER_VERSION=$(echo "${{ github.ref }}" | sed 's|^refs/tags/v||')
echo "DOCKER_VERSION=${DOCKER_VERSION}" >> $GITHUB_ENV
else
COMMIT_SHORT_HASH=$(git rev-parse --short=7 HEAD)
echo "DOCKER_VERSION=${COMMIT_SHORT_HASH}" >> $GITHUB_ENV
fi
- uses: jpribyl/action-docker-layer-caching@v0.1.1
continue-on-error: true
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for worker executor
id: meta-worker-executor
uses: docker/metadata-action@v5
with:
images: golemservices/golem-worker-executor
- name: Build and push worker executor image
uses: useblacksmith/build-push-action@v1
with:
context: .
file: ./golem-worker-executor/docker/Dockerfile
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta-worker-executor.outputs.tags }}
labels: ${{ steps.meta-worker-executor.outputs.labels }}
- name: Extract metadata (tags, labels) for golem debugging service
id: meta-golem-debugging-service
uses: docker/metadata-action@v5
with:
images: golemservices/golem-debugging-service
- name: Build and push golem debugging service image
uses: useblacksmith/build-push-action@v1
with:
context: .
file: ./golem-debugging-service/docker/Dockerfile
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta-golem-debugging-service.outputs.tags }}
labels: ${{ steps.meta-golem-debugging-service.outputs.labels }}
- name: Extract metadata (tags, labels) for shard manager
id: meta-shard-manager
uses: docker/metadata-action@v5
with:
images: golemservices/golem-shard-manager
- name: Build and push shard manager image
uses: useblacksmith/build-push-action@v1
with:
context: .
file: ./golem-shard-manager/docker/Dockerfile
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta-shard-manager.outputs.tags }}
labels: ${{ steps.meta-shard-manager.outputs.labels }}
docker-publish-2:
runs-on: blacksmith
needs:
- docker-targets-build
if: github.event_name == 'push' && github.ref_type == 'tag'
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Fetch tag
run: git fetch origin --deepen=1
- name: Prepare
run: |
echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
name: Download Targets
with:
pattern: docker-targets-build-*
path: target
merge-multiple: true
- name: Extract Targets
run: |
ls -R target
cd target
for f in *.tar; do tar xvf "$f"; done
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set Docker version
id: set-version
run: |
if [ "${{ github.event_name }}" == 'push' ] && [ "${{ github.ref_type }}" == 'tag' ]; then
DOCKER_VERSION=$(echo "${{ github.ref }}" | sed 's|^refs/tags/v||')
echo "DOCKER_VERSION=${DOCKER_VERSION}" >> $GITHUB_ENV
else
COMMIT_SHORT_HASH=$(git rev-parse --short=7 HEAD)
echo "DOCKER_VERSION=${COMMIT_SHORT_HASH}" >> $GITHUB_ENV
fi
- uses: jpribyl/action-docker-layer-caching@v0.1.1
continue-on-error: true
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for registry service
id: meta-registry-service
uses: docker/metadata-action@v5
with:
images: golemservices/registry-service
- name: Build and push registry-service
uses: useblacksmith/build-push-action@v1
with:
context: .
file: ./golem-registry-service/docker/Dockerfile
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta-registry-service.outputs.tags }}
labels: ${{ steps.meta-registry-service.outputs.labels }}
- name: Extract metadata (tags, labels) for golem worker service
id: meta-golem-worker-service
uses: docker/metadata-action@v5
with:
images: golemservices/golem-worker-service
- name: Build and push golem worker service image
uses: useblacksmith/build-push-action@v1
with:
context: .
file: ./golem-worker-service/docker/Dockerfile
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta-golem-worker-service.outputs.tags }}
labels: ${{ steps.meta-golem-worker-service.outputs.labels }}
- name: Extract metadata (tags, labels) for golem component compilation service
id: meta-golem-component-compilation-service
uses: docker/metadata-action@v5
with:
images: golemservices/golem-component-compilation-service
- name: Build and push golem component compilation service image
uses: useblacksmith/build-push-action@v1
with:
context: .
file: ./golem-component-compilation-service/docker/Dockerfile
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta-golem-component-compilation-service.outputs.tags }}
labels: ${{ steps.meta-golem-component-compilation-service.outputs.labels }}
publish:
needs:
- check-clippy-and-format
- unit-tests-and-checks
- wasm-rpc-stub
- worker-tests
- it
if: "startsWith(github.ref, 'refs/tags/v')"
env:
CARGO_BUILD_JOBS: 20
runs-on: blacksmith-32vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Fetch tag
run: git fetch origin --deepen=1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v4-rust
shared-key: release
cache-all-crates: true
save-if: true
- uses: davidB/rust-cargo-make@v1
- id: get_version
uses: battila7/get-version-action@v2
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- name: Publish all packages
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VERSION: ${{ steps.get_version.outputs.version-without-v }}
run: cargo make --profile ci publish
publish-binaries:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'golemcloud/golem'
strategy:
fail-fast: false
matrix:
project:
- golem-cli
- golem
cfg:
- rust-target: x86_64-unknown-linux-gnu
os: blacksmith-32vcpu-ubuntu-2204
- rust-target: aarch64-unknown-linux-gnu
os: blacksmith-32vcpu-ubuntu-2204
cross: true
- rust-target: x86_64-apple-darwin
os: macos-latest
- rust-target: aarch64-apple-darwin
os: macos-latest
- rust-target: x86_64-pc-windows-msvc
os: windows-latest
name: Publish binaries of ${{ matrix.project }}
runs-on: ${{ matrix.cfg.os }}
permissions:
contents: write
env:
CARGO_BUILD_JOBS: 10
steps:
- uses: actions/checkout@v5
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Fetch tag
run: git fetch origin --deepen=1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.cfg.rust-target }}
- uses: davidB/rust-cargo-make@v1
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v4-rust
shared-key: release-${{ matrix.cfg.rust-target }}
cache-all-crates: true
save-if: true
- id: get_version
uses: battila7/get-version-action@v2
- name: Set version for all packages
env:
VERSION: ${{ steps.get_version.outputs.version-without-v }}
run: cargo make --profile ci set-version
- run: cargo install cross
if: ${{ matrix.cfg.cross }}
- uses: ilammy/setup-nasm@v1
- name: Purge v8 from cache
run: cargo make --profile ci clear-v8
- run: cargo build -p ${{ matrix.project }} --release --target ${{ matrix.cfg.rust-target }}
if: ${{ ! matrix.cfg.cross }}
- run: cross build -p ${{ matrix.project }} --release --target ${{ matrix.cfg.rust-target }}
if: ${{ matrix.cfg.cross }}
- run: mv ./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}.exe ./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}.exe
if: matrix.cfg.os == 'windows-latest'
- run: mv ./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }} ./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}
if: matrix.cfg.os != 'windows-latest'
# - name: Import Code Signing Certificate
# if: contains(matrix.cfg.rust-target, 'apple-darwin')
# env:
# CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
# CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
# run: |
# # Create temporary keychain
# KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
# # Create and unlock keychain
# security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
# security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# # Import certificate - use -T to allow codesign access
# CERTIFICATE_PATH=$RUNNER_TEMP/certificate.p12
# echo "$CERTIFICATE_BASE64" | base64 --decode > "$CERTIFICATE_PATH"
# security import "$CERTIFICATE_PATH" \
# -P "$CERTIFICATE_PASSWORD" \
# -T /usr/bin/codesign \
# -T /usr/bin/security \
# -f pkcs12 \
# -k "$KEYCHAIN_PATH"
# # Add keychain to search list (prepend to existing list)
# security list-keychain -d user -s "$KEYCHAIN_PATH" $(security list-keychain -d user | tr -d '"')
# # Set partition list to allow codesign to access the certificate
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# # Debug: verify certificate was imported
# echo "Imported certificates:"
# security find-identity -v -p codesigning "$KEYCHAIN_PATH"
# - name: Code Sign Binary
# if: contains(matrix.cfg.rust-target, 'apple-darwin')
# env:
# APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
# run: |
# BINARY_PATH=./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}
# # Debug: list available signing identities
# echo "Available signing identities:"
# security find-identity -v -p codesigning
# # Sign with hardened runtime
# codesign --force \
# --options runtime \
# --timestamp \
# --sign "$APPLE_SIGNING_IDENTITY" \
# "$BINARY_PATH"
# # Verify signature
# codesign --verify --verbose "$BINARY_PATH"
# codesign --display --verbose=4 "$BINARY_PATH"
# - name: Create Notarization Archive
# if: contains(matrix.cfg.rust-target, 'apple-darwin')
# run: |
# BINARY_PATH=./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}
# ZIP_PATH=./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}.zip
# # Create zip for notarization
# zip -j "$ZIP_PATH" "$BINARY_PATH"
# - name: Submit for Notarization
# if: contains(matrix.cfg.rust-target, 'apple-darwin')
# env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
# run: |
# ZIP_PATH=./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}.zip
# # Submit for notarization and wait for completion
# xcrun notarytool submit "$ZIP_PATH" \
# --apple-id "$APPLE_ID" \
# --team-id "$APPLE_TEAM_ID" \
# --password "$APPLE_APP_PASSWORD" \
# --wait false
# - name: Cleanup Keychain
# if: contains(matrix.cfg.rust-target, 'apple-darwin') && always()
# run: |
# KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# security delete-keychain "$KEYCHAIN_PATH" || true
- name: Login GH CLI
shell: bash
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }})
- run: gh release upload -R golemcloud/golem --clobber ${{ github.ref_name }} target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}.exe
if: matrix.cfg.os == 'windows-latest'
- run: gh release upload -R golemcloud/golem --clobber ${{ github.ref_name }} target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}
if: matrix.cfg.os != 'windows-latest'
publish-slack-notification:
needs:
- publish
- docker-publish-1
- docker-publish-2
if: ${{ always() && startsWith(github.ref, 'refs/tags/v') }}
runs-on: blacksmith
steps:
- name: Publish Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: ${{ needs.publish.result }}
SLACK_ICON: https://uploads-ssl.webflow.com/64721eeec7cd7ef4f6f1683e/64831138b73a996d0e831773_32.png
SLACK_TITLE: "Release Notification"
SLACK_MESSAGE: "Publish - cargo result: `${{ needs.publish.result }}`, docker-1 result: `${{ needs.docker-publish-1.result }}`, docker-2 result: `${{ needs.docker-publish-2.result }}`"
SLACK_USERNAME: CI
SLACK_WEBHOOK: ${{ secrets.SLACK_ALERT_URL }}