Merge bitcoin/bitcoin#34559: ci: split vcpkg tools cache into restore/save

c413cf12c5c6e688e71be84397a6e4fc75b5eaa4 ci: Split vcpkg tools cache into restore/save (willcl-ark)

Pull request description:

  The vcpkg tools cache was using the combined actions/cache action, which by default saves on every run regardless of branch. Split it into the restore/save pattern used by the other caches, so that saves only happen on default branch pushes.

  This will have little impact in bitcoin/bitcoin (which uses few branches), but on forks, if you don't update master branch frequently (which saves all caches), then all cache space will eventually be taken up by multiple vckpg tools caches, resulting in bad cache hit rates in all other jobs.

ACKs for top commit:
  maflcko:
    lgtm ACK c413cf12c5c6e688e71be84397a6e4fc75b5eaa4

Tree-SHA512: e28a43b1aa17ce7f0a19d16b98efed0372004d83e4d7e92a126f642599d7e1a94684032a48a3b380b3a7c970c313c92bfe30146b977e33f81b45fe70b49755e3
This commit is contained in:
merge-script 2026-02-13 11:34:49 +00:00
commit 03e5f063b5
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -259,11 +259,13 @@ jobs:
run: |
echo "VCPKG_ROOT=${VCPKG_INSTALLATION_ROOT}" >> "$GITHUB_ENV"
- name: vcpkg tools cache
uses: actions/cache@v5
- name: Restore vcpkg tools cache
id: vcpkg-tools-cache
uses: actions/cache/restore@v5
with:
path: C:/vcpkg/downloads/tools
key: ${{ github.job }}-vcpkg-tools
key: ${{ github.job }}-vcpkg-tools-${{ github.run_id }}
restore-keys: ${{ github.job }}-vcpkg-tools-
- name: Restore vcpkg binary cache
uses: actions/cache/restore@v4
@ -283,6 +285,13 @@ jobs:
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
- name: Save vcpkg tools cache
uses: actions/cache/save@v5
if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-tools-cache.outputs.cache-hit != 'true'
with:
path: C:/vcpkg/downloads/tools
key: ${{ github.job }}-vcpkg-tools-${{ github.run_id }}
- name: Build
run: |
py -3 .github/ci-windows.py ${{ matrix.job-type }} build