SDL: Add MinGW-w64 builds to GitHub Actions

From 21c1082786d178b4235fd047657bdc18ce6dfb00 Mon Sep 17 00:00:00 2001
From: Cameron Cawley <[EMAIL REDACTED]>
Date: Mon, 20 Sep 2021 13:22:20 +0100
Subject: [PATCH] Add MinGW-w64 builds to GitHub Actions

---
 .github/workflows/main.yml | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f39a8cdf1d..cf5e9379fd 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -6,15 +6,34 @@ jobs:
   Build:
     name: ${{ matrix.platform.name }}
     runs-on: ${{ matrix.platform.os }}
+
+    defaults:
+      run:
+        shell: ${{ matrix.platform.shell }}
+
     strategy:
       matrix:
         platform:
-        - { name: Windows (x64), os: windows-latest, flags: -A x64 }
-        - { name: Windows (x86), os: windows-latest, flags: -A Win32 }
-        - { name: Windows (ARM64), os: windows-latest, flags: -A ARM64 }
-        - { name: Linux,   os: ubuntu-20.04, flags: -GNinja }
-        - { name: MacOS,   os: macos-latest }
+        - { name: Windows (x64),     os: windows-latest, shell: pwsh, flags: -A x64 }
+        - { name: Windows (x86),     os: windows-latest, shell: pwsh, flags: -A Win32 }
+        - { name: Windows (ARM64),   os: windows-latest, shell: pwsh, flags: -A ARM64 }
+        - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
+        - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
+        - { name: Linux,             os: ubuntu-20.04,   shell: sh,   flags: -GNinja }
+        - { name: MacOS,             os: macos-latest,   shell: sh }
+
     steps:
+    - name: Set up MSYS2
+      if: matrix.platform.shell == 'msys2 {0}'
+      uses: msys2/setup-msys2@v2
+      with:
+        msystem: ${{ matrix.platform.msystem }}
+        install: >-
+          ${{ matrix.platform.msys-env }}-gcc
+          ${{ matrix.platform.msys-env }}-cmake
+          ${{ matrix.platform.msys-env }}-ninja
+          ${{ matrix.platform.msys-env }}-pkg-config
+
     - name: Setup Linux dependencies
       if: runner.os == 'Linux'
       run: |