Skip to content

Commit 90fc2a1

Browse files
committed
Added cache of llvm/clang build in the macOS CI workflow
1 parent 41167f8 commit 90fc2a1

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/test-macos.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ jobs:
2828
- uses: actions/checkout@v3
2929
with:
3030
fetch-depth: 0
31+
- name: Cache
32+
uses: actions/cache@v4
33+
with:
34+
path: ./opt
35+
key: ead27cdb-0345-4c4f-9723-89a4fa37765e
3136
- name: Install libclang
3237
run: |
3338
if [ "$RUNNER_OS" = Linux ]; then
@@ -56,13 +61,21 @@ jobs:
5661
rm -f /opt/hostedtoolcache/julia/1.6*/x64/lib/julia/libstdc++.so.6
5762
fi
5863
if [ "$RUNNER_OS" = Linux ]; then
59-
cmake -DClang_DIR=/usr/lib/llvm-13/lib/cmake/clang -DCMAKE_INSTALL_PREFIX="$PWD" -B build -S .
64+
cmake -DClang_DIR=/usr/lib/llvm-13/lib/cmake/clang -DCMAKE_INSTALL_PREFIX="$PWD/opt" -B build -S .
6065
cmake --build build --verbose -j `nproc`
6166
else
62-
cmake -DBUILD_LLVM=ON -DCMAKE_INSTALL_PREFIX="$PWD" -B build -S .
67+
if [ -d ./opt/lib/cmake/clang ]; then
68+
# Use LLVM/Clang built from cache
69+
CLANG_OPT="-DClang_DIR=./opt/lib/cmake/clang -DLLVM_DIR=./opt/lib/cmake/llvm"
70+
[ -f ./opt/bin/wrapit ] && rm ./opt/bin/wrapit
71+
else
72+
#build LLVM/Clang
73+
CLANG_OPT="-DBUILD_LLVM=ON"
74+
fi
75+
cmake $CLANG_OPT -DCMAKE_INSTALL_PREFIX="$PWD/opt" -B build -S .
6376
cmake --build build --verbose -j `sysctl -n hw.logicalcpu`
6477
fi
6578
cmake --install build
66-
PATH="$PATH:$PWD/bin"
79+
PATH="$PATH:$PWD/opt/bin"
6780
export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
6881
cd test && ./runtests.jl

0 commit comments

Comments
 (0)