msys2 / setup-msys2

GitHub Action to setup MSYS2
https://github.com/marketplace/actions/setup-msys2
MIT License
285 stars 38 forks source link

How do I run a script with one of the MSYS2 launchers? #272

Closed TheShermanTanker closed 1 month ago

TheShermanTanker commented 1 year ago

I currently have a workflow that needs to use one of the launchers themselves (mingw64.exe and so on, bash by itself won't cut it since the workflow depends on the environment the launcher provides), but setting the path and doing shell: mingw64 . {0} (which seems to be how to run the launcher with the file specified) simply doesn't execute anything:

# Run Visual Studio Installer
  '/c/Program Files (x86)/Microsoft Visual Studio/Installer/vs_installer.exe' \
    modify --quiet --installPath 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise' \
    --add Microsoft.VisualStudio.Component.VC.1[4](https://github.com/TheShermanTanker/jdk/actions/runs/3732433000/jobs/6331878210#step:7:4).29.x8[6](https://github.com/TheShermanTanker/jdk/actions/runs/3732433000/jobs/6331878210#step:7:6).x64
  shell: D:\a\_temp/msys64\mingw64.EXE . {0}
  env:
    MSYS2_PATH_TYPE: minimal
    CHERE_INVOKING: 1
    MSYSTEM: MINGW64

(There should be way more log output than the absolute nothingness shown above!)

Is there a way to do this properly? I know the action provides a wrapper msys2.cmd script, but it seems to just directly call bash after setting the usual CHERE_INVOKING and so on, which doesn't seem to be what I need

lazka commented 1 year ago

Those are GUI launchers, they wont do what you want in CI.

Not sure what you are trying to do, or what you want, but you just pass "msystem" to the action, and then the "msys2" command will launch bash with the right environment.