GitHub Actions Apple Silicon CPU
GitHub Actions macOS runners can use Apple Silicon CPU, which is what most Apple users have. Some build issues including the linker have historically had Apple Silicon-specific issues. Generally it’s good to test on the same CPU architecture as the target platform.
We sometimes find it necessary to select the Xcode version compatible with Homebrew GCC if build errors occur that are not present on a physical Apple Silicon laptop.
jobs:
mac:
runs-on: macos-14
strategy:
matrix:
cxx: [g++-13, clang++]
env:
HOMEBREW_NO_AUTO_CLEANUP: 1
CXX: ${{ matrix.cxx }}
steps:
- uses: actions/checkout
- name: Ninja install
run: brew install ninja
- run: sudo xcode-select --switch /Applications/Xcode_15.1.app
- run: cmake --workflow --preset debug
- run: cmake --workflow --preset release
In this example Ninja enables quick testing of builds in Debug and Release mode, which is important to catch bugs.