Skip to content

Commit 98a4f13

Browse files
committed
ci: enable macos
fix cppalliance#558 fix cppalliance#694
1 parent 842fcd6 commit 98a4f13

File tree

1 file changed

+63
-20
lines changed

1 file changed

+63
-20
lines changed

.github/workflows/ci.yml

+63-20
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,26 @@ jobs:
3737
gcc 14
3838
clang 18
3939
msvc >=14.40
40+
apple-clang *
4041
standards: '20'
41-
latest-factors: ''
42-
factors: |
42+
latest-factors: |
4343
msvc Optimized-Debug
44+
factors: ''
45+
runs-on: |
46+
apple-clang: macos-15
4447
build-types: |
4548
gcc: Release
4649
clang: Release
50+
apple-clang: Release
4751
msvc: RelWithDebInfo
4852
msvc Optimized-Debug: Debug
4953
ccflags: |
5054
msvc Optimized-Debug: /Ob1 /O2 /Zi
5155
cxxflags: |
5256
msvc Optimized-Debug: /Ob1 /O2 /Zi
5357
install: |
54-
gcc: git build-essential pkg-config python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev libxml2-utils libxml2-dev
55-
clang: git build-essential pkg-config python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev libxml2-utils libxml2-dev
58+
gcc: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev
59+
clang: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev
5660
msvc: ''
5761
extra-values: |
5862
llvm-hash: e1065370aaacb1b1cb48e77d37d376bf024f4a39
@@ -68,6 +72,8 @@ jobs:
6872
llvm-archive-filename: {{ llvm-archive-basename }}.{{ llvm-archive-extension }}
6973
libcxx-runtimes: libcxx;libcxxabi{{#if (ine os 'windows') }};libunwind{{/if}}
7074
libcxx-targets: cxx {{#if (ine os 'windows') }}cxxabi unwind{{/if}} install-cxx {{#if (ine os 'windows') }}install-cxxabi install-unwind{{/if}}
75+
libcxx-cxxflags: {{#if (ieq os 'windows') }}-D__ORDER_LITTLE_ENDIAN__=1234 -D__ORDER_BIG_ENDIAN__=4321 -D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__{{/if}}
76+
libcxx-cmake-args: -D LLVM_ENABLE_RUNTIMES="{{ libcxx-runtimes }}" {{#if (ieq os 'windows') }}-D LIBCXXABI_USE_LLVM_UNWINDER=OFF -D LIBCXXABI_ENABLE_SHARED=OFF -D LIBCXXABI_ENABLE_STATIC=ON -D LIBCXX_ENABLE_SHARED=OFF -D LIBCXX_NO_VCRUNTIME=ON{{/if}} {{#if (ieq os 'macos') }}-D CMAKE_OSX_ARCHITECTURES=""{{/if}}
7177
mrdocs-ccflags: {{ ccflags }} {{#if (eq compiler 'gcc') }}-static{{/if}} {{#if asan }}-static-libasan{{/if}} {{#if tsan }}-static-libtsan{{/if}}
7278
mrdocs-cxxflags: {{ cxxflags }} {{#if (eq compiler 'gcc') }}-static{{/if}} {{#if asan }}-static-libasan{{/if}} {{#if tsan }}-static-libtsan{{/if}}
7379
mrdocs-package-generators: {{#if (ieq os 'windows') }}7Z ZIP WIX{{else}}TGZ TXZ{{/if}}
@@ -131,8 +137,7 @@ jobs:
131137
trace-commands: 'true'
132138

133139
- name: Setup Ninja
134-
uses: seanmiddleditch/gha-setup-ninja@v4
135-
if: ${{ runner.os == 'Windows' }}
140+
uses: seanmiddleditch/gha-setup-ninja@v5
136141

137142
- name: Setup C++
138143
uses: alandefreitas/cpp-actions/[email protected]
@@ -141,6 +146,15 @@ jobs:
141146
compiler: ${{ matrix.compiler }}
142147
version: ${{ matrix.version }}
143148

149+
# If apple-clang on macos, we run `clang -print-targets` to
150+
# get the list of targets supported by the compiler.
151+
- name: Print Clang Targets
152+
if: matrix.compiler == 'apple-clang'
153+
run: |
154+
set -x
155+
${{ steps.setup-cpp.outputs.cxx }} --print-targets
156+
${{ steps.setup-cpp.outputs.cxx }} --print-target-triple
157+
144158
- name: Install System Packages
145159
uses: alandefreitas/cpp-actions/[email protected]
146160
if: matrix.compiler != 'msvc'
@@ -323,24 +337,19 @@ jobs:
323337
source-dir: ../third-party/llvm-project/runtimes
324338
build-dir: ${sourceDir}/build-libcxx
325339
build-target: ${{ matrix.libcxx-targets }}
326-
cc: ../third-party/llvm-project/install/bin/clang
327-
cxx: ../third-party/llvm-project/install/bin/clang++
328-
cxxflags: ${{ runner.os == 'Windows' && '-D__ORDER_LITTLE_ENDIAN__=1234 -D__ORDER_BIG_ENDIAN__=4321 -D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__' || '' }}
340+
# MrDocs will only use the LibC++ headers: any compiler that works in this workflow will do
341+
cc: ${{ runner.os == 'macOS' && steps.setup-cpp.outputs.cc || '../third-party/llvm-project/install/bin/clang' }}
342+
cxx: ${{ runner.os == 'macOS' && steps.setup-cpp.outputs.cxx || '../third-party/llvm-project/install/bin/clang++' }}
343+
cxxflags: ${{ matrix.libcxx-cxxflags }}
329344
generator: Ninja
330-
extra-args: |
331-
-D LLVM_ENABLE_RUNTIMES="${{ matrix.libcxx-runtimes }}"
332-
${{ runner.os == 'Windows' && '-D LIBCXXABI_USE_LLVM_UNWINDER=OFF' || '' }}
333-
${{ runner.os == 'Windows' && '-D LIBCXXABI_ENABLE_SHARED=OFF' || '' }}
334-
${{ runner.os == 'Windows' && '-D LIBCXXABI_ENABLE_STATIC=ON' || '' }}
335-
${{ runner.os == 'Windows' && '-D LIBCXX_ENABLE_SHARED=OFF' || '' }}
336-
${{ runner.os == 'Windows' && '-D LIBCXX_NO_VCRUNTIME=ON' || '' }}
345+
extra-args: ${{ matrix.libcxx-cmake-args }}
337346
install: true
338347
install-prefix: ${sourceDir}/../install
339348
run-tests: false
340349
trace-commands: true
341350

342351
- name: Install Node.js
343-
uses: actions/setup-node@v3
352+
uses: actions/setup-node@v4
344353
with:
345354
node-version: '20'
346355

@@ -427,12 +436,12 @@ jobs:
427436
uses: actions/checkout@v4
428437

429438
- name: Install Node.js
430-
uses: actions/setup-node@v3
439+
uses: actions/setup-node@v4
431440
with:
432441
node-version: '18'
433442

434443
- name: Setup Ninja
435-
uses: seanmiddleditch/gha-setup-ninja@v4
444+
uses: seanmiddleditch/gha-setup-ninja@v5
436445
if: ${{ runner.os == 'Windows' }}
437446

438447
- name: Download MrDocs package
@@ -445,7 +454,8 @@ jobs:
445454
run: |
446455
set -x
447456
if [[ ${{ runner.os }} != 'Windows' ]]; then
448-
dest_dir="/usr/local"
457+
dest_dir="$HOME/local"
458+
mkdir -p "$dest_dir"
449459
find packages -maxdepth 1 -name 'MrDocs-*.tar.gz' -exec tar -vxzf {} -C $dest_dir --strip-components=1 \;
450460
else
451461
dest_dir="$GITHUB_WORKSPACE/usr/local"
@@ -475,6 +485,39 @@ jobs:
475485
modules-exclude-paths: ''
476486
trace-commands: true
477487

488+
- name: Set up llvm-symbolizer
489+
if: ${{ runner.os == 'macOS' }}
490+
run: |
491+
set -x
492+
493+
# Step 1: Check if llvm-symbolizer is installed
494+
if ! command -v llvm-symbolizer &> /dev/null; then
495+
echo "llvm-symbolizer is not installed. Installing via Homebrew..."
496+
# Step 2: Install llvm if not installed
497+
if command -v brew &> /dev/null; then
498+
brew install llvm
499+
else
500+
echo "Homebrew is not installed. Please install Homebrew first: https://brew.sh/"
501+
exit 1
502+
fi
503+
fi
504+
505+
# Step 3: Ensure llvm-symbolizer is in your PATH
506+
llvm_bin_path=$(brew --prefix)/opt/llvm/bin
507+
PATH="$PATH:$llvm_bin_path"
508+
LLVM_SYMBOLIZER_PATH=$(which llvm-symbolizer)
509+
if [ -z "$LLVM_SYMBOLIZER_PATH" ]; then
510+
echo "llvm-symbolizer installation failed or it's not in the PATH."
511+
exit 1
512+
else
513+
echo "llvm-symbolizer found at: $LLVM_SYMBOLIZER_PATH"
514+
fi
515+
516+
# Step 4: Export LLVM_SYMBOLIZER_PATH environment variable
517+
export LLVM_SYMBOLIZER_PATH="$LLVM_SYMBOLIZER_PATH"
518+
echo -e "LLVM_SYMBOLIZER_PATH=$LLVM_SYMBOLIZER_PATH" >> $GITHUB_ENV
519+
echo "Environment variable LLVM_SYMBOLIZER_PATH set to: $LLVM_SYMBOLIZER_PATH"
520+
478521
- name: Generate Landing Page
479522
working-directory: docs/website
480523
run: |

0 commit comments

Comments
 (0)