I try to make a new setup using github actions with CMake and vcpkg. All the configurations are working except the windows one. A strange error occurs and I'm not sure why it happens and I'm not sure how to fix it:
► Run lukka/run-cmake@v3
tool: D:\a\_temp\909795809\cmake-3.21.1-windows-x86_64\bin\cmake.exe
tool: D:\a\_temp\909795809\ninja.exe
► Setup environment variables for triplet 'x64-windows' using 'vcpkg env'
⏱ elapsed: 2.161 seconds
Error: get_directories_non_recursive(D:\a\kangaru\kangaru\vcpkg_installed\x64-windows\tools): The system cannot find the path specified.
at CMakeUtils.<anonymous> (D:\a\_actions\lukka\run-cmake\v3\dist\index.js:4765:27)
at Generator.next (<anonymous>)
at fulfilled (D:\a\_actions\lukka\run-cmake\v3\dist\index.js:4717:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: run-cmake action execution failed: 'Error: get_directories_non_recursive(D:\a\kangaru\kangaru\vcpkg_installed\x64-windows\tools): The system cannot find the path specified.
My workflow file is the following:
on: [push, pull_request]
jobs:
build:
env:
buildDir: ${{ github.workspace }}/build
name: ${{ matrix.os }}-hosted-basic
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
triplet: x64-windows
build-type: RelWithDebInfo
- os: ubuntu-latest
triplet: x64-linux
build-type: RelWithDebInfo
- os: macos-latest
triplet: x64-osx
build-type: RelWithDebInfo
steps:
- uses: actions/checkout@v2
- name: get-cmake
uses: lukka/[email protected]
- name: Run vcpkg
uses: lukka/run-vcpkg@v6
with:
# Just install vcpkg for now, do not install any ports in this step yet.
setupOnly: true
# Location of the vcpkg as submodule of the repository.
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: '57bd7102d9fd880daa1b0958692294c4a125f6d8'
# Since the cache must be invalidated when content of the vcpkg.json file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }}
vcpkgTriplet: ${{ matrix.triplet }}
# Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed'.
additionalCachedPaths: ${{ env.buildDir }}/vcpkg_installed
- name: 'Run CMake with Ninja, install dependencies with vcpkg, build with CMake'
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtBasic
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
cmakeAppendedArgs: '-GNinja -DKANGARU_TEST=ON'
buildDirectory: ${{ env.buildDir }}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.build-type}}
I mostly followed the run-vcpkg quickstart guide.
You can check the live error here
The problem has been reported here and it has been fixed: https://github.com/microsoft/vcpkg/issues/19552
Context: when run-cmake
launches CMake on Windows with the vcpkg toolchain, unless CC/CXX env vars are already defined, the environment is setup for the MSVC toolset by running the vcpkg env --triplet <triplet>
command.
Unfortunately this command got broken in vcpkg aftert his commit, and when invoked it fails with what you reported:
Error: get_directories_non_recursive(D:\a\path\\vcpkg_installed\x64-windows\tools):
The system cannot find the path specified.
Using a vcpkg repository Git commit more recent than e52d3b24cb45d1e5c8a6eddcce1b12bf570608da contains the fix.