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 2 commits into
Conversation
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. |
68cdb82 to
8e918ef
Compare
|
Rebased onto main and updated the PR, updated the description here too - this is ready for review and merge IMHO |
Follow up for #2371 and #2515. Reverts #2544.
Replaces the local file-based vcpkg binary cache (
actions/cache+filesbackend) that was fragile (janky and hand-rolled) with a NuGet feed hosted on GitHub Packages, and re-enables the win32-vcpkg CI presets that were disabled in #2544 because it kept on breaking every month or two.Details
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 anymore - This is the approach Microsoft's vcpkg docs recommend for GitHub Actions, and it works when I've tested it.
vcpkg's experimental
x-ghabackend was considered and rejected: it stores binaries in the Actions cache, which brings back the 10 GB per-repo limit and eviction churn for large packages like ffmpeg.Changes
VCPKG_BINARY_SOURCESfromfilesbackend tonugetbackend pointing at GitHub PackagesVCPKG_NUGET_REPOSITORYfor GitHub Packages package-repository associationGITHUB_TOKENpackages: writepermission toci.ymlandbuild-toolchain.ymlcontains(inputs.preset, 'vcpkg')instead ofstartsWith(inputs.preset, 'win32'))actions/cache/restore,actions/cache/save, local cache directory setupNotes
GITHUB_TOKENis read-only on PRs from forks, so fork PRs restore from the feed but cannot upload. A fork PR that changes an ABI hash (e.g. baseline bump) builds cold on each run until a same-repo build populates the new hash. Existing packages cannot be overwritten — the feed rejects re-pushing an existing version.Test plan