Skip to content

CI: fix vcpkg binary caching (was never being saved)#1111

Open
craigds wants to merge 2 commits into
masterfrom
cds-vcpkg-gha-cache
Open

CI: fix vcpkg binary caching (was never being saved)#1111
craigds wants to merge 2 commits into
masterfrom
cds-vcpkg-gha-cache

Conversation

@craigds

@craigds craigds commented Jun 11, 2026

Copy link
Copy Markdown
Member

Description

VCPKG_BINARY_SOURCES was set as step-scoped env on the run-vcpkg setup step, but the vendor dependencies actually build later, during the CMake configure step — so vcpkg wrote built packages to an uncached default path and the cache/save step failed every run (Path Validation Error). No vcpkg cache was ever saved on any platform (gh cache list shows zero vcpkg-* 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_SOURCES moved to job-level env so it's in effect when the deps build
  • cache save moved to after the build, with if: always() so a failed build still saves the packages it completed (the next attempt resumes from there)
  • Linux cache steps use the container path (/__w/kart/kart), matching the existing GITHUB_WORKSPACE workaround

Alternative considered: vcpkg's x-gha backend (per-package incremental caching, tried in 9401204) — but the pinned vcpkg tool has removed it, so back to the files provider.

Note: branches/PRs can read master's cache, but master's Windows/macOS cache is only seeded by a master push containing ci-build-all

Related links:

Checklist:

  • Have you reviewed your own change?
  • Have you included test(s)?
  • Have you updated the changelog?

craigds added 2 commits June 11, 2026 14:47
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
@craigds craigds added the ci-build-all Forces the MacOS and Windows builds to run for the labelled PR label Jun 11, 2026
@craigds craigds marked this pull request as ready for review June 11, 2026 10:42
Copilot AI review requested due to automatic review settings June 11, 2026 10:42
@craigds craigds requested a review from olsen232 June 11, 2026 10:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_SOURCES to job-level env so 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-build-all Forces the MacOS and Windows builds to run for the labelled PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants