CI: fix vcpkg binary caching (was never being saved)#1111
Open
craigds wants to merge 2 commits into
Open
Conversation
VCPKG_BINARY_SOURCES was step-scoped to the run-vcpkg setup step, but the vendor deps build later, during cmake configure - so built packages went to an uncached path and the cache-save step failed every run. No vcpkg cache was ever saved on any platform; Windows rebuilt ~70min of C++ deps in every build. Switch to vcpkg's x-gha backend at job level: packages cache individually and incrementally in the Actions cache, with no post-build save step to fail. ci-build-all
The pinned vcpkg tool has dropped the x-gha backend (it warns and runs uncached). Back to the files provider + actions/cache, but correctly scoped: job-level env, save after the build (Linux saved before it), container paths on Linux, and if: always() so failed builds still save the packages they built. ci-build-all
There was a problem hiding this comment.
Pull request overview
This pull request fixes vcpkg binary caching in the CI build workflows so that vcpkg-built packages are actually written into the cached directory (and saved after the dependency build completes), reducing repeated rebuild time—especially on Windows.
Changes:
- Move
VCPKG_BINARY_SOURCESto job-levelenvso it applies during the CMake configure step where vendor dependencies are built. - Move the vcpkg cache save step to after the build, and run it with
if: always()to preserve partial progress from failed builds. - Align cache key hashing to include overlay contents (
vcpkg-overlay-*/**) and fix Linux cache paths to use the container-visible workspace path.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/build-windows.yml | Ensures vcpkg binary cache is active during dependency build and saved after build (even on failure); improves cache key hashing for overlays. |
| .github/workflows/build-macos.yml | Ensures vcpkg binary cache is active during dependency build and saved after build (even on failure). |
| .github/workflows/build-linux.yml | Uses container-visible paths for vcpkg cache restore/save, applies VCPKG_BINARY_SOURCES during the actual dependency build, and saves cache after the build with if: always(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
VCPKG_BINARY_SOURCESwas set as step-scoped env on therun-vcpkgsetup step, but the vendor dependencies actually build later, during the CMake configure step — so vcpkg wrote built packages to an uncached default path and thecache/savestep failed every run (Path Validation Error). No vcpkg cache was ever saved on any platform (gh cache listshows zerovcpkg-*keys), and Windows rebuilt ~70 min of C++ deps on every single build. On Linux the save step also ran before the main dependency build, and used a host path that doesn't exist inside the manylinux container.Fixes, in all three build workflows:
VCPKG_BINARY_SOURCESmoved to job-level env so it's in effect when the deps buildif: always()so a failed build still saves the packages it completed (the next attempt resumes from there)/__w/kart/kart), matching the existingGITHUB_WORKSPACEworkaroundAlternative considered: vcpkg's
x-ghabackend (per-package incremental caching, tried in 9401204) — but the pinned vcpkg tool has removed it, so back to thefilesprovider.Note: branches/PRs can read master's cache, but master's Windows/macOS cache is only seeded by a master push containing
ci-build-allRelated links:
Checklist: