SDL_image: workflows: Run the new automated test for Autotools

From 734780f4ecf40cb74ac2113f11e6641fbd2942de Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Thu, 19 May 2022 15:04:06 +0100
Subject: [PATCH] workflows: Run the new automated test for Autotools

I haven't set it up for CMake yet (although it does work) because that
would conflict pretty badly with #238.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 .github/workflows/main.yml | 49 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5c07a37..c803973 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -95,13 +95,49 @@ jobs:
         rm -fr build-autotools
         mkdir build-autotools
         ./autogen.sh
-        ( cd build-autotools && ../configure )
+        # We do the CMake build with stb_image and the Autotools build without
+        set -- --disable-stb-image
+        # mingw-w64-*-SDL2 doesn't have SDL_test, so only build this on Unix
+        if [ "${{ matrix.platform.shell }}" = 'sh' ]; then
+          set -- "$@" --enable-tests
+          set -- "$@" --enable-installed-tests
+        fi
+        ( 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: Run tests with Autotools
+      if: "! matrix.platform.cmake"
+      run: |
+        set -eu
+        parallel="$(getconf _NPROCESSORS_ONLN)"
+
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_AVIF=0
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_BMP=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_CUR=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_GIF=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_ICO=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_JPG=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_JXL=0
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_LBM=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_PCX=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_PNG=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_PNM=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_QOI=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_SVG=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_TGA=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_TIF=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_WEBP=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_XPM=1
+        export SDL_IMAGE_TEST_REQUIRE_LOAD_XV=1
+
+        export SDL_IMAGE_TEST_REQUIRE_SAVE_JPG=1
+        export SDL_IMAGE_TEST_REQUIRE_SAVE_PNG=1
+
+        make -j"${parallel}" -C build-autotools check V=1 VERBOSE=1
     - name: Install with Autotools
       if: "! matrix.platform.cmake"
       run: |
@@ -118,3 +154,14 @@ jobs:
         set -eu
         parallel="$(getconf _NPROCESSORS_ONLN)"
         make -j"${parallel}" -C build-autotools distcheck V=1
+    - name: Upload artifacts
+      if: "failure() && runner.os == 'Linux' && ! matrix.platform.cmake"
+      uses: actions/upload-artifact@v3
+      with:
+        name: Autotools artifacts
+        path: |
+          build-autotools/test/*.bmp
+          build-autotools/test/*.jpg
+          build-autotools/test/*.log
+          build-autotools/test/*.png
+        if-no-files-found: ignore