vcpkg manifest still builds dependencies regardless of the cache #180741
-
Why are you starting this discussion?Question What GitHub Actions topic or product is this about?Actions Cache Discussion DetailsHi everyone! 👋 My project has a However, when the workflow runs again, it restores the vcpkg directory from the cache but still recompiles all dependencies from scratch, which takes 20+ minutes. Based on Cache API responses, the cache size is reasonable (around 1.5 GB): The job where I updated vcpkg baseline to force the cache to be updated: https://github.com/HappySeaFox/sail/actions/runs/19798162265/job/56721466416 Any ideas on how to fix it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
It looks like the cache is being restored correctly, but vcpkg is still rebuilding because the restored tree isn’t in a fully “ready-to-use” state for binary reuse. A few things to check:
By default, vcpkg will rebuild if binary caching isn’t turned on explicitly: vcpkg install --binarysource=clear --binarysource=files:$(VCPKG_ROOT)/archives Or in vcpkg.json: { If binary caching isn’t configured, vcpkg treats the restored directory as empty and rebuilds everything.
vcpkg’s actual binary packages live in: vcpkg/installed/ Many workflows only cache vcpkg/installed but forget archives, so vcpkg has no local binaries to extract. path: |
If your workflow changes: triplet compiler version vcpkg baseline host OS image version …then vcpkg will rebuild because binaries don’t match the expected hash. Even a small baseline update causes invalidation.
Your key seems to include a hash: vcpkg-Windows-Shared Combined-10c1067d... If that hash is derived from: commit SHA vcpkg.json hash baseline hash then any small change produces a new cache. You may want a separate restore key: restore-keys: |
If buildtrees/ contains partial builds, vcpkg will rebuild the port to ensure consistency. vcpkg/installed instead of the entire folder. |
Beta Was this translation helpful? Give feedback.
It looks like the cache is being restored correctly, but vcpkg is still rebuilding because the restored tree isn’t in a fully “ready-to-use” state for binary reuse.
A few things to check:
By default, vcpkg will rebuild if binary caching isn’t turned on explicitly:
vcpkg install --binarysource=clear --binarysource=files:$(VCPKG_ROOT)/archives
Or in vcpkg.json:
{
"binarySources": [
"files:./vcpkg/archives,readwrite"
]
}
If binary caching isn’t configured, vcpkg treats the restored directory as empty and rebuilds everything.
vcpkg’s actual binary packages live in:
vcpkg/installed/
vcpkg/buildtrees/
vcpkg/…