SDL_net: workflows: Add some basic CI using Github Actions

From bce38c5c9f383d7780de81d86b50722ecbdfd335 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Thu, 5 May 2022 18:54:52 +0100
Subject: [PATCH] workflows: Add some basic CI using Github Actions

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

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..2959a72
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,70 @@
+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 (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 }}-gcc
+          ${{ 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 \
+          libsdl2-dev \
+          pkg-config \
+          ${NULL+}
+    - uses: actions/checkout@v2
+
+    - name: Configure Autotools
+      run: |
+        set -eu
+        ./autogen.sh
+        ./configure
+    - name: Build with Autotools
+      run: |
+        set -eu
+        parallel="$(getconf _NPROCESSORS_ONLN)"
+        make -j"${parallel}" V=1
+    - name: Install with Autotools
+      run: |
+        set -eu
+        curdir="$(pwd)"
+        parallel="$(getconf _NPROCESSORS_ONLN)"
+        rm -fr DESTDIR-autotools
+        mkdir DESTDIR-autotools
+        make -j"${parallel}" install DESTDIR="${curdir}/DESTDIR-autotools" V=1
+        ( cd DESTDIR-autotools; find ) | LC_ALL=C sort -u
+    - name: Distcheck with Autotools
+      if: "runner.os == 'Linux'"
+      run: |
+        set -eu
+        parallel="$(getconf _NPROCESSORS_ONLN)"
+        make -j"${parallel}" distcheck V=1