Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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. #745

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions .github/workflows/clp-core-build-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ jobs:
build-macos:
strategy:
matrix:
runner: ["macos-13", "macos-14"]
os:
- "macos-13"
- "macos-14"
- "macos-15"
use_shared_libs: [true, false]
runs-on: "${{matrix.runner}}"
runs-on: "${{matrix.os}}"
steps:
- uses: "actions/checkout@v4"
with:
Expand All @@ -67,14 +70,35 @@ jobs:
- run: "task deps:core"
shell: "bash"

- 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"
)
18 changes: 16 additions & 2 deletions components/core/tools/scripts/utils/build-and-run-unit-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@
logger = logging.getLogger(__name__)


def _config_cmake_project(src_dir: Path, build_dir: Path, use_shared_libs: bool):
def _config_cmake_project(
src_dir: Path,
build_dir: Path,
use_shared_libs: bool,
ar: Optional[Path],
ranlib: Optional[Path],
):
cmd = [
"cmake",
"-S",
Expand All @@ -31,6 +37,10 @@ def _config_cmake_project(src_dir: Path, build_dir: Path, use_shared_libs: bool)
]
if use_shared_libs:
cmd.append("-DCLP_USE_STATIC_LIBS=OFF")
if ar:
cmd.append(f"-DCMAKE_AR={ar}")
if ranlib:
cmd.append(f"-DCMAKE_RANLIB={ranlib}")
subprocess.run(cmd, check=True)


Expand Down Expand Up @@ -82,15 +92,19 @@ def main(argv: List[str]) -> int:
"--num-jobs", type=int, help="Max number of jobs to run when building."
)
args_parser.add_argument("--test-spec", help="Catch2 test specification.")
args_parser.add_argument("--ar", help="Archiver tool to use.")
args_parser.add_argument("--ranlib", help="Ranlib indexing tool to use.")

parsed_args = args_parser.parse_args(argv[1:])
src_dir: Path = Path(parsed_args.source_dir)
build_dir: Path = Path(parsed_args.build_dir)
use_shared_libs: bool = parsed_args.use_shared_libs
num_jobs: Optional[int] = parsed_args.num_jobs
test_spec: Optional[str] = parsed_args.test_spec
ar: Optional[Path] = parsed_args.ar
ranlib: Optional[Path] = parsed_args.ranlib

_config_cmake_project(src_dir, build_dir, use_shared_libs)
_config_cmake_project(src_dir, build_dir, use_shared_libs, ar, ranlib)
_build_project(build_dir, num_jobs)
_run_unit_tests(build_dir, test_spec)

Expand Down
Loading