From 4a51253299e83824178915a96f6ccd6f11e17de9 Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Wed, 14 Oct 2026 10:17:59 +0000 Subject: [PATCH] Preserve the multi-platform CLI build cache during validation --- .github/workflows/cli-docker-validation.yml | 7 +++++-- .github/workflows/cli-docker.yml | 4 +++- utils/cli-ci.unit.spec.ts | 8 +++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cli-docker-validation.yml b/.github/workflows/cli-docker-validation.yml index fc58f972..c21f855f 100644 --- a/.github/workflows/cli-docker-validation.yml +++ b/.github/workflows/cli-docker-validation.yml @@ -58,8 +58,11 @@ jobs: load: true tags: livesync-cli platforms: linux/amd64 - cache-from: type=gha,scope=cli-image - cache-to: type=gha,scope=cli-image,mode=max + cache-from: | + type=gha,scope=cli-image-amd64 + type=gha,scope=cli-image + # Keep amd64 validation from replacing the cache for both platforms. + cache-to: type=gha,scope=cli-image-amd64,mode=max - name: Setup Node.js uses: actions/setup-node@v5 diff --git a/.github/workflows/cli-docker.yml b/.github/workflows/cli-docker.yml index b963506f..0016104d 100644 --- a/.github/workflows/cli-docker.yml +++ b/.github/workflows/cli-docker.yml @@ -129,5 +129,7 @@ jobs: push: ${{ steps.meta.outputs.push }} tags: ${{ steps.meta.outputs.tags }} platforms: linux/amd64,linux/arm64 - cache-from: type=gha,scope=cli-image + cache-from: | + type=gha,scope=cli-image-amd64 + type=gha,scope=cli-image cache-to: type=gha,scope=cli-image,mode=max diff --git a/utils/cli-ci.unit.spec.ts b/utils/cli-ci.unit.spec.ts index 42934c62..cb74f4c4 100644 --- a/utils/cli-ci.unit.spec.ts +++ b/utils/cli-ci.unit.spec.ts @@ -138,6 +138,12 @@ describe("CLI CI selection", () => { step.uses?.startsWith("docker/build-push-action@") ); expect(publishBuild?.with?.["cache-from"]).toBe(build?.with?.["cache-from"]); - expect(publishBuild?.with?.["cache-to"]).toBe(build?.with?.["cache-to"]); + const validationScope = String(build?.with?.["cache-to"]).match(/scope=([^,\s]+)/)?.[1]; + const publicationScope = String(publishBuild?.with?.["cache-to"]).match(/scope=([^,\s]+)/)?.[1]; + expect(validationScope).toBeDefined(); + expect(publicationScope).toBeDefined(); + expect(publicationScope).not.toBe(validationScope); + expect(publishBuild?.with?.["cache-from"]).toContain(`scope=${validationScope}`); + expect(publishBuild?.with?.["cache-from"]).toContain(`scope=${publicationScope}`); }); });