Skip to content

Added cache of llvm/clang build in the macOS CI workflow #103

Added cache of llvm/clang build in the macOS CI workflow

Added cache of llvm/clang build in the macOS CI workflow #103

Workflow file for this run

#This file is kept almost identical to test-linux.
#We use two files in order to get two distinct badges for Linux and macOS.
name: macOS
on:
- push
- pull_request
defaults:
run:
shell: bash
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.10'
os:
# - ubuntu-latest
# - macOS-latest
- macos-13
arch:
- x64
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache
uses: actions/cache@v4
with:
path: ./opt
key: ead27cdb-0345-4c4f-9723-89a4fa37765e
- name: Install libclang
run: |
if [ "$RUNNER_OS" = Linux ]; then
sudo apt-get install clang-13 libclang-13-dev
#else #MacOS
# #brew install llvm@13 #llvm@13 no more supported by brew
# wget "https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-13.0.1.tar.gz"
# tar xzf llvmorg-13.0.1.tar.gz
# rm llvmorg-13.0.1.tar.gz
# export CMAKE_INSTALL_MODE=SYMLINK #use symlinks to reduce disk space usage
# cmake -S llvm-project-llvmorg-13.0.1/llvm -B llvm-build -DCMAKE_INSTALL_PREFIX=`pwd`/clang-13 -DLLVM_ENABLE_PROJECTS="clang" -DBUILD_SHARED_LIBS=on -DLLVM_BUILD_LLVM_DYLIB=on -DCMAKE_BUILD_TYPE=Release
# cmake --build llvm-build --verbose -j `sysctl -n hw.logicalcpu`
# cmake --install llvm-build
fi
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Build and test
env:
BODY: ${{github.event.pull_request.body}}
run: |
echo "$BODY"
if [ "$OSTYPE" != "darwin"* ]; then
rm -f /opt/hostedtoolcache/julia/1.6*/x64/lib/julia/libstdc++.so.6
fi
if [ "$RUNNER_OS" = Linux ]; then
cmake -DClang_DIR=/usr/lib/llvm-13/lib/cmake/clang -DCMAKE_INSTALL_PREFIX="$PWD/opt" -B build -S .
cmake --build build --verbose -j `nproc`
else
if [ -d ./opt/lib/cmake/clang ]; then
# Use LLVM/Clang built from cache
CLANG_OPT="-DClang_DIR=./opt/lib/cmake/clang -DLLVM_DIR=./opt/lib/cmake/llvm"
[ -f ./opt/bin/wrapit ] && rm ./opt/bin/wrapit
else
#build LLVM/Clang
CLANG_OPT="-DBUILD_LLVM=ON"
fi
cmake $CLANG_OPT -DCMAKE_INSTALL_PREFIX="$PWD/opt" -B build -S .
cmake --build build --verbose -j `sysctl -n hw.logicalcpu`
fi
cmake --install build
PATH="$PATH:$PWD/opt/bin"
export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
cd test && ./runtests.jl