foxygit / doom Log in
commit 034de7f0a12c300d2e480253a3cc3d67f7093ee1
Author:     Roman Fomin <rfomin@gmail.com>
AuthorDate: Mon Oct 16 23:25:01 2023 +0700
Commit:     Roman Fomin <rfomin@gmail.com>
CommitDate: Tue Nov 7 21:21:15 2023 +0700

    Update CI workflow

    * Add a build for macOS.

    * Integrate MSYS2 build.

    * Upload artifacts.
---
 .github/workflows/main.yml  | 127 ++++++++++++++++++++++++++++++++++++++------
 .github/workflows/msys2.yml |  72 -------------------------
 2 files changed, 111 insertions(+), 88 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 9a7b640c..86f02e8f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,4 +1,4 @@
-name: Chocolate Doom
+name: Continuous Integration

 on:
   push:
@@ -9,31 +9,126 @@ on:
   pull_request:
     branches:
       - "master"
+    paths-ignore:
+      - "**.md"
   workflow_dispatch:

 jobs:
   build:
-    runs-on: ${{ matrix.os }}
-
+    name: ${{ matrix.config.name }}
+    runs-on: ${{ matrix.config.os }}
+    defaults:
+      run:
+        shell: ${{ matrix.config.shell }}
     strategy:
+      fail-fast: false
       matrix:
-        compiler: [clang, gcc]
-        os: [ubuntu-latest]
+        config:
+          - name: Linux GCC
+            os: ubuntu-latest
+            compiler: gcc
+            shell: bash
+
+          - name: macOS Clang
+            os: macos-latest
+            compiler: clang
+            shell: bash
+
+          - name: MSYS2 UCRT64
+            os: windows-latest
+            compiler: gcc
+            shell: 'msys2 {0}'
+            msystem: ucrt64
+            msys-env: mingw-w64-ucrt-x86_64
+
+          - name: MSYS2 MINGW32
+            os: windows-latest
+            compiler: gcc
+            shell: 'msys2 {0}'
+            msystem: mingw32
+            msys-env: mingw-w64-i686

     steps:
-      - name: Install dependencies
-        run: sudo apt-get update && sudo apt-get install libfluidsynth-dev libpng-dev libsamplerate0-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev ninja-build
+      - name: Install pandoc
+        if: runner.os == 'Windows'
+        shell: cmd
+        run: choco install pandoc
+
+      - name: Install dependencies (Linux)
+        if: runner.os == 'Linux'
+        run: |
+          sudo apt-get update
+          sudo apt-get install \
+            libsdl2-dev \
+            libsdl2-mixer-dev \
+            libsdl2-net-dev \
+            libpng-dev \
+            libsamplerate0-dev \
+            libfluidsynth-dev
+
+      - name: Install dependencies (macOS)
+        if: runner.os == 'macOS'
+        run: |
+          brew install \
+            automake \
+            sdl2 \
+            sdl2_mixer \
+            sdl2_net \
+            libpng \
+            libsamplerate \
+            fluid-synth

-      - uses: actions/checkout@v2
+      - name: Install dependencies (MSYS2)
+        if: runner.os == 'Windows'
+        uses: msys2/setup-msys2@v2
         with:
-          submodules: true
+          msystem: ${{ matrix.config.msystem }}
+          update: false
+          path-type: inherit
+          install: >-
+            autotools
+            zip
+            ${{ matrix.config.msys-env }}-gcc
+            ${{ matrix.config.msys-env }}-SDL2
+            ${{ matrix.config.msys-env }}-SDL2_mixer
+            ${{ matrix.config.msys-env }}-SDL2_net
+            ${{ matrix.config.msys-env }}-libpng
+            ${{ matrix.config.msys-env }}-libsamplerate
+            ${{ matrix.config.msys-env }}-fluidsynth

-      - name: CMake
-        env:
-          CC: ${{ matrix.compiler }}
-        run: cmake -S . -B build -G Ninja && ninja -C build
+      - uses: actions/checkout@v3

-      - name: Make
+      - name: Configure
         env:
-          CC: ${{ matrix.compiler }}
-        run: $GITHUB_WORKSPACE/.travis.sh
+          CC: ${{ matrix.config.compiler }}
+        run: |
+          ./autogen.sh
+
+      - name: Build
+        run: make -j4
+
+      - name: Package (macOS)
+        if: runner.os == 'macOS'
+        run: |
+          cd pkg/osx
+          make
+
+      - name: Package (MSYS2)
+        if: runner.os == 'Windows'
+        run: |
+          cd pkg/win32
+          make
+
+      - name: Upload artifacts (macOS)
+        if: runner.os == 'macOS'
+        uses: actions/upload-artifact@v3
+        with:
+          name: macOS
+          path: pkg/osx/*.dmg
+
+      - name: Upload artifacts (MSYS2)
+        if: runner.os == 'Windows'
+        uses: actions/upload-artifact@v3
+        with:
+          name: Win-${{ matrix.config.msystem }}
+          path: pkg/win32/*.zip
diff --git a/.github/workflows/msys2.yml b/.github/workflows/msys2.yml
deleted file mode 100644
index 0a391866..00000000
--- a/.github/workflows/msys2.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-name: msys2
-
-on:
-  push:
-    branches:
-      - "master"
-    paths-ignore:
-      - "**.md"
-  pull_request:
-    branches:
-      - "master"
-
-jobs:
-  build:
-    runs-on: windows-latest
-
-    defaults:
-      run:
-        shell: msys2 {0}
-
-    strategy:
-      fail-fast: false
-      matrix:
-        include:
-          - { sys: mingw64, env: x86_64 }
-          - { sys: mingw32, env: i686 }
-
-    steps:
-      - name: Install pandoc
-        shell: cmd
-        run: choco install pandoc
-
-      - name: Extract Version Number
-        shell: bash
-        run: echo "VERSION=${GITHUB_REF##*-}" >> $GITHUB_ENV
-
-      - name: Setup MSYS2
-        uses: msys2/setup-msys2@v2
-        with:
-          update: true
-          msystem: ${{ matrix.sys }}
-          path-type: inherit
-          install: >-
-            autotools
-            zip
-            mingw-w64-${{matrix.env}}-gcc
-            mingw-w64-${{matrix.env}}-SDL2
-            mingw-w64-${{matrix.env}}-SDL2_mixer
-            mingw-w64-${{matrix.env}}-SDL2_net
-            mingw-w64-${{matrix.env}}-libpng
-            mingw-w64-${{matrix.env}}-libsamplerate
-            mingw-w64-${{matrix.env}}-fluidsynth
-
-      - uses: actions/checkout@v3
-
-      - name: Configure
-        run: |
-          ./autogen.sh
-
-      - name: Build
-        run: make -j4
-
-      - name: Package
-        run: |
-          cd pkg/win32
-          make
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: Win-${{ matrix.env }}
-          path: pkg/win32/*.zip