Closed akrieger closed 1 year ago
@akrieger good question, I need to add explicitly this info to the run-vcpkg@v11
documentation.
I imagine you have a workflow that does this:
uses: run-vcpkg@v11. # <= Succeeds
run: vcpkg.exe install <rest of cmd line> # <= Fails with missing env var error
When running vcpkg yourself (i.e. when it is not run by the action), you need to add the following variables, like it is done in the C++ project template:
- uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
I see two fixes here:
run-vcpkg@v11
must define those two variables, so the user does not need to do it manually. Note that in the workflow linked above the run-vcpkg
action is not used at all, hence the definition of the env var must be done explicitly in the workflow.run-vcpkg@v11
about these variables.Our workflow file uses run-vcpkg
and then manually invokes vcpkg via manifest mode. I will test with setting the env vars manually like you showed.
- name: Restore artifacts, or run vcpkg, build and cache artifacts
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
# run-vcpkg tries to hash vcpkg.json but complans if it finds more than one.
# That said, we also have our custom vcpkg_triplets to hash, so we keep everything the same.
appendedCacheKey: ${{ hashFiles( 'msvc-full-features/vcpkg.json', 'msvc-object_creator/vcpkg.json', '.github/vcpkg_triplets/**', '.github/vckg_ports/**' ) }}
# Rev this value to drop cache without changing vcpkg commit
prependedCacheKey: v1-x64-full
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
# Caching happens as a post-action which runs at the end of the whole workflow
vcpkgGitCommitId: '5b1214315250939257ef5d62ecdcbca18cf4fb1c'
- name: Integrate vcpkg
run: |
vcpkg integrate install --vcpkg-root '${{ runner.workspace }}\b\vcpkg'
...
- name: Build <-- vcokg invoked by msbuild here
run: |
msbuild -m -p:Configuration=Release -p:Platform=x64 "-target:Cataclysm-vcpkg-static;Cataclysm-test-vcpkg-static;JsonFormatter-vcpkg-static" msvc-full-features/Cataclysm-vcpkg-static.sln
msbuild -m -p:Configuration=Release -p:Platform=x64 "-target:ObjectCreator-vcpkg-static" msvc-object_creator/ObjectCreator-vcpkg-static.sln
Setting the env vars seemed to suppress that output. I found the job failing is caused by a changed portfile, so I'll edit the issue title appropriately.
@akrieger fixed with release https://github.com/lukka/run-vcpkg/releases/tag/v11.1, let me know!
Attempting to fetch 19 package(s) from GHA ... Restored 19 package(s) from GHA in 9.5 s. Use --debug to see more details.
Seems like it worked! I removed the logic which set the env vars myself, vcpkg seemed to restore from its own cache correctly.
@akrieger let me know if anything else needs to be fixed, thanks!
Using vcpkg in manifest mode, our workflow which worked on v10 emits this output and doesn't cache.