Update macOS Github Actions

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
GitOrigin-RevId: dfb039290ef006753d11afc95496b8295963b03c
Change-Id: I345d636ca9360f25c153e5a77598f45391f5fbd8
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index 211aeac..a274432 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -546,21 +546,40 @@
             codecov: win64_gcc_compat_no_opt
 
           - name: macOS Clang ASAN
-            os: macos-latest
+            os: macos-13
             compiler: clang
             cxx-compiler: clang++
             cmake-args: -DWITH_SANITIZER=Address
             codecov: macos_clang
 
-          - name: macOS GCC UBSAN
+          - name: macOS Clang ASAN (ARM64)
             os: macos-latest
+            compiler: clang
+            cxx-compiler: clang++
+            cmake-args: -DWITH_SANITIZER=Address
+            codecov: macos_clang_arm64
+
+          - name: macOS GCC UBSAN
+            os: macos-13
             compiler: gcc-10
             cxx-compiler: g++-10
+            # Xcode 15 uses a new linker that is not compatible with GCC. Switch to the old linker.
+            # Homebrew gcc@11 and later have a built-in workaround for it.
+            ldflags: -ld_classic
             cmake-args: -DWITH_SANITIZER=Undefined
             packages: gcc@10
             gcov-exec: gcov-10
             codecov: macos_gcc
 
+          - name: macOS GCC UBSAN (ARM64)
+            os: macos-latest
+            compiler: gcc-11
+            cxx-compiler: g++-11
+            cmake-args: -DWITH_SANITIZER=Undefined
+            packages: gcc@11
+            gcov-exec: gcov-11
+            codecov: macos_gcc_arm64
+
           - name: macOS Clang Native Instructions (ARM64)
             os: macos-14
             compiler: clang
diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml
index 2910c5c..2e67541 100644
--- a/.github/workflows/configure.yml
+++ b/.github/workflows/configure.yml
@@ -195,19 +195,43 @@
             emu-run: node
 
           - name: macOS GCC Symbol Prefix
-            os: macOS-latest
+            os: macos-13
             compiler: gcc-11
             configure-args: --sprefix=zTest_
+            packages: gcc@11
+
+          - name: macOS GCC Symbol Prefix (ARM64)
+            os: macos-latest
+            compiler: gcc-11
+            cflags: -std=gnu11
+            configure-args: --sprefix=zTest_
+            packages: gcc@11
 
           - name: macOS GCC Symbol Prefix & Compat
-            os: macOS-latest
+            os: macos-13
             compiler: gcc-11
             configure-args: --zlib-compat --sprefix=zTest_
+            packages: gcc@11
+
+          - name: macOS GCC Symbol Prefix & Compat (ARM64)
+            os: macos-latest
+            compiler: gcc-11
+            cflags: -std=gnu11
+            configure-args: --zlib-compat --sprefix=zTest_
+            packages: gcc@11
 
           - name: macOS GCC
-            os: macOS-latest
+            os: macos-13
             compiler: gcc-11
             configure-args: --warn
+            packages: gcc@11
+
+          - name: macOS GCC (ARM64)
+            os: macos-latest
+            compiler: gcc-11
+            cflags: -std=gnu11
+            configure-args: --warn
+            packages: gcc@11
 
     steps:
     - name: Checkout repository
@@ -229,6 +253,12 @@
         sudo apt-get update
         sudo apt-get install -y ${{ matrix.packages }}
 
+    - name: Install packages (macOS)
+      if: runner.os == 'macOS'
+      run: brew install ninja ${{ matrix.packages }}
+      env:
+        HOMEBREW_NO_INSTALL_CLEANUP: 1
+
     - name: Install Emscripten
       if: contains(matrix.name, 'WASM32')
       uses: mymindstorm/setup-emsdk@v14