From c456ad64d1291bcf057c22a5c34479fcb4bbda55 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Mon, 4 Mar 2024 14:02:39 -0800 Subject: [PATCH] fix(CI): Add Mac-arm64 to build matrix (#1359) Support for this came out in January, 2024. Explicit macos versions seem to be necessary for now, until GitHub offers "latest" labels targeting specific architectures. --- .github/workflows/build-matrix.json | 11 ++++++++++- .github/workflows/build.yaml | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-matrix.json b/.github/workflows/build-matrix.json index 71c87f1833..506e59b0ac 100644 --- a/.github/workflows/build-matrix.json +++ b/.github/workflows/build-matrix.json @@ -9,12 +9,21 @@ "generator": "Ninja" }, { - "os": "macos-latest", + "comment": "Explicit macOS version 13 is required for explicit x64 CPU.", + "os": "macos-13", "os_name": "osx", "target_arch": "x64", "exe_ext": "", "generator": "Ninja" }, + { + "comment": "Explicit macOS version 14 is required for explicit arm64 CPU.", + "os": "macos-14", + "os_name": "osx", + "target_arch": "arm64", + "exe_ext": "", + "generator": "Ninja" + }, { "os": "windows-latest", "os_name": "win", diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6f0c159e0f..13c7b145cc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -127,6 +127,28 @@ jobs: run: | brew install ninja + - name: Check Mac CPU architecture + if: runner.os == 'macOS' + # In case we get confused about GitHub's mac VM image labels, + # explicitly check that the CPU type matches our expectations. + run: | + if [[ "${{matrix.target_arch}}" == "arm64" ]]; then + CORRECT_LABEL="arm64" + else + CORRECT_LABEL="x86_64" + fi + + LABEL=$(uname -m) + echo "Hardware label: \"$LABEL\"" + + if [[ "$LABEL" != "$CORRECT_LABEL" ]]; then + echo "Wrong hardware label \"$LABEL\", expecting \"$CORRECT_LABEL\"." + echo "Full uname string: $(uname -a)" + echo "Full sysctl CPU info:" + sysctl machdep.cpu + exit 1 + fi + - name: Generate build files run: | mkdir -p build/