game-music-emu: Merge pull request #53 from drfiemost/CI-Build

From d651a7d7ea6d0923fcd539a76a888ddb7c938669 Mon Sep 17 00:00:00 2001
From: Leandro Nini <[EMAIL REDACTED]>
Date: Wed, 4 Oct 2023 12:39:41 +0200
Subject: [PATCH 1/5] Enable CI build

---
 .github/workflows/CI-build.yml | 49 ++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 .github/workflows/CI-build.yml

diff --git a/.github/workflows/CI-build.yml b/.github/workflows/CI-build.yml
new file mode 100644
index 0000000..dbba77c
--- /dev/null
+++ b/.github/workflows/CI-build.yml
@@ -0,0 +1,49 @@
+name: C/C++ CI
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+  build:
+    name: ${{ matrix.platform }} (${{ matrix.configuration }})
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        generator:
+          - Ninja
+          - Xcode
+        configuration: [Debug, Release]
+        include:
+          - generator: Ninja
+            platform: Linux
+            os: ubuntu-latest
+          - generator: Xcode
+            platform: macOS
+            os: macos-latest
+
+    steps:
+    - uses: actions/checkout@v3
+    - name: Install dependencies (Linux)
+      if: runner.os == 'Linux'
+      run: |
+          sudo apt-get update
+          sudo apt-get install build-essential g++ cmake ninja-build libsdl2-dev
+    - name: Install dependencies (macOS)
+      if: runner.os == 'macOS'
+      env:
+        HOMEBREW_NO_ANALYTICS: 1
+        HOMEBREW_NO_INSTALL_CLEANUP: 1
+      run: |
+        unset HOMEBREW_NO_INSTALL_FROM_API
+        brew update
+        brew upgrade || true
+        brew install sdl2
+    - name: Build
+      run: |
+        mkdir build
+        cd build
+        cmake -G ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DENABLE_UBSAN=OFF ..
+        cmake --build .

From 64606e067a00692573db990bf7f8d2bc11162d2e Mon Sep 17 00:00:00 2001
From: Leandro Nini <drfiemost@users.noreply.github.com>
Date: Wed, 4 Oct 2023 15:37:09 +0200
Subject: [PATCH 2/5] Split workflow based on OS

---
 .github/workflows/CI-Linux.yml                | 31 +++++++++++++++++++
 .../workflows/{CI-build.yml => CI-MacOS.yml}  | 21 +++----------
 2 files changed, 35 insertions(+), 17 deletions(-)
 create mode 100755 .github/workflows/CI-Linux.yml
 rename .github/workflows/{CI-build.yml => CI-MacOS.yml} (54%)
 mode change 100644 => 100755

diff --git a/.github/workflows/CI-Linux.yml b/.github/workflows/CI-Linux.yml
new file mode 100755
index 0000000..187408b
--- /dev/null
+++ b/.github/workflows/CI-Linux.yml
@@ -0,0 +1,31 @@
+name: CI Linux
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+  build:
+    name: Linux (${{ matrix.configuration }})
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        configuration: [Debug, Release]
+        include:
+          - generator: Ninja
+            os: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v3
+    - name: Install dependencies
+      run: |
+          sudo apt-get update
+          sudo apt-get install build-essential g++ cmake ninja-build libsdl2-dev
+    - name: Build
+      run: |
+        mkdir build
+        cd build
+        cmake -G ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ..
+        cmake --build .
diff --git a/.github/workflows/CI-build.yml b/.github/workflows/CI-MacOS.yml
old mode 100644
new mode 100755
similarity index 54%
rename from .github/workflows/CI-build.yml
rename to .github/workflows/CI-MacOS.yml
index dbba77c..00646cf
--- a/.github/workflows/CI-build.yml
+++ b/.github/workflows/CI-MacOS.yml
@@ -1,4 +1,4 @@
-name: C/C++ CI
+name: CI macOS
 
 on:
   push:
@@ -8,31 +8,18 @@ on:
 
 jobs:
   build:
-    name: ${{ matrix.platform }} (${{ matrix.configuration }})
+    name: macOS (${{ matrix.configuration }})
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        generator:
-          - Ninja
-          - Xcode
         configuration: [Debug, Release]
         include:
-          - generator: Ninja
-            platform: Linux
-            os: ubuntu-latest
           - generator: Xcode
-            platform: macOS
             os: macos-latest
 
     steps:
     - uses: actions/checkout@v3
-    - name: Install dependencies (Linux)
-      if: runner.os == 'Linux'
-      run: |
-          sudo apt-get update
-          sudo apt-get install build-essential g++ cmake ninja-build libsdl2-dev
-    - name: Install dependencies (macOS)
-      if: runner.os == 'macOS'
+    - name: Install dependencies
       env:
         HOMEBREW_NO_ANALYTICS: 1
         HOMEBREW_NO_INSTALL_CLEANUP: 1
@@ -45,5 +32,5 @@ jobs:
       run: |
         mkdir build
         cd build
