Skip to content

Commit 8d43f97

Browse files
Build a macOS matrix
1 parent 92855eb commit 8d43f97

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ jobs:
110110
build-macos:
111111
name: Build & Test (macOS)
112112
runs-on: macos-15
113+
strategy:
114+
fail-fast: false
115+
matrix:
116+
compiler_spec: [GCC 13, GCC 14, GCC 15, Clang 18]
117+
target_arch: [x86_x64, arm64]
113118
steps:
114119
- *checkout
115120
- *get-uv
@@ -122,10 +127,34 @@ jobs:
122127
run: uv run --group=build true
123128
- name: Build & Test
124129
run: |
125-
export CC=gcc-13
126-
export CXX=g++-13
130+
set -eu
131+
132+
# Set the compiler that CMake will use:
133+
_spec="${{matrix.compiler_spec}}"
134+
# Trim out the major version number
135+
_compiler_id="${_spec% *}"
136+
_compiler_major="${_spec#* }"
137+
138+
if test "$_compiler_id" = "GCC"; then
139+
export CC=gcc-$_compiler_major
140+
export CXX=g++-$_compiler_major
141+
elif test "$_compiler_id" = "Clang"; then
142+
_llvm_prefix=$(brew --prefix llvm@$_compiler_major)
143+
export CC=$_llvm_prefix/bin/clang
144+
export CXX=$_llvm_prefix/bin/clang++
145+
else
146+
echo "Unknown compiler ID" 1>&2
147+
exit 2
148+
fi
149+
150+
# Tell CMake what arch we are targetting
151+
export CMAKE_OSX_ARCHITECTURES="${{matrix.target_arch}}"
152+
153+
# Create a directory for vcpkg binary caches
127154
export VCPKG_DEFAULT_BINARY_CACHE=$PWD/_build/_cache
128-
export CMAKE_OSX_ARCHITECTURES="arm64"
155+
mkdir -p "$VCPKG_DEFAULT_BINARY_CACHE"
156+
157+
# Do the build
129158
uv run --group=build \
130159
make build \
131160
CONFIGS="Debug;RelWithDebInfo" \

0 commit comments

Comments
 (0)