c++github-actionsmingw

Utilize pre-installed MinGW in GitHub actions?


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:

# https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md
Mingw-w64 11.2.0

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?


Solution

  • 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