-        cmake -G ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DENABLE_UBSAN=OFF ..
+        cmake -G ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ..
         cmake --build .

From ee327d7807babd872e54c5f2a9f253b5be544f1c Mon Sep 17 00:00:00 2001
From: Leandro Nini <drfiemost@users.noreply.github.com>
Date: Wed, 4 Oct 2023 18:52:43 +0200
Subject: [PATCH 3/5] Added Windows CI build

---
 .github/workflows/CI-Windows.yml | 40 ++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 .github/workflows/CI-Windows.yml

diff --git a/.github/workflows/CI-Windows.yml b/.github/workflows/CI-Windows.yml
new file mode 100644
index 0000000..1922508
--- /dev/null
+++ b/.github/workflows/CI-Windows.yml
@@ -0,0 +1,40 @@
+name: CI Windows
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+  build:
+    name: Windows (${{ matrix.configuration }})
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        configuration: [Debug, Release]
+        include:
+          - generator: Visual Studio 17 2022
+            os: windows-latest
+    env:
+      VS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\
+      MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\
+
+    steps:
+    - uses: actions/checkout@v3
+    - name: Install dependencies
+      run: |
+          choco install -y --no-progress cmake --install-arguments="ADD_CMAKE_TO_PATH=System"
+          choco install -y --no-progress visualstudio2022community
+    - name: Install SDL2
+      shell: powershell
+      run: |
+        Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.26.5-VC.zip" -OutFile "SDL2-devel-2.26.5-VC.zip"
+        Expand-Archive -Path SDL2-devel-2.26.5-VC.zip
+        echo "SDL2_DIR=$(pwd)\SDL2-devel-2.26.5-VC\SDL2-2.26.5\" >>${env:GITHUB_ENV}
+    - name: Build
+      run: |
+        mkdir build
+        cd build
+        cmake -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ..
+        cmake --build .

From a7336734065ed1cb10bde9a585c01c4741ea1eac Mon Sep 17 00:00:00 2001
From: Leandro Nini <drfiemost@users.noreply.github.com>
Date: Thu, 5 Oct 2023 12:39:16 +0200
Subject: [PATCH 4/5] Update CI-Windows.yml

Upgrade SDL2 version and fetch it from github
---
 .github/workflows/CI-Windows.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/CI-Windows.yml b/.github/workflows/CI-Windows.yml
index 1922508..046f52b 100644
--- a/.github/workflows/CI-Windows.yml
+++ b/.github/workflows/CI-Windows.yml
@@ -29,9 +29,9 @@ jobs:
     - name: Install SDL2
       shell: powershell
       run: |
-        Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.26.5-VC.zip" -OutFile "SDL2-devel-2.26.5-VC.zip"
-        Expand-Archive -Path SDL2-devel-2.26.5-VC.zip
-        echo "SDL2_DIR=$(pwd)\SDL2-devel-2.26.5-VC\SDL2-2.26.5\" >>${env:GITHUB_ENV}
+        Invoke-WebRequest -Uri "https://github.com/libsdl-org/SDL/releases/download/release-2.28.4/SDL2-devel-2.28.4-VC.zip" -OutFile "SDL2-devel-2.28.4-VC.zip"
+        Expand-Archive -Path SDL2-devel-2.28.4-VC.zip
+        echo "SDL2_DIR=$(pwd)\SDL2-devel-2.28.4-VC\SDL2-2.28.4\" >>${env:GITHUB_ENV}
     - name: Build
       run: |
         mkdir build

From d398c501d490691df04bd0cc1ee6ea498855575b Mon Sep 17 00:00:00 2001
From: Leandro Nini <drfiemost@users.noreply.github.com>
Date: Thu, 5 Oct 2023 12:39:57 +0200
Subject: [PATCH 5/5] Add MinGW CI workflow

---
 .github/workflows/CI-MinGW.yml | 39 ++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 .github/workflows/CI-MinGW.yml

diff --git a/.github/workflows/CI-MinGW.yml b/.github/workflows/CI-MinGW.yml
new file mode 100644
index 0000000..f350de5
--- /dev/null
+++ b/.github/workflows/CI-MinGW.yml
@@ -0,0 +1,39 @@
+name: CI MinGW
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+  build:
+    name: Linux (${{ matrix.configuration }})
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        configuration: [Debug, Release]
+        include:
+          - generator: MSYS Makefiles
+            os: windows-latest
+    defaults:
+      run:
+        shell: msys2 {0}
+
+    steps:
+    - uses: msys2/setup-msys2@v2
+      with:
+        update: true
+        install: >-
+          git
+          base-devel
+          mingw-w64-x86_64-toolchain
+          mingw-w64-x86_64-cmake
+          mingw-w64-x86_64-SDL2
+    - uses: actions/checkout@v3
+    - name: Build
+      run: |
+        mkdir build
+        cd build
+        cmake -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ..
+        cmake --build .