lairworks / nas2d-core

NAS2D is an open source, object oriented 2D game development framework written in portable C++.
http://nas2d.lairworks.com
zlib License
10 stars 6 forks source link

Fix `vcpkg` caching on CI #1110

Closed DanRStevens closed 1 year ago

DanRStevens commented 1 year ago

It seems the vcpkg cache is no longer being saved, and so there is no cache to restore. Seems like perhaps the folder where packages are cached has moved.

From the step "Post Restore vcpkg dependency cache":

Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

Currently we are attempting to cache:

path: C:\vcpkg\installed\


Checking env vars on CI with:

    - name: Print env
      shell: pwsh
      run: "ls env:"

Only one env var appeared to be related to vcpkg:

VCPKG_INSTALLATION_ROOT C:\vcpkg


Some relevant documentation: https://learn.microsoft.com/en-ca/vcpkg/users/buildsystems/msbuild-integration#vcpkginstalleddir-installed-directory Classic mode: $(VcpkgRoot)\installed\ Manifest mode: $(VcpkgManifestRoot)\vcpkg_installed\$(VcpkgTriplet)\

Mind you, I've noticed if the vcpkg_installed folder is deleted, packaged are restored very quickly (less than 1s), so I believe it still uses a user wide cache to restore from. Not sure if it would be better to cache the user wide packages or the project specific packages.


Found some documentation that may be helpful:

Seems the Binary Caching allows caching per dependency. That way if there is a build failure, you don't have to rebuild the entire cache of all dependencies. You would only need to rebuild dependencies that failed or were changed.

DanRStevens commented 1 year ago

After updating to cache the project local vcpkg_installed folder, I noticed the following in the build output:

All requested packages are currently installed. Restored 0 package(s) from C:\Users\runneradmin\AppData\Local\vcpkg\archives in 16.7 ms. Use --debug to see more details.

The path in the message is consistent with the documentation for Binary Caching with the default files provider:

%LOCALAPPDATA%\vcpkg\archives

Documentation: