86
86
fetch-depth : 0
87
87
88
88
- name : Cache dependencies
89
- uses : actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
89
+ uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
90
90
env :
91
91
CACHE_NAME : cargo-cache-dependencies
92
92
with :
99
99
${{ runner.os }}-build-${{ env.CACHE_NAME }}-
100
100
101
101
- name : Set up mold
102
- uses : rui314/setup-mold@b015f7e3f2938ad3a5ed6e5111a8c6c7c1d6db6e # v1
102
+ uses : rui314/setup-mold@8ec40be1d14871f7ce8fbf273c4b33f3ff75f1d1 # v1
103
103
104
104
- name : Set up toolchain
105
105
shell : bash
@@ -165,7 +165,7 @@ jobs:
165
165
show-progress : false
166
166
167
167
- name : Cache dependencies
168
- uses : actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
168
+ uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
169
169
env :
170
170
CACHE_NAME : cargo-cache-dependencies
171
171
with :
@@ -178,7 +178,7 @@ jobs:
178
178
${{ runner.os }}-build-${{ env.CACHE_NAME }}-
179
179
180
180
- name : Set up mold
181
- uses : rui314/setup-mold@b015f7e3f2938ad3a5ed6e5111a8c6c7c1d6db6e # v1
181
+ uses : rui314/setup-mold@8ec40be1d14871f7ce8fbf273c4b33f3ff75f1d1 # v1
182
182
183
183
- name : Set up toolchain
184
184
shell : bash
@@ -211,7 +211,7 @@ jobs:
211
211
show-progress : false
212
212
213
213
- name : Cache dependencies
214
- uses : actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
214
+ uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
215
215
env :
216
216
CACHE_NAME : cargo-cache-dependencies
217
217
with :
@@ -224,7 +224,7 @@ jobs:
224
224
${{ runner.os }}-build-${{ env.CACHE_NAME }}-
225
225
226
226
- name : Set up mold
227
- uses : rui314/setup-mold@b015f7e3f2938ad3a5ed6e5111a8c6c7c1d6db6e # v1
227
+ uses : rui314/setup-mold@8ec40be1d14871f7ce8fbf273c4b33f3ff75f1d1 # v1
228
228
229
229
- name : Set up toolchain
230
230
shell : bash
@@ -252,7 +252,7 @@ jobs:
252
252
show-progress : false
253
253
254
254
- name : Cache dependencies
255
- uses : actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
255
+ uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
256
256
env :
257
257
CACHE_NAME : cargo-cache-dependencies
258
258
with :
@@ -265,7 +265,7 @@ jobs:
265
265
${{ runner.os }}-build-${{ env.CACHE_NAME }}-
266
266
267
267
- name : Set up mold
268
- uses : rui314/setup-mold@b015f7e3f2938ad3a5ed6e5111a8c6c7c1d6db6e # v1
268
+ uses : rui314/setup-mold@8ec40be1d14871f7ce8fbf273c4b33f3ff75f1d1 # v1
269
269
270
270
- name : Set up toolchain
271
271
shell : bash
@@ -335,7 +335,7 @@ jobs:
335
335
grcov $(find profiling -name "profile-*.profraw" -print) --source-dir . --binary-path ./target/debug/ --output-type lcov --branch --ignore-not-existing --llvm --keep-only "src/**" --keep-only "tests/**" --output-path ./reports/lcov.info
336
336
337
337
- name : Upload coverage results (to Codecov.io)
338
- uses : codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
338
+ uses : codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
339
339
with :
340
340
disable_search : true
341
341
fail_ci_if_error : true
@@ -378,7 +378,7 @@ jobs:
378
378
show-progress : false
379
379
380
380
- name : Cache dependencies
381
- uses : actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
381
+ uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
382
382
env :
383
383
CACHE_NAME : cargo-cache-dependencies
384
384
with :
@@ -391,7 +391,7 @@ jobs:
391
391
${{ runner.os }}-build-${{ env.CACHE_NAME }}-
392
392
393
393
- name : Set up mold
394
- uses : rui314/setup-mold@b015f7e3f2938ad3a5ed6e5111a8c6c7c1d6db6e # v1
394
+ uses : rui314/setup-mold@8ec40be1d14871f7ce8fbf273c4b33f3ff75f1d1 # v1
395
395
396
396
- name : Set up toolchain
397
397
shell : bash
@@ -410,7 +410,7 @@ jobs:
410
410
args : --workspace --all-targets --all-features --no-deps
411
411
412
412
docker-build :
413
- name : Build Docker container for ${{ matrix.platform.docker }}-${{ matrix.platform.rust }}
413
+ name : Build Docker container
414
414
runs-on : ubuntu-latest
415
415
needs :
416
416
- calculate-version
@@ -419,34 +419,20 @@ jobs:
419
419
env :
420
420
APPLICATION_NAME : PLACEHOLDER # overridden in step 'Set application name', this is merely to satisfy the linter
421
421
PATH_TO_TAR : PLACEHOLDER # same ^
422
- PLATFORM_PAIR : PLACEHOLDER # same ^
423
- PLATFORM_UNIQUE_TAG : PLACEHOLDER # same ^
424
- strategy :
425
- fail-fast : false
426
- matrix :
427
- platform :
428
- - docker : linux/amd64
429
- rust : x86_64-unknown-linux-musl
430
- - docker : linux/arm64
431
- rust : aarch64-unknown-linux-musl
422
+ UNIQUE_TAG : PLACEHOLDER # same ^
432
423
steps :
433
424
- name : Checkout
434
425
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
435
426
with :
436
427
show-progress : false
437
428
438
- - name : Prepare name
439
- run : |
440
- platform=${{ matrix.platform.docker }}-${{ matrix.platform.rust }}
441
- echo "PLATFORM_PAIR=${platform//\//-}" >> ${GITHUB_ENV}
442
-
443
429
- name : Set the Cargo.toml version before we copy in the data into the Docker container
444
430
shell : bash
445
431
run : |
446
432
./.github/scripts/update-version.sh ${{ needs.calculate-version.outputs.version }}
447
433
448
434
- name : Set up Docker Buildx
449
- uses : docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
435
+ uses : docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
450
436
451
437
# TODO validate no changes between github.event.pull_request.head.sha and the actual current sha (representing the hypothetical merge)
452
438
@@ -458,18 +444,18 @@ jobs:
458
444
- name : Set Docker tag
459
445
shell : bash
460
446
run : |
461
- PLATFORM_UNIQUE_TAG =pr-${{ github.event.pull_request.base.sha }}-${{ github.event.pull_request.head.sha }}-${{ env.PLATFORM_PAIR }}
462
- echo "PLATFORM_UNIQUE_TAG =${PLATFORM_UNIQUE_TAG ##*/}" >> ${GITHUB_ENV}
447
+ UNIQUE_TAG =pr-${{ github.event.pull_request.base.sha }}-${{ github.event.pull_request.head.sha }}
448
+ echo "UNIQUE_TAG =${UNIQUE_TAG ##*/}" >> ${GITHUB_ENV}
463
449
464
450
# Extract metadata (tags, labels) for Docker
465
451
# https://github.com/docker/metadata-action
466
452
- name : Extract Docker metadata
467
- uses : docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5 .1
453
+ uses : docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6 .1
468
454
id : meta
469
455
with :
470
456
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
471
457
tags : |
472
- type=raw,value=${{ env.PLATFORM_UNIQUE_TAG }}
458
+ type=raw,value=${{ env.UNIQUE_TAG }}
473
459
labels : |
474
460
org.opencontainers.image.version=pr-${{ github.event.number }}
475
461
org.opencontainers.image.source=${{ github.event.pull_request.html_url }}
@@ -488,45 +474,42 @@ jobs:
488
474
echo "APPLICATION_NAME=${APPLICATION_NAME##*/}" >> ${GITHUB_ENV}
489
475
490
476
- name : Build Docker image
491
- uses : docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9 .0
477
+ uses : docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10 .0
492
478
with :
493
479
build-args : |
494
480
APPLICATION_NAME=${{ env.APPLICATION_NAME }}
495
- TARGET=${{ matrix.platform.rust }}
496
481
context : .
497
482
# this container is THE PR's artifact, and we will re-tag it
498
483
# once the PR has been accepted
499
484
tags : ${{ steps.meta.outputs.tags }}
500
485
labels : ${{ steps.meta.outputs.labels }}
501
- cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ env.PLATFORM_PAIR }}
502
- cache-to : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ env.PLATFORM_PAIR }},mode=max
503
- platforms : ${{ matrix.platform.docker }}
504
- outputs : type=docker ,dest=/tmp/${{ env.PLATFORM_UNIQUE_TAG }}.tar
486
+ cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ env.APPLICATION_NAME }}
487
+ cache-to : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ env.APPLICATION_NAME }},mode=max
488
+ platforms : linux/amd64, linux/arm64
489
+ outputs : type=oci ,dest=/tmp/${{ env.UNIQUE_TAG }}.tar
505
490
506
491
- name : Upload artifact
507
- uses : actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
492
+ uses : actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
508
493
with :
509
- name : containers-${{ env.PLATFORM_PAIR }}
510
- path : /tmp/${{ env.PLATFORM_UNIQUE_TAG }}.tar
494
+ name : containers-${{ env.APPLICATION_NAME }}
495
+ path : /tmp/${{ env.UNIQUE_TAG }}.tar
511
496
if-no-files-found : error
512
497
retention-days : 1
513
498
514
499
docker-publish :
515
500
name : Publish Docker container
516
501
runs-on : ubuntu-latest
517
502
needs :
518
- - cargo-build
519
- - cargo-fmt
520
- - cargo-test-and-report
521
- - cargo-clippy-and-report
522
503
- docker-build
523
504
# Check if the event is not triggered by a fork
524
505
if : |
525
506
github.event.pull_request.head.repo.full_name == github.repository &&
526
507
github.event_name == 'pull_request'
508
+ env :
509
+ APPLICATION_NAME : PLACEHOLDER # overridden in step 'Set application name', this is merely to satisfy the linter
527
510
steps :
528
511
- name : Set up Docker Buildx
529
- uses : docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
512
+ uses : docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
530
513
531
514
- name : Download artifact
532
515
uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
@@ -542,26 +525,35 @@ jobs:
542
525
username : ${{ github.actor }}
543
526
password : ${{ secrets.GITHUB_TOKEN }}
544
527
528
+ - name : Set application name
529
+ shell : bash
530
+ run : |
531
+ APPLICATION_NAME=${{ github.repository }}
532
+ echo "APPLICATION_NAME=${APPLICATION_NAME##*/}" >> ${GITHUB_ENV}
533
+
545
534
- name : Lowercase the image name
546
535
shell : bash
547
536
run : |
548
537
echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV}
549
538
550
539
- name : Load images from artifacts
551
540
shell : bash
541
+ id : image
542
+ working-directory : /tmp/containers
552
543
run : |
553
- ls -l /tmp/containers/
544
+ echo "${{ secrets.GITHUB_TOKEN }}" | oras login -u "${{ github.actor }}" --password-stdin ${{ env.REGISTRY }}
545
+
546
+ ls -l /tmp/containers
554
547
for container in /tmp/containers/*
555
548
do
556
- echo $container
557
- docker load --input $container
549
+ echo "Found ${container}"
558
550
tag=$(basename -- $container .tar)
559
- echo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:${tag}
560
- docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${tag}
551
+
552
+ oras copy --from-oci-layout "${container}:${tag}" "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${tag}"
561
553
done
562
554
563
555
- name : Extract Docker metadata
564
- uses : docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5 .1
556
+ uses : docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6 .1
565
557
id : meta
566
558
with :
567
559
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
@@ -574,18 +566,13 @@ jobs:
574
566
working-directory : /tmp/containers
575
567
run : |
576
568
# all files in dir
577
- platform_tags=(*)
578
-
569
+ containers=(*)
579
570
# yeet extension
580
- platform_tags=${platform_tags[@]%.tar}
581
-
571
+ containers=${containers[@]%.tar}
582
572
new_tags="${{ join(steps.meta.outputs.tags, ' ') }}"
583
573
new_tags=$(printf -- '--tag %s ' $new_tags)
584
-
585
- expanded_platform_tags=$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:%s ' $platform_tags)
586
-
587
- docker buildx imagetools create $new_tags $expanded_platform_tags
588
-
574
+ expanded_containters_tags=$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:%s ' ${containers})
575
+ docker buildx imagetools create $new_tags $expanded_containters_tags
589
576
for new_tag in $(echo "${{ join(steps.meta.outputs.tags, ' ') }}"); do
590
577
docker buildx imagetools inspect --raw $new_tag
591
578
done
0 commit comments