Currently I've been using egor-tensin/setup-mingw
to setup MinGW for our CI and it's been working fine.
- name: Set up MinGW
uses: egor-tensin/setup-mingw@v2
- name: Configure
run: cmake -S. -B build ... -G "Ninja"
However, I noticed that the windows runner already has MinGW pre-installed.
Currently the aforementioned action takes about 5 minutes to setup MinGW. Ideally using the pre-installed MinGW would speed up this part of the CI process.
How can I use the pre-installed MinGW to speed up our GitHub workflow?
It's very simple, just use bash
as the shell. This is how I do it:
mingw64-gcc:
name: MinGW GCC
runs-on: windows-2019
defaults:
run:
shell: bash
steps:
- name: "Setup"
run: |
gcc --version
I wasn't able to get anything with shell:
to work. Instead, a simple solution is to just add
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
at the start of the run:
block. This will put the msys64 environment on your PATH.
For other environments, you will need to put first the environment-specific bin dir, then the msys64 bin dir to match how MSYS2 sets it up. So, for the ucrt64 environment, it would look like
$env:PATH = "C:\msys64\ucrt64\bin;C:\msys64\usr\bin;$env:PATH"
This obviously has limitations in that you don't have an actual bash shell, but it was enough for me to successfully compile a CMake project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With