Skip to content

build(cmake): Add toolchain specification and validations utilities to support C++20 features on macOS 13/14 via LLVM Clang v16. #2396

build(cmake): Add toolchain specification and validations utilities to support C++20 features on macOS 13/14 via LLVM Clang v16.

build(cmake): Add toolchain specification and validations utilities to support C++20 features on macOS 13/14 via LLVM Clang v16. #2396

name: "clp-core-build-macos"
on:
pull_request:
paths:
- ".github/workflows/clp-core-build-macos.yaml"
- "components/core/cmake/**"
- "components/core/CMakeLists.txt"
- "components/core/src/**"
- "components/core/tests/**"
- "components/core/tools/scripts/lib_install/macos/**"
- "components/core/tools/scripts/deps-download/**"
- "components/core/tools/scripts/utils/build-and-run-unit-tests.py"
- "deps-tasks.yml"
- "Taskfile.yml"
- "tools/scripts/deps-download/**"
push:
paths:
- ".github/workflows/clp-core-build-macos.yaml"
- "components/core/cmake/**"
- "components/core/CMakeLists.txt"
- "components/core/src/**"
- "components/core/tests/**"
- "components/core/tools/scripts/lib_install/macos/**"
- "components/core/tools/scripts/deps-download/**"
- "components/core/tools/scripts/utils/build-and-run-unit-tests.py"
- "deps-tasks.yml"
- "Taskfile.yml"
- "tools/scripts/deps-download/**"
schedule:
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
- cron: "15 0 * * *"
workflow_dispatch:
concurrency:
group: "${{github.workflow}}-${{github.ref}}"
# Cancel in-progress jobs for efficiency
cancel-in-progress: true
jobs:
build-macos:
strategy:
matrix:
runner: ["macos-13", "macos-14"]
use_shared_libs: [true, false]
runs-on: "${{matrix.runner}}"
steps:
- uses: "actions/checkout@v4"
with:
submodules: "recursive"
# See https://github.com/actions/setup-python/issues/577
- name: "Remove preinstalled binaries which conflict with brew's installs"
run: |
rm -f /usr/local/bin/2to3*
rm -f /usr/local/bin/go*
rm -f /usr/local/bin/idle3*
rm -f /usr/local/bin/pydoc3*
rm -f /usr/local/bin/python3*
- name: "Install dependencies"
run: "./components/core/tools/scripts/lib_install/macos/install-all.sh"
- run: "./tools/scripts/deps-download/init.sh"
shell: "bash"
- run: "task deps:core"
shell: "bash"
- name: "Check AR version"
run: |-
echo "-----------------"
ls /opt/homebrew/opt/llvm@16/bin/llvm-ar || true
ls /opt/homebrew/opt/llvm@16/bin/llvm-ranlib || true
ls /opt/homebrew/opt/llvm@16/bin/llvm-ar -V || true
echo "-----------------"
ls /usr/local/opt/llvm@16/bin/llvm-ar || true
ls /usr/local/opt/llvm@16/bin/llvm-ranlib || true
ls /usr/local/opt/llvm@16/bin/llvm-ar -V || true
echo "-----------------"
ls -l /usr/bin/ar
/usr/bin/ar -V || true
ls -l /usr/bin/ranlib
echo "-----------------"
- name: "Build CLP-core and run unit tests"
env: >-
${{
'macos-13' == matrix.runner
&& fromJson('{
"CC": "/usr/local/opt/llvm@16/bin/clang",
"CMAKE_AR": "/usr/local/opt/llvm@16/bin/llvm-ar",
"CMAKE_RANLIB": "/usr/local/opt/llvm@16/bin/llvm-ranlib",
"CXX": "/usr/local/opt/llvm@16/bin/clang++"
}')
|| 'macos-14' == matrix.runner
&& fromJson('{
"CC": "/opt/homebrew/opt/llvm@16/bin/clang",
"CMAKE_AR": "/usr/bin/ar",
"CMAKE_RANLIB": "usr/bin/ranlib",
"CXX": "/opt/homebrew/opt/llvm@16/bin/clang++"
}')
|| fromJson('{}')
}}
shell: "bash"
working-directory: "./components/core"
# NOTE: We omit the Stopwatch tests since GH's macOS runner is too slow
run: >-
python3 ./tools/scripts/utils/build-and-run-unit-tests.py
${{matrix.use_shared_libs == 'true' && '--use-shared-libs' || ''}}
--source-dir .
--build-dir build
--num-jobs $(getconf _NPROCESSORS_ONLN)
--test-spec "~[Stopwatch]"