From 88bbf2ad33bb396dcb0edcbfa1b6002f9a44d842 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:27:45 +0100 Subject: [PATCH 1/3] ci, refactor: Reuse primary key in `actions/cache/save` This avoids code duplication and improves readability. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f12ceb012ec..b49042551cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -211,7 +211,7 @@ jobs: with: path: ${{ env.CCACHE_DIR }} # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache - key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }} + key: ${{ steps.ccache-cache.outputs.cache-primary-key }} windows-native-dll: name: ${{ matrix.job-name }} @@ -277,7 +277,7 @@ jobs: if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard' with: path: ~/AppData/Local/vcpkg/archives - key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }} + key: ${{ steps.vcpkg-binary-cache.outputs.cache-primary-key }} - name: Save vcpkg tools cache uses: actions/cache/save@v5 @@ -285,7 +285,7 @@ jobs: if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-tools-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard' with: path: ~/AppData/Local/vcpkg/downloads/tools - key: ${{ github.job }}-vcpkg-tools-${{ github.run_id }} + key: ${{ steps.vcpkg-tools-cache.outputs.cache-primary-key }} - name: Build run: | From dc9309108381cd5704b8e9eedc931bd5337dad78 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:27:52 +0100 Subject: [PATCH 2/3] ci: Cache `vcpkg/downloads` folder in native Windows CI job The new cache is keyed with the hash of 'vcpkg.json', which reduces cache storage consumption compared to keying by run ID. The `vcpkg/downloads/tools` subdirectory is excluded to further save space. --- .github/workflows/ci.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b49042551cf..2b4ac7267b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -253,13 +253,14 @@ jobs: py -3 --version bash --version - - name: Restore vcpkg tools cache - id: vcpkg-tools-cache + - name: Restore vcpkg downloads cache + id: vcpkg-downloads-cache uses: actions/cache/restore@v5 with: - path: ~/AppData/Local/vcpkg/downloads/tools - key: ${{ github.job }}-vcpkg-tools-${{ github.run_id }} - restore-keys: ${{ github.job }}-vcpkg-tools- + path: | + ~/AppData/Local/vcpkg/downloads/* + !~/AppData/Local/vcpkg/downloads/tools + key: ${{ github.job }}-vcpkg-downloads-${{ hashFiles('vcpkg.json') }} - name: Restore vcpkg binary cache uses: actions/cache/restore@v5 @@ -279,13 +280,15 @@ jobs: path: ~/AppData/Local/vcpkg/archives key: ${{ steps.vcpkg-binary-cache.outputs.cache-primary-key }} - - name: Save vcpkg tools cache + - name: Save vcpkg downloads cache uses: actions/cache/save@v5 - # Only save cache from one job as they share tools. If the matrix is expanded to jobs with unique tools, this may need amending. - if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-tools-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard' + # Only save cache from the 'standard' job, as it includes the necessary downloads for other jobs in the matrix. If the matrix is modified, this may need amending. + if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && steps.vcpkg-downloads-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard' with: - path: ~/AppData/Local/vcpkg/downloads/tools - key: ${{ steps.vcpkg-tools-cache.outputs.cache-primary-key }} + path: | + ~/AppData/Local/vcpkg/downloads/* + !~/AppData/Local/vcpkg/downloads/tools # Cache the tools once as archives, but not redundantly in extracted form. + key: ${{ steps.vcpkg-downloads-cache.outputs.cache-primary-key }} - name: Build run: | From 09c0e3778998eece67a908711efdac44ed3d3630 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 13 Apr 2026 12:32:36 +0100 Subject: [PATCH 3/3] ci: Rename vcpkg binary cache entity to force rebuild --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b4ac7267b0..ea62ef285e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -267,7 +267,7 @@ jobs: id: vcpkg-binary-cache with: path: ~/AppData/Local/vcpkg/archives - key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }} + key: ${{ github.job }}-vcpkg-binary-release-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }} - name: Generate build system run: |