Closed Sapd closed 11 months ago
@Sapd this is mostly uncharted territory for me. I put that input in order to potentially let the user drive the Options.shell
value passed to child_process.exec()
in this section of code used by the action. Whatever you set in your workflow, it will passed to the exec()
's Nodejs API.
I never had the need to use it for any scenario, but it looks you may have one.
If you can make any good use of it, we could then document it.
So what I did now (I omitted Linux and other non relevant stuff):
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
...
- os: windows-latest
GENERATOR: msys2
PRESET: msys2-release
shell: 'D:\a\_temp\setup-msys2\msys2.CMD'
UNIX: 0
defaults:
run:
shell: ${{ matrix.shell }} {0}
steps:
...
- name: Run CMake with Makefile
uses: lukka/run-cmake@v10
id: runcmake
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
configurePreset: '${{ matrix.GENERATOR }}'
buildPreset: '${{ matrix.PRESET }}'
useShell: '${{ matrix.shell }}'
...
Problem is, the action trys to run cmake now, but the path is interpreted incorrectly:
Generate project files with CMake
[20](https://github.com/Sapd/HeadsetControl/runs/5573360227?check_suite_focus=true#step:6:20)
Running command 'C:\Program\ Files\CMake\bin\cmake.exe' with args '--preset,msys2' in current directory 'D:\a\HeadsetControl\HeadsetControl'.
[22](https://github.com/Sapd/HeadsetControl/runs/5573360227?check_suite_focus=true#step:6:22)
/usr/bin/bash: line 1: C:Program FilesCMakebincmake.exe: command not found
Im not 100% sure, but I think the problem lies here: https://github.com/lukka/run-cmake-vcpkg-action-libs/blob/main/packages/action-lib/src/action-lib.ts#L97
Maybe something like && !useShell.includes('msys2')) && !useShell.includes('mingw'))
is needed. So that it is handled as UNIX shell when either msys2 (or mingw for some users) is used.
@Sapd you may try the modification you suggest by directly modifying the dist/index.js content in your own fork. That file is the "executable" which is run the the action runs. The modification you suggest may be a step forward, but it can also be like peeling an onion of problems.
I think reworking the "shell management" is certainly possible, but requires motivation which I do not have.
@Sapd as an additional note, the path you see (without the backslashes, /usr/bin/bash: line 1: C:Program FilesCMakebincmake.exe: command not found
) would indicate that the filesystem paths must all manipulated/joined with logic based the currently selected shell rather than on the platform (as it currently is).
Such change would make the run-cmake
action useful in more context (e.g., msys2).
Would be nice to have a feature for msys2 shell. I have to manually run CMake for msys2 projects, while Linux and osx build can safely use this without issues.
Closing as more than one year of inactivity. Feel free to ask to reopen if needed.
For Windows builds, I need the msys2 shell, without it cmake is not able to find the packages for msys2.
Usually it can be specified like this (using https://github.com/msys2/setup-msys2 ):
I saw that the action has a
useShell
parameter, however it is a boolean and the description is not clear for me:It also can be an absolute with arguments of the shell to spawn commands with.
So how can I specify, that the run-cmake action uses msys2?