From 45d1f547cd20cba0408a6f183c4067a220780b06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Camilla=20L=C3=B6wy?= <elmindreda@elmindreda.org>
Date: Wed, 9 Jun 2021 16:44:45 +0200
Subject: [PATCH] Move VS 2019 builds from AppVeyor to GH Actions

GitHub runners unfortunately do not come with MinGW or VS 2010
pre-installed, so moving those builds will be more involved.  MinGW-w64
is not a good replacement for MinGW as it is far more complete.

This gives at least some feedback for all supported platforms via the
GitHub Actions system.

(cherry picked from commit 4e788fc6dc08d635aaae72ea5c804d79fe272daa)
---
 .appveyor.yml               | 18 ++----------------
 .github/workflows/build.yml | 31 ++++++++++++++++++++++++++++---
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/.appveyor.yml b/.appveyor.yml
index a21829a6..a4a01666 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,6 +1,5 @@
 image:
     - Visual Studio 2015
-    - Visual Studio 2019
 branches:
     only:
         - ci
@@ -21,26 +20,13 @@ environment:
         - GENERATOR: Visual Studio 10 2010
           BUILD_SHARED_LIBS: OFF
           CFLAGS: /WX
-        - GENERATOR: Visual Studio 16 2019
-          BUILD_SHARED_LIBS: ON
-          CFLAGS: /WX
-        - GENERATOR: Visual Studio 16 2019
-          BUILD_SHARED_LIBS: OFF
-          CFLAGS: /WX
 matrix:
     fast_finish: true
-    exclude:
-        - image: Visual Studio 2015
-          GENERATOR: Visual Studio 16 2019
-        - image: Visual Studio 2019
-          GENERATOR: Visual Studio 10 2010
-        - image: Visual Studio 2019
-          GENERATOR: MinGW Makefiles
 for:
 -
     matrix:
-        except:
-            - GENERATOR: Visual Studio 10 2010
+        only:
+            - GENERATOR: MinGW Makefiles
     build_script:
         - set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
         - cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 48e1666c..1ca689ed 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -6,14 +6,14 @@ on:
 permissions:
     statuses: write
     contents: read
-env:
-    CC: clang
-    CFLAGS: -Werror
 
 jobs:
     build-linux-x11-clang:
         name: X11 (Linux, Clang)
         runs-on: ubuntu-latest
+        env:
+            CC: clang
+            CFLAGS: -Werror
         steps:
             - uses: actions/checkout@v2
             - name: Install dependencies
@@ -34,6 +34,9 @@ jobs:
     build-linux-wayland-clang:
         name: Wayland (Linux, Clang)
         runs-on: ubuntu-latest
+        env:
+            CC: clang
+            CFLAGS: -Werror
         steps:
             - uses: actions/checkout@v2
             - name: Install dependencies
@@ -54,6 +57,9 @@ jobs:
     build-linux-null-clang:
         name: Null (Linux, Clang)
         runs-on: ubuntu-latest
+        env:
+            CC: clang
+            CFLAGS: -Werror
         steps:
             - uses: actions/checkout@v2
             - name: Install dependencies
@@ -75,6 +81,7 @@ jobs:
         name: Cocoa (macOS, Clang)
         runs-on: macos-latest
         env:
+            CFLAGS: -Werror
             MACOSX_DEPLOYMENT_TARGET: 10.8
         steps:
             - uses: actions/checkout@v2
@@ -89,3 +96,21 @@ jobs:
             - name: Build shared library
               run: cmake --build build-shared --parallel
 
+    build-windows-win32-vs2019:
+        name: Win32 (Windows, VS2019)
+        runs-on: windows-latest
+        env:
+            CFLAGS: /WX
+        steps:
+            - uses: actions/checkout@v2
+
+            - name: Configure static library
+              run: cmake -S . -B build-static -G "Visual Studio 16 2019"
+            - name: Build static library
+              run: cmake --build build-static --parallel
+
+            - name: Configure shared library
+              run: cmake -S . -B build-shared -G "Visual Studio 16 2019" -D BUILD_SHARED_LIBS=ON
+            - name: Build shared library
+              run: cmake --build build-shared --parallel
+