ci(vcpkg): Switch binary cache from local files to GitHub Packages NuGet feed#2542
ci(vcpkg): Switch binary cache from local files to GitHub Packages NuGet feed#2542bobtista wants to merge 3 commits into
Conversation
|
| Filename | Overview |
|---|---|
| .github/workflows/build-toolchain.yml | Replaces file-based cache steps with NuGet source authentication; condition narrowed from win32 to vcpkg-only presets; VCPKG_OVERLAY_TRIPLETS and VCPKG_INSTALL_OPTIONS correctly preserved in the new step. |
| .github/workflows/ci.yml | Adds packages: write permission and fetch-depth: 0 to detect-changes checkout; fetch-depth: 0 fetches full history on every run, which may be slower than a shallow fetch for large repos. |
Reviews (3): Last reviewed commit: "ci: Fetch full history for change detect..." | Re-trigger Greptile
We use ephemeral GitHub-hosted runners, do we need to worry about this? Every job starts with a clean NuGet config |
|
What is now the strategy with vcpkg? We still have it disabled because it caused long CI build times every now and then. |
The strategy is to move the dependency build output into the GitHub Packages NuGet binary cache instead of continuing with handmade caching tweaks trying to use actions/cache as a big shared folder cache. We should have used nuget from the beginning - Microsoft’s vcpkg docs specifically recommend the NuGet provider for this use case. I tested this on my fork. The first GenCI run still took about 24 minutes for the vcpkg jobs, which I think is expected because it had to build/populate the cache. Then I ran the same workflow again on the same commit, and the vcpkg jobs dropped to about 5.5-8 minutes. The CMake configure step was only around 30-45 seconds on the second run, so ffmpeg was restored from the cache instead of rebuilt. The workflow is still red on my fork because the replay checks need R2 secrets I don’t have set up, but all six win32-vcpkg build variants passed on both runs. |
Follow up for #2371 and #2515.
Replaces the local file-based vcpkg binary cache (
actions/cache+filesbackend) with a NuGet feed hosted on GitHub Packages. This is a structural change to how vcpkg caching works in CI.Problem
The previous approach used
actions/cachewith vcpkg'sfilesbinary source. This required our GHA cache key to perfectly predict vcpkg's ABI hash output — two separate systems we were trying to keep in sync by hand. Any discrepancy (compiler updates on the runner, host triplet ABI drift, toolchain changes) caused a doom loop: the GHA cache key matched an old entry, vcpkg found zero usable binaries inside it, rebuilt everything (~17 min for ffmpeg), and the save step was skipped becausecache-hitwastrue. PRs #1862, #1973, #2028, #2371, and #2515 each fixed a specific trigger but left the structural vulnerability intact.Solution
With NuGet binary caching, vcpkg uses its own ABI hashes directly as package identifiers in the feed. If a compiler update changes an ABI hash, vcpkg asks the feed for a package with the new hash, doesn't find it, builds once, uploads it, and every subsequent run restores it. There is no GHA cache key to get wrong, no save gate, and no doom loop possible. Based on the same pattern being used in the canonical/multipass repo
Changes
VCPKG_BINARY_SOURCESfromfilesbackend tonugetbackend pointing at GitHub PackagesVCPKG_NUGET_REPOSITORYfor GitHub Packages package-repository associationGITHUB_TOKENpackages: writepermission to bothci.ymlandbuild-toolchain.ymlactions/cache/restore,actions/cache/save, local cache directory setupTest plan