SDL_mixer: updated github actions.

From 710c1b947d09dd66d545630c8adce7b8b97b2c6c Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 7 May 2022 17:51:50 +0300
Subject: [PATCH] updated github actions.

---
 .github/workflows/linux.yml |  91 ------------------------------
 .github/workflows/main.yml  | 108 ++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+), 91 deletions(-)
 delete mode 100644 .github/workflows/linux.yml
 create mode 100644 .github/workflows/main.yml

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
deleted file mode 100644
index 61518e02..00000000
--- a/.github/workflows/linux.yml
+++ /dev/null
@@ -1,91 +0,0 @@
-name: linux
-
-on:
-  push:
-    branches:
-      - "*"
-    paths-ignore:
-      - "**.md"
-  pull_request:
-    branches:
-      - "*"
-  workflow_dispatch:
-
-jobs:
-  build-cmake:
-    runs-on: ubuntu-latest
-    strategy:
-      fail-fast: false
-      matrix:
-        compiler: ["gcc", "clang"]
-        shared: [YES, NO]
-        build_type: [Release]
-
-    steps:
-      - name: "Checkout Code"
-        uses: actions/checkout@v2
-        with:
-          submodules: "recursive"
-          fetch-depth: 0
-
-      - name: dependencies
-        run: |
-          sudo apt -y update
-          sudo apt -y install ninja-build libsdl2-dev
-
-      - name: Check that versioning is consistent
-        run: ./test-versioning.sh
-
-      - name: Configure CMake
-        env:
-          CC: ${{matrix.compiler}}
-        run: |
-          cmake -S . -B build -D CMAKE_BUILD_TYPE=${{matrix.build_type}} \
-                -G Ninja -D BUILD_SHARED_LIBS=${{matrix.shared}}
-
-      - name: Build CMake
-        run: ninja -C build
-  build-make:
-    runs-on: ubuntu-latest
-    strategy:
-      fail-fast: false
-      matrix:
-        compiler: ["gcc", "clang"]
-
-    steps:
-      - name: "Checkout Code"
-        uses: actions/checkout@v2
-        with:
-          submodules: "recursive"
-          fetch-depth: 0
-
-      - name: dependencies
-        run: |
-          sudo apt -y update
-          sudo apt -y install \
-            autoconf \
-            libtool \
-            libsdl2-dev \
-            ${NULL+}
-
-      - name: Configure make
-        env:
-          CC: ${{matrix.compiler}}
-        run: |
-          ./autogen.sh
-          ./configure
-
-      - name: Build make
-        run: make -j2
-
-      - name: Distcheck
-        run: |
-          set -eu
-          parallel="$(getconf _NPROCESSORS_ONLN)"
-          make -j"${parallel}" dist V=1
-          # Similar to Automake `make distcheck`: check that the tarball
-          # release is sufficient to do a new build
-          mkdir distcheck
-          tar -C distcheck -zxf SDL2_mixer-*.tar.gz
-          ( cd distcheck/SDL2_mixer-* && ./configure )
-          make -C distcheck/SDL2_mixer-*
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..65c1fb98
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,108 @@
+name: Build
+
+on: [push, pull_request]
+
+jobs:
+  Build:
+    name: ${{ matrix.platform.name }}
+    runs-on: ${{ matrix.platform.os }}
+
+    defaults:
+      run:
+        shell: ${{ matrix.platform.shell }}
+
+    strategy:
+      fail-fast: false
+      matrix:
+        platform:
+        - { 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 (CMake),          os: ubuntu-20.04,   shell: sh,   cmake: '-GNinja' }
+        - { name: Linux (autotools),      os: ubuntu-20.04,   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 }}-SDL2
+          ${{ matrix.platform.msys-env }}-autotools
+          ${{ matrix.platform.msys-env }}-cmake
+          ${{ matrix.platform.msys-env }}-gcc
+          ${{ matrix.platform.msys-env }}-mpg123
+          ${{ matrix.platform.msys-env }}-flac
+          ${{ matrix.platform.msys-env }}-libmodplug
+          ${{ matrix.platform.msys-env }}-fluidsynth
+          ${{ matrix.platform.msys-env }}-libvorbis
+          ${{ matrix.platform.msys-env }}-opusfile
+          ${{ matrix.platform.msys-env }}-ninja
+          ${{ matrix.platform.msys-env }}-pkg-config
+
+    - name: Setup Linux dependencies
+      if: runner.os == 'Linux'
+      run: |
+        sudo apt-get update
+        sudo apt-get -y install \
+          autoconf \
+          automake \
+          cmake \
+          libsdl2-dev \
+          libmpg123-dev \
+          libflac-dev \
+          libmodplug-dev \
+          libfluidsynth-dev \
+          libvorbis-dev \
+          libopusfile-dev \
+          ninja-build \
+          pkg-config \
+          ${NULL+}
+    - uses: actions/checkout@v2
+    - name: Check that versioning is consistent
+      # We only need to run this once: arbitrarily use the Linux/CMake build
+      if: "runner.os == 'Linux' && matrix.platform.cmake"
+      run: ./test-versioning.sh
+
+    - name: Configure CMake
+      if: "matrix.platform.cmake"
+      run: |
+        cmake -B build \
+          -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
+          -DCMAKE_VERBOSE_MAKEFILE=ON \
+          ${{ matrix.platform.cmake }}
+    - name: Build
+      if: "matrix.platform.cmake"
+      run: cmake --build build/ --config Release
+#    - name: Install
+#      if: "matrix.platform.shell == 'sh' && matrix.platform.cmake"
+#      run: |
+#        set -eu
+#        rm -fr DESTDIR-cmake
+#        DESTDIR=$(pwd)/DESTDIR-cmake cmake --install build/ --config Release
+#        ( cd DESTDIR-cmake; find ) | LC_ALL=C sort -u
+
+    - name: Configure Autotools
+      if: "! matrix.platform.cmake"
+      run: |
+        set -eu
+        rm -fr build-autotools
+        mkdir build-autotools
+        ./autogen.sh
+        ( cd build-autotools && ../configure )
+    - name: Build with Autotools
+      if: "! matrix.platform.cmake"
+      run: |
+        set -eu
+        parallel="$(getconf _NPROCESSORS_ONLN)"
+        make -j"${parallel}" -C build-autotools V=1
+    - name: Install with Autotools
+      if: "! matrix.platform.cmake"
+      run: |
+        set -eu
+        curdir="$(pwd)"
+        parallel="$(getconf _NPROCESSORS_ONLN)"
+        rm -fr DESTDIR-autotools
+        mkdir DESTDIR-autotools
+        make -j"${parallel}" -C build-autotools install DESTDIR="${curdir}/DESTDIR-autotools" V=1
+        ( cd DESTDIR-autotools; find ) | LC_ALL=C sort -u