Skip to content

ci: Upgrade to LLVM Clang 16 to support C++20 features on macOS 13 and 14; Ensure LLVM Toolchain Consistency; Add macOS 15 to GitHub workflow. #2406

ci: Upgrade to LLVM Clang 16 to support C++20 features on macOS 13 and 14; Ensure LLVM Toolchain Consistency; Add macOS 15 to GitHub workflow.

ci: Upgrade to LLVM Clang 16 to support C++20 features on macOS 13 and 14; Ensure LLVM Toolchain Consistency; Add macOS 15 to GitHub workflow. #2406

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:
os: ["macos-13", "macos-14"]
use_shared_libs: [true, false]
runs-on: "${{matrix.os}}"
steps:
- uses: "actions/checkout@v4"
with:
submodules: "recursive"
- if: "'macos-13' == matrix.os || 'macos-14' == matrix.os"
name: "Upgrade the default AppleClang to LLVM Clang for C++20 features"
shell: "bash"
run: |
brew install llvm@16
echo "USE_LLVM_COMPILER=true" >> $GITHUB_ENV
echo "LLVM_INSTALL_BINDIR=$(brew --prefix llvm@16)/bin" >> $GITHUB_ENV
- name: "Build CLP-core and run unit tests"
shell: "bash"
working-directory: "./components/core"
# NOTE: We omit the Stopwatch tests since GH's macOS runner is too slow
run: >-
$(
[[ "${{ env.USE_LLVM_COMPILER }}" == "true" ]]
&& echo
"env"
"CC=${{ env.LLVM_INSTALL_BINDIR }}/clang"
"CXX=${{ env.LLVM_INSTALL_BINDIR }}/clang++"
)
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]"
$(
[[ "${{ env.USE_LLVM_COMPILER }}" == "true" ]]
&& echo
"--ar ${{ env.LLVM_INSTALL_BINDIR }}/llvm-ar"
"--ranlib ${{ env.LLVM_INSTALL_BINDIR }}/llvm-ranlib"
)
# 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"