GitHub Actions Apple Silicon CPU

GitHub Actions macOS runners 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-latest

    strategy:
      matrix:
        cxx: [g++-14, clang++]

    env:
      HOMEBREW_NO_AUTO_CLEANUP: 1
      CXX: ${{ matrix.cxx }}

    steps:
    - uses: actions/checkout

    - run: sudo xcode-select --switch /Applications/Xcode_16.app

    - run: cmake -B build
    - run: cmake --build build