SDL_image: ci: try experimental madebr/setup-sdl action

From 5594a91031d74a7b54f8f487309f3a8736d79b75 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 17 Jun 2023 02:49:30 +0200
Subject: [PATCH] ci: try experimental madebr/setup-sdl action

---
 .github/workflows/main.yml | 81 ++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 42 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 238887a4..3bd66d8e 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -23,13 +23,16 @@ jobs:
         - { name: Macos,             os: macos-latest,   shell: sh,  cmake: '-DSDL3IMAGE_VENDORED=ON -GNinja', shared: 1, static: 0 }
 
     steps:
+    - uses: ilammy/msvc-dev-cmd@v1
+      if: "matrix.platform.msvc"
+      with:
+        arch: x64
     - name: Set up MSYS2
       if: ${{ contains(matrix.platform.shell, 'msys2') }}
       uses: msys2/setup-msys2@v2
       with:
         msystem: ${{ matrix.platform.msystem }}
         install: >-
-          ${{ matrix.platform.msys-env }}-SDL3
           ${{ matrix.platform.msys-env }}-cmake
           ${{ matrix.platform.msys-env }}-gcc
           ${{ matrix.platform.msys-env }}-libavif
@@ -41,21 +44,26 @@ jobs:
           ${{ matrix.platform.msys-env }}-ninja
           ${{ matrix.platform.msys-env }}-pkg-config
           ${{ matrix.platform.msys-env }}-zlib
+    - name: Set up SDL
+      id: sdl
+      uses: madebr/setup-sdl@master
+      with:
+        version: 3-head
+        shell: ${{ matrix.platform.shell }}
     - name: Setup Macos dependencies
       if: runner.os == 'macOS'
       run: |
-          brew install \
-            jpeg \
-            libavif \
-            libpng \
-            libtiff \
-            libtool \
-            ninja \
-            pkg-config \
-            webp \
-            zlib \
-            ${NULL+}
-          brew install sdl3
+        brew install \
+          jpeg \
+          libavif \
+          libpng \
+          libtiff \
+          libtool \
+          ninja \
+          pkg-config \
+          webp \
+          zlib \
+          ${NULL+}
     - name: Setup Linux dependencies
       if: runner.os == 'Linux'
       run: |
@@ -64,7 +72,6 @@ jobs:
           cmake \
           libjpeg-dev \
           libpng-dev \
-          libSDL3-dev \
           libtiff-dev \
           libwebp-dev \
           ninja-build \
@@ -72,25 +79,15 @@ jobs:
           zlib1g-dev \
           ${NULL+}
 
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
       with:
         submodules: recursive
 
-    - name: Setup MSVC dependencies
-      if: "matrix.platform.msvc"
-      shell: pwsh
-      run: |
-        .github/fetch_sdl_vc.ps1
-        echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/SDL3-devel-VC" >> $Env:GITHUB_ENV
     - name: Setup Ninja for MSVC
       if: "matrix.platform.msvc"
       uses: ashutoshvarma/setup-ninja@master
       with:
-        version: 1.10.2
-    - uses: ilammy/msvc-dev-cmd@v1
-      if: "matrix.platform.msvc"
-      with:
-        arch: x64
+        version: 1.11.1
 
     - name: Check that versioning is consistent
       # We only need to run this once: arbitrarily use the Linux build
@@ -99,10 +96,10 @@ jobs:
 
     - name: Setup
       if: ${{ !matrix.platform.msystem && !matrix.platform.msvc }}
-      uses: jwlawson/actions-setup-cmake@v1.12
+      uses: jwlawson/actions-setup-cmake@v1.14
       with:
         cmake-version: '3.16'
-    - name: Configure
+    - name: Configure (CMake)
       run: |
         set -- \
           -DBUILD_SHARED_LIBS=ON \
@@ -117,13 +114,13 @@ jobs:
           ${NULL+}
 
         if [ "${{ matrix.platform.msystem }}" = "" ]; then
-            # mingw-w64-*-SDL3 doesn't have SDL_test, and the macOS CMake
-            # build can't find it (see #260), so we only enable build-time
-            # tests for Linux at the moment.
-            set -- "$@" -DSDL3IMAGE_TESTS=ON
-            # If we dlopen() vendored soft dependencies, the test won't
-            # find them: https://github.com/libsdl-org/SDL_image/issues/259
-            set -- "$@" -DSDL3IMAGE_DEPS_SHARED=OFF
+          # mingw-w64-*-SDL3 doesn't have SDL_test, and the macOS CMake
+          # build can't find it (see #260), so we only enable build-time
+          # tests for Linux at the moment.
+          set -- "$@" -DSDL3IMAGE_TESTS=ON
+          # If we dlopen() vendored soft dependencies, the test won't
+          # find them: https://github.com/libsdl-org/SDL_image/issues/259
+          set -- "$@" -DSDL3IMAGE_DEPS_SHARED=OFF
         fi
 
         cmake -B build \
@@ -132,6 +129,7 @@ jobs:
     - name: Build (CMake)
       run: cmake --build build/ --config Release --parallel --verbose
     - name: Run build-time tests
+      if: "runner.os != 'Windows'"
       run: |
         set -eu
 
@@ -165,7 +163,7 @@ jobs:
         set -eu
         rm -fr DESTDIR-cmake
         cmake --install build/ --config Release
-        echo "SDL3_image_DIR=$(pwd)/prefix_cmake" >> $GITHUB_ENV
+        echo "SDL3_image_ROOT=$(pwd)/prefix_cmake" >> $GITHUB_ENV
         ( cd prefix_cmake; find . ) | LC_ALL=C sort -u
     - name: Upload artifacts
       if: "failure() && runner.os == 'Linux'"
@@ -180,9 +178,8 @@ jobs:
 
     - name: Verify CMake configuration files
       run: |
-          cmake -S cmake/test -B cmake_config_build \
-            -DCMAKE_BUILD_TYPE=Release \
-            -DCMAKE_PREFIX_PATH="${{ env.SDL3_image_DIR }};${{ env.SDL3_DIR }}" \
-            -DTEST_SHARED=${{ matrix.platform.shared }} \
-            -DTEST_STATIC=${{ matrix.platform.static }}
-          cmake --build cmake_config_build --verbose
+        cmake -S cmake/test -B cmake_config_build \
+          -DCMAKE_BUILD_TYPE=Release \
+          -DTEST_SHARED=${{ matrix.platform.shared }} \
+          -DTEST_STATIC=${{ matrix.platform.static }}
+        cmake --build cmake_config_build --verbose