lukka / run-cmake

GitHub Action to build C++ applications with CMake (CMakePresets.json), Ninja and vcpkg on GitHub.
MIT License
176 stars 19 forks source link

CMake configuration step fails after workers update #23

Closed erysaj closed 4 years ago

erysaj commented 4 years ago

Hi, I've set up GitHub workflow with run-cmake and 5 days ago it did work fine. Right now configuration step fails on macos-latest runner with the following error:

CMake Error: The current CMakeCache.txt directory /Users/runner/runners/2.263.0/work/chessx/b/ninja/CMakeCache.txt is different than the directory /Users/runner/runners/2.262.1/work/chessx/b/ninja where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
25
  CMake Error: The source "/Users/runner/runners/2.263.0/work/chessx/chessx/CMakeLists.txt" does not match the source "/Users/runner/runners/2.262.1/work/chessx/chessx/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

Judging from path mismatches it appears that worker infrastructure has been updated. However where did CMakeCache.txt with old path come from? Is there any caching going on in run-cmake?

lukka commented 4 years ago

@erysaj can you enable the full log of actions by settings secret ACTIONS_STEP_DEBUG and provide a link to the logs of the workflow?

erysaj commented 4 years ago

@lukka See the link below, let me know if it works https://github.com/erysaj/chessx/runs/736543105?check_suite_focus=true

lukka commented 4 years ago

@erysaj can you add this step before 'run-cmake':

- name: dir
        run: find $RUNNER_WORKSPACE
        shell: bash

It will list all files in the workspace. Looks like there is a CMakeCache.txt side by side with the CMakeLists.txt file, but i wonder how it does get there.

erysaj commented 4 years ago

@lukka done https://github.com/erysaj/chessx/runs/736924021?check_suite_focus=true

erysaj commented 4 years ago

@lukka I guess I figured it out. Earlier in pipeline I restore downloaded Qt and by mistake I cache an entire workspace directory. Hence an old build directory is restored and the error occurs. Sorry for the trouble

lukka commented 4 years ago

No problem, happy to help. The 'dir' step indeed revealed the presence of CMakeCache.txt file in the build directory pointed by the argument of CMake. I think the 'run-cmake' action could to delete the content of the build directory, or at least warn about the presence of an existing CMakeCache.txt.

erysaj commented 4 years ago

I guess warning about existing build directory is spot on; silently cleaning the directory is likely to mask user’s mistake