Skip to content

Library autoloader #2189

Library autoloader

Library autoloader #2189

Workflow file for this run

name: Main
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
schedule:
- cron: '30 20 * * *' # Warning: Timezone dep - 20:00 is 1:00
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build_cache:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: ubu22-x86-gcc12-clang-repl-18
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '18'
cling: Off
cppyy: On
coverage: true
- name: ubu22-x86-gcc12-clang-repl-17
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '17'
cling: Off
cppyy: On
coverage: true
- name: ubu22-x86-gcc12-clang-repl-16
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '16'
cling: Off
cppyy: On
coverage: true
- name: ubu22-x86-gcc9-clang13-cling
os: ubuntu-22.04
compiler: gcc-9
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: On
coverage: true
- name: win2022-msvc-clang-repl-18
os: windows-2022
compiler: msvc
clang-runtime: '18'
cling: Off
cppyy: Off
- name: win2022-msvc-clang-repl-17
os: windows-2022
compiler: msvc
clang-runtime: '17'
cling: Off
cppyy: Off
- name: win2022-msvc-clang-repl-16
os: windows-2022
compiler: msvc
clang-runtime: '16'
cling: Off
cppyy: Off
- name: win2022-msvc-cling
os: windows-2022
compiler: msvc
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: Off
- name: osx14-arm-clang-clang-repl-18
os: macos-14
compiler: clang
clang-runtime: '18'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-17
os: macos-14
compiler: clang
clang-runtime: '17'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-16
os: macos-14
compiler: clang
clang-runtime: '16'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang13-cling
os: macos-14
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: On
- name: osx13-x86-clang-clang-repl-18
os: macos-13
compiler: clang
clang-runtime: '18'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang-repl-17
os: macos-13
compiler: clang
clang-runtime: '17'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang-repl-16
os: macos-13
compiler: clang
clang-runtime: '16'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang13-cling
os: macos-13
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: On
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Save PR Info on Unix systems
if: ${{ runner.os != 'windows' }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.repository }} > ./pr/REPO
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "$cling_on" == "ON" ]]; then
export CLING_HASH=$(git ls-remote https://github.com/root-project/cling.git refs/tags/v${{ matrix.cling-version }} | tr '\t' '-')
export LLVM_HASH=$(git ls-remote https://github.com/root-project/llvm-project.git cling-llvm${{ matrix.clang-runtime}} | tr '\t' '-')
else
export CLING_HASH="Repl"
# May need to revert back to both having same llvm_hash, as below cause llvm to be rebuilt everytime commit is made to llvm/llvm-project for release a.x
# which could be quite often for new releases
export LLVM_HASH=$(git ls-remote https://github.com/llvm/llvm-project.git refs/heads/release/${{ matrix.clang-runtime}}.x | tr '\t' '-')
fi
echo "CLING_HASH=$CLING_HASH" >> $GITHUB_ENV
echo "LLVM_HASH=$LLVM_HASH" >> $GITHUB_ENV
- name: Save PR Info on Windows systems
if: ${{ runner.os == 'windows' }}
run: |
#can be found
mkdir ./pr
echo "${{ github.event.number }}" > ./pr/NR
echo ${{ github.repository }} > ./pr/REPO
if ( "${{ matrix.cling }}" -imatch "On" )
{
$env:CLING_HASH_TEMP = ( git ls-remote https://github.com/root-project/cling.git refs/tags/v${{ matrix.cling-version }} )
$env:CLING_HASH = $env:CLING_HASH_TEMP -replace "\t","-"
}
else
{
$env:CLING_HASH="Repl"
# May need to revert back to both having same llvm_hash, as below cause llvm to be rebuilt everytime commit is made to llvm/llvm-project for release a.x
# which could be quite often for new releases
$env:LLVM_HASH_TEMP = (git ls-remote https://github.com/llvm/llvm-project.git refs/heads/release/${{ matrix.clang-runtime}}.x )
$env:LLVM_HASH = $env:LLVM_HASH_TEMP -replace "\t","-"
}
echo "CLING_HASH=$env:CLING_HASH"
echo "LLVM_HASH=$env:LLVM_HASH"
echo "CLING_HASH=$env:CLING_HASH" >> $GITHUB_ENV
echo "LLVM_HASH=$env:LLVM_HASH" >> $GITHUB_ENV
- name: Restore Cache LLVM/Clang runtime build directory
uses: actions/cache/restore@v4
id: cache
with:
path: |
llvm-project
${{ matrix.cling=='On' && 'cling' || '' }}
key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-patch-${{ hashFiles(format('patches/llvm/clang{0}-*.patch', matrix.clang-runtime)) || 'none' }}
lookup-only: true
- name: Setup default Build Type on *nux
if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CODE_COVERAGE=0" >> $GITHUB_ENV
os="${{ matrix.os }}"
if [[ "${os}" == "macos"* ]]; then
echo "ncpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
else
echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
fi
- name: Setup default Build Type on Windows
if: ${{ runner.os == 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
echo "BUILD_TYPE=Release" >> $env:GITHUB_ENV
echo "CODE_COVERAGE=0" >> $env:GITHUB_ENV
$env:ncpus=$([Environment]::ProcessorCount)
echo "ncpus=$env:ncpus" >> $env:GITHUB_ENV
- name: Setup compiler on Linux
if: ${{ runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' }}
run: |
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
vers="${compiler#*-}"
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`"
##sudo apt update
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
sudo apt install -y gcc-${vers} g++-${vers} lld
echo "CC=gcc-${vers}" >> $GITHUB_ENV
echo "CXX=g++-${vers}" >> $GITHUB_ENV
else
if ! sudo apt install -y clang-${vers}; then
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-${vers} main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y clang-${vers}
fi
echo "CC=clang-${vers}" >> $GITHUB_ENV
echo "CXX=clang++-${vers}" >> $GITHUB_ENV
fi
env:
compiler: ${{ matrix.compiler }}
- name: Setup compiler on macOS
if: ${{ runner.os == 'macOS' && steps.cache.outputs.cache-hit != 'true' }}
run: |
vers="${compiler#*-}"
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
brew install "gcc@$vers"
echo "CC=gcc-${vers}" >> $GITHUB_ENV
echo "CXX=g++-${vers}" >> $GITHUB_ENV
else
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV
#Use clang-15 and clang++-15 compiler that is installed on runner, instead of one
#provided by MacOS (could brew install clang-16/17 to use consistent version
#of clang)
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> $GITHUB_ENV
fi
env:
compiler: ${{ matrix.compiler }}
#Section slightly modified version of
#https://github.com/vgvassilev/clad/blob/40d8bec11bde47b14a281078183a4f6147abeac5/.github/workflows/ci.yml#L510C1-L534C10
- name: Setup compiler on Windows
if: ${{ runner.os == 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
if ( "${{ matrix.compiler }}" -imatch "clang" )
{
$ver="${{ matrix.compiler }}".split("-")[1]
choco install llvm --version=$ver --no-progress -my
clang --version
#
$env:CC="clang"
$env:CXX="clang++"
echo "CC=clang" >> $env:GITHUB_ENV
echo "CXX=clang++" >> $env:GITHUB_ENV
}
elseif ( "${{ matrix.compiler }}" -imatch "msvc" )
{
# MSVC is builtin in container image
}
else
{
echo "Unsupported compiler - fix YAML file"
}
- name: Install deps on Windows
if: ${{ runner.os == 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
choco install findutils
$env:PATH="C:\Program Files (x86)\GnuWin32\bin;$env:PATH"
- name: Install deps on Linux
if: ${{ runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' }}
run: |
# Install deps
sudo apt-get update
sudo apt-get install valgrind
sudo apt-get autoremove
sudo apt-get clean
- name: Install deps on MacOS
if: ${{ runner.os == 'macOS' && steps.cache.outputs.cache-hit != 'true' }}
run: |
brew update
brew remove [email protected]
# workaround for https://github.com/actions/setup-python/issues/577
for pkg in $(brew list | grep '^python@'); do
brew unlink "$pkg"
brew link --overwrite "$pkg"
done
brew upgrade
- name: Build LLVM/Cling on Unix systems if the cache is invalid
if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "${cling_on}" == "ON" ]]; then
git clone https://github.com/root-project/cling.git
cd ./cling
git checkout tags/v${{ matrix.cling-version }}
cd ..
git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git
else # repl
git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git
fi
cd llvm-project
# Build
mkdir build
if [[ "${cling_on}" == "ON" ]]; then
cd build
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_EXTERNAL_PROJECTS=cling \
-DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling \
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_FORMAT=OFF \
-DCLANG_ENABLE_BOOTSTRAP=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
../llvm
cmake --build . --target lld --parallel ${{ env.ncpus }}
cmake --build . --target clang --parallel ${{ env.ncpus }}
cmake --build . --target cling --parallel ${{ env.ncpus }}
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
cmake --build . --target gtest_main --parallel ${{ env.ncpus }}
else
# Apply patches
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
if [[ "${llvm_vers}" != "18" ]]; then
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
fi
cd build
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_FORMAT=OFF \
-DCLANG_ENABLE_BOOTSTRAP=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
../llvm
cmake --build . --target clang clang-repl lld --parallel ${{ env.ncpus }}
fi
cd ../
rm -rf $(find . -maxdepth 1 ! -name "build" ! -name "llvm" ! -name "clang" ! -name ".")
cd ../
- name: Build LLVM/Cling on Windows systems if the cache is invalid
if: ${{ runner.os == 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
if ( "${{ matrix.cling }}" -imatch "On" )
{
git clone https://github.com/root-project/cling.git
cd ./cling
git checkout tags/v${{ matrix.cling-version }}
cd ..
git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git
$env:PWD_DIR= $PWD.Path
$env:CLING_DIR="$env:PWD_DIR\cling"
echo "CLING_DIR=$env:CLING_DIR"
}
else
{
git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git
}
cd llvm-project
# Build
mkdir build
if ( "${{ matrix.cling }}" -imatch "On" )
{
cd build
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" `
-DLLVM_EXTERNAL_PROJECTS=cling `
-DLLVM_EXTERNAL_CLING_SOURCE_DIR="$env:CLING_DIR" `
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_ENABLE_ASSERTIONS=ON `
-DCLANG_ENABLE_STATIC_ANALYZER=OFF `
-DCLANG_ENABLE_ARCMT=OFF `
-DCLANG_ENABLE_FORMAT=OFF `
-DCLANG_ENABLE_BOOTSTRAP=OFF `
-DLLVM_ENABLE_ZSTD=OFF `
-DLLVM_ENABLE_TERMINFO=OFF `
-DLLVM_ENABLE_LIBXML2=OFF `
..\llvm
cmake --build . --config Release --target lld --parallel ${{ env.ncpus }}
cmake --build . --config Release --target clang --parallel ${{ env.ncpus }}
cmake --build . --config Release --target cling --parallel ${{ env.ncpus }}
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
cmake --build . --config Release --target gtest_main --parallel ${{ env.ncpus }}
}
else
{
cp -r ..\patches\llvm\clang${{ matrix.clang-runtime }}*
#FIXME: Apply patches without hardcoding
if ( "${{ matrix.clang-runtime }}" -imatch "16" )
{
git apply -v clang16-1-Value.patch
git apply -v clang16-2-CUDA.patch
git apply -v clang16-3-WeakRef.patch
}
elseif ( "${{ matrix.clang-runtime }}" -imatch "17" )
{
git apply -v clang17-1-NewOperator.patch
}
cd build
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" `
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_ENABLE_ASSERTIONS=ON `
-DCLANG_ENABLE_STATIC_ANALYZER=OFF `
-DCLANG_ENABLE_ARCMT=OFF `
-DCLANG_ENABLE_FORMAT=OFF `
-DCLANG_ENABLE_BOOTSTRAP=OFF `
-DLLVM_ENABLE_ZSTD=OFF `
-DLLVM_ENABLE_TERMINFO=OFF `
-DLLVM_ENABLE_LIBXML2=OFF `
..\llvm
cmake --build . --config Release --target clang clang-repl lld --parallel ${{ env.ncpus }}
}
cd ..\
rm -r -force $(find.exe . -maxdepth 1 ! -name "build" ! -name "llvm" ! -name "clang" ! -name ".")
cd ..\
- name: Save Cache LLVM/Clang runtime build directory
uses: actions/cache/save@v4
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
with:
path: |
llvm-project
${{ matrix.cling=='On' && 'cling' || '' }}
key: ${{ steps.cache.outputs.cache-primary-key }}
cppinterop_and_cppyy_build:
needs: [build_cache]
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: ubu22-x86-gcc12-clang-repl-18-cppyy
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '18'
cling: Off
cppyy: On
coverage: true
- name: ubu22-x86-gcc12-clang-repl-17-cppyy
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '17'
cling: Off
cppyy: On
- name: ubu22-x86-gcc12-clang-repl-16-cppyy
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '16'
cling: Off
cppyy: On
- name: ubu22-x86-gcc9-clang13-cling-cppyy
os: ubuntu-22.04
compiler: gcc-9
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: On
#FIXME: Windows CppInterOp tests expected to fail
#until https://github.com/compiler-research/CppInterOp/issues/188 is solved
- name: win2022-msvc-clang-repl-18
os: windows-2022
compiler: msvc
clang-runtime: '18'
cling: Off
cppyy: Off
- name: win2022-msvc-clang-repl-17
os: windows-2022
compiler: msvc
clang-runtime: '17'
cling: Off
cppyy: Off
#- name: win2022-msvc-clang-repl-17-cppyy
# os: windows-2022
# compiler: msvc
# clang-runtime: '17'
# cling: Off
# cppyy: On
- name: win2022-msvc-clang-repl-16
os: windows-2022
compiler: msvc
clang-runtime: '16'
cling: Off
cppyy: Off
#- name: win2022-msvc-clang-repl-16-cppyy
# os: windows-2022
# compiler: msvc
# clang-runtime: '16'
# cling: Off
# cppyy: On
- name: win2022-msvc-cling
os: windows-2022
compiler: msvc
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: Off
#- name: win2022-msvc-cling-cppyy
# os: windows-2022
# compiler: msvc
# clang-runtime: '13'
# cling: On
# cling-version: '1.0'
# cppyy: On
- name: osx14-arm-clang-clang-repl-18-cppyy
os: macos-14
compiler: clang
clang-runtime: '18'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-17-cppyy
os: macos-14
compiler: clang
clang-runtime: '17'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-16-cppyy
os: macos-14
compiler: clang
clang-runtime: '16'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang13-cling-cppyy
os: macos-14
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: On
- name: osx13-x86-clang-clang-repl-18-cppyy
os: macos-13
compiler: clang
clang-runtime: '18'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang-repl-17-cppyy
os: macos-13
compiler: clang
clang-runtime: '17'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang-repl-16-cppyy
os: macos-13
compiler: clang
clang-runtime: '16'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang13-cling-cppyy
os: macos-13
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
cppyy: On
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Save PR Info on Unix systems
if: ${{ runner.os != 'windows' }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.repository }} > ./pr/REPO
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "$cling_on" == "ON" ]]; then
export CLING_HASH=$(git ls-remote https://github.com/root-project/cling.git refs/tags/v${{ matrix.cling-version }} | tr '\t' '-')
export LLVM_HASH=$(git ls-remote https://github.com/root-project/llvm-project.git cling-llvm${{ matrix.clang-runtime}} | tr '\t' '-')
else
export CLING_HASH="Repl"
# May need to revert back to both having same llvm_hash, as below cause llvm to be rebuilt everytime commit is made to llvm/llvm-project for release a.x
# which could be quite often for new releases
export LLVM_HASH=$(git ls-remote https://github.com/llvm/llvm-project.git refs/heads/release/${{ matrix.clang-runtime}}.x | tr '\t' '-')
fi
echo "CLING_HASH=$CLING_HASH" >> $GITHUB_ENV
echo "LLVM_HASH=$LLVM_HASH" >> $GITHUB_ENV
- name: Save PR Info on Windows systems
if: ${{ runner.os == 'windows' }}
run: |
#can be found
mkdir ./pr
echo "${{ github.event.number }}" > ./pr/NR
echo ${{ github.repository }} > ./pr/REPO
if ( "${{ matrix.cling }}" -imatch "On" )
{
$env:CLING_HASH_TEMP = ( git ls-remote https://github.com/root-project/cling.git refs/tags/v${{ matrix.cling-version }} )
$env:CLING_HASH = $env:CLING_HASH_TEMP -replace "\t","-"
}
else
{
$env:CLING_HASH="Repl"
# May need to revert back to both having same llvm_hash, as below cause llvm to be rebuilt everytime commit is made to llvm/llvm-project for release a.x
# which could be quite often for new releases
$env:LLVM_HASH_TEMP = (git ls-remote https://github.com/llvm/llvm-project.git refs/heads/release/${{ matrix.clang-runtime}}.x )
$env:LLVM_HASH = $env:LLVM_HASH_TEMP -replace "\t","-"
}
echo "CLING_HASH=$env:CLING_HASH"
echo "LLVM_HASH=$env:LLVM_HASH"
echo "CLING_HASH=$env:CLING_HASH" >> $GITHUB_ENV
echo "LLVM_HASH=$env:LLVM_HASH" >> $GITHUB_ENV
- name: Setup default Build Type on *nux
if: runner.os != 'windows'
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CODE_COVERAGE=0" >> $GITHUB_ENV
os="${{ matrix.os }}"
if [[ "${os}" == "macos"* ]]; then
echo "ncpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
else
echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
fi
- name: Setup default Build Type on Windows
if: runner.os == 'windows'
run: |
echo "BUILD_TYPE=Release" >> $env:GITHUB_ENV
echo "CODE_COVERAGE=0" >> $env:GITHUB_ENV
$env:ncpus=$([Environment]::ProcessorCount)
echo "ncpus=$env:ncpus" >> $env:GITHUB_ENV
- name: Setup compiler on Linux
if: runner.os == 'Linux'
run: |
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
vers="${compiler#*-}"
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`"
##sudo apt update
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
sudo apt install -y gcc-${vers} g++-${vers} lld
echo "CC=gcc-${vers}" >> $GITHUB_ENV
echo "CXX=g++-${vers}" >> $GITHUB_ENV
else
if ! sudo apt install -y clang-${vers}; then
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-${vers} main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt install -y clang-${vers}
fi
echo "CC=clang-${vers}" >> $GITHUB_ENV
echo "CXX=clang++-${vers}" >> $GITHUB_ENV
fi
env:
compiler: ${{ matrix.compiler }}
- name: Setup compiler on macOS
if: runner.os == 'macOS'
run: |
vers="${compiler#*-}"
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
brew install "gcc@$vers"
echo "CC=gcc-${vers}" >> $GITHUB_ENV
echo "CXX=g++-${vers}" >> $GITHUB_ENV
else
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV
#Use clang-15 and clang++-15 compiler that is installed on runner, instead of one
#provided by MacOS (could brew install clang-16/17 to use consistent version
#of clang)
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> $GITHUB_ENV
fi
env:
compiler: ${{ matrix.compiler }}
#Section slightly modified version of
#https://github.com/vgvassilev/clad/blob/40d8bec11bde47b14a281078183a4f6147abeac5/.github/workflows/ci.yml#L510C1-L534C10
- name: Setup compiler on Windows
if: runner.os == 'windows'
run: |
if ( "${{ matrix.compiler }}" -imatch "clang" )
{
$ver="${{ matrix.compiler }}".split("-")[1]
choco install llvm --version=$ver --no-progress -my
clang --version
#
$env:CC="clang"
$env:CXX="clang++"
echo "CC=clang" >> $env:GITHUB_ENV
echo "CXX=clang++" >> $env:GITHUB_ENV
}
elseif ( "${{ matrix.compiler }}" -imatch "msvc" )
{
# MSVC is builtin in container image
}
else
{
echo "Unsupported compiler - fix YAML file"
}
- name: Install deps on Linux
if: runner.os == 'Linux'
run: |
# Install deps
sudo apt-get update
sudo apt-get install git g++ debhelper devscripts gnupg python3
sudo apt-get install -y libc6-dbg
sudo snap install valgrind --classic
sudo apt autoremove
sudo apt clean
# Install libraries used by the cppyy test suite
sudo apt install libeigen3-dev
sudo apt install libboost-all-dev
- name: Install deps on MacOS
if: runner.os == 'macOS'
run: |
brew update
brew remove [email protected]
export ARCHITECHURE=$(uname -m)
if [[ "$ARCHITECHURE" == "x86_64" ]]; then
brew remove swiftlint
fi
# workaround for https://github.com/actions/setup-python/issues/577
for pkg in $(brew list | grep '^python@'); do
brew unlink "$pkg"
brew link --overwrite "$pkg"
done
brew upgrade
brew install eigen
brew install boost
pip install distro pytest
- name: Restore Cache LLVM/Clang runtime build directory
uses: actions/cache/restore@v4
id: cache
with:
path: |
llvm-project
${{ matrix.cling=='On' && 'cling' || '' }}
key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-patch-${{ hashFiles(format('patches/llvm/clang{0}-*.patch', matrix.clang-runtime)) || 'none' }}
- name: Setup code coverage
if: ${{ success() && (matrix.coverage == true) }}
run: |
sudo apt install lcov
echo "CODE_COVERAGE=1" >> $GITHUB_ENV
echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Build and Test/Install CppInterOp on Unix systems
if: ${{ runner.os != 'windows' }}
run: |
LLVM_DIR="$(pwd)/llvm-project"
LLVM_BUILD_DIR="$(pwd)/llvm-project/build"
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "${cling_on}" == "ON" ]]; then
CLING_DIR="$(pwd)/cling"
CLING_BUILD_DIR="$(pwd)/cling/build"
CPLUS_INCLUDE_PATH="${CLING_DIR}/tools/cling/include:${CLING_BUILD_DIR}/include:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include"
else
CPLUS_INCLUDE_PATH="${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include"
fi
export CB_PYTHON_DIR="$PWD/cppyy-backend/python"
export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend"
# Build CppInterOp next to cling and llvm-project.
mkdir build && cd build
export CPPINTEROP_BUILD_DIR=$PWD
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "${cling_on}" == "ON" ]]; then
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_CLING=ON \
-DUSE_REPL=OFF \
-DCling_DIR=$LLVM_BUILD_DIR/tools/cling \
-DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
-DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
-DBUILD_SHARED_LIBS=ON \
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
-DLLVM_ENABLE_WERROR=On \
../
else
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_CLING=OFF \
-DUSE_REPL=ON \
-DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
-DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
-DBUILD_SHARED_LIBS=ON \
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
-DLLVM_ENABLE_WERROR=On \
../
fi
os="${{ matrix.os }}"
cmake --build . --target check-cppinterop --parallel ${{ env.ncpus }}
if [[ ("${os}" == "ubuntu"*) ]]; then
valgrind --show-error-list=yes --track-origins=yes --error-exitcode=1 unittests/CppInterOp/CppInterOpTests
fi
cd ..
# We need CB_PYTHON_DIR later
echo "CB_PYTHON_DIR=$CB_PYTHON_DIR" >> $GITHUB_ENV
# We need CPPINTEROP_DIR, LLVM_BUILD_DIR and CPLUS_INCLUDE_PATH later
echo "CPPINTEROP_BUILD_DIR=$CPPINTEROP_BUILD_DIR" >> $GITHUB_ENV
echo "CPPINTEROP_DIR=$CPPINTEROP_DIR" >> $GITHUB_ENV
echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV
echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
- name: Build and Test/Install CppInterOp on Windows systems
continue-on-error: true
if: ${{ runner.os == 'windows' }}
run: |
#FIXME: Windows CppInterOp tests expected to fail
#until https://github.com/compiler-research/CppInterOp/issues/188 is solved
$env:PWD_DIR= $PWD.Path
$env:LLVM_DIR="$env:PWD_DIR\llvm-project"
echo "LLVM_DIR=$env:LLVM_DIR"
echo "LLVM_DIR=$env:LLVM_DIR" >> $env:GITHUB_ENV
$env:LLVM_BUILD_DIR="$env:PWD_DIR\llvm-project\build"
echo "LLVM_BUILD_DIR=$env:LLVM_BUILD_DIR"
echo "LLVM_BUILD_DIR=$env:LLVM_BUILD_DIR" >> $env:GITHUB_ENV
if ( "${{ matrix.cling }}" -imatch "On" )
{
$env:CLING_DIR="$env:PWD_DIR\cling"
echo "CLING_DIR=$env:CLING_DIR"
echo "CLING_DIR=$env:CLING_DIR" >> $env:GITHUB_ENV
$env:CLING_BUILD_DIR="$env:PWD_DIR\cling\build"
echo "CLING_BUILD_DIR=$env:CLING_BUILD_DIR"
echo "CLING_BUILD_DIR=$env:CLING_BUILD_DIR" >> $env:GITHUB_ENV
$env:CPLUS_INCLUDE_PATH="$env:CLING_DIR\tools\cling\include;$env:CLING_BUILD_DIR\include;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;"
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH"
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH" >> $env:GITHUB_ENV
}
else
{
$env:CPLUS_INCLUDE_PATH="$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;"
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH"
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH" >> $env:GITHUB_ENV
}
$env:CB_PYTHON_DIR="$env:PWD_DIR\cppyy-backend\python"
echo "CB_PYTHON_DIR=$env:CB_PYTHON_DIR"
echo "CB_PYTHON_DIR=$env:CB_PYTHON_DIR" >> $env:GITHUB_ENV
$env:CPPINTEROP_DIR="$env:CB_PYTHON_DIR\cppyy-backend"
echo "CPPINTEROP_DIR=$env:CPPINTEROP_DIR"
echo "CPPINTEROP_DIR=$env:CPPINTEROP_DIR" >> $env:GITHUB_ENV
# Build CppInterOp next to cling and llvm-project.
mkdir build
cd build
$env:CPPINTEROP_BUILD_DIR="$env:PWD_DIR"
echo "CPPINTEROP_BUILD_DIR=$env:CPPINTEROP_BUILD_DIR"
echo "CPPINTEROP_BUILD_DIR=$env:CPPINTEROP_BUILD_DIR" >> $env:GITHUB_ENV
if ( "${{ matrix.cling }}" -imatch "On" )
{
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
-DUSE_CLING=ON `
-DUSE_REPL=OFF `
-DCling_DIR="$env:LLVM_BUILD_DIR\tools\cling" `
-DLLVM_DIR="$env:LLVM_BUILD_DIR" `
-DLLVM_ENABLE_WERROR=On `
-DClang_DIR="$env:LLVM_BUILD_DIR" -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} -DCMAKE_INSTALL_PREFIX="$env:CPPINTEROP_DIR" ..\
}
else
{
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
-DUSE_CLING=OFF `
-DUSE_REPL=ON `
-DLLVM_DIR="$env:LLVM_BUILD_DIR\lib\cmake\llvm" `
-DLLVM_ENABLE_WERROR=On `
-DClang_DIR="$env:LLVM_BUILD_DIR\lib\cmake\clang" -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} -DCMAKE_INSTALL_PREFIX="$env:CPPINTEROP_DIR" ..\
}
cmake --build . --config ${{ env.BUILD_TYPE }} --target check-cppinterop --parallel ${{ env.ncpus }}
cd ..
- name: Prepare code coverage report
if: ${{ success() && (matrix.coverage == true) }}
run: |
# Create lcov report
# capture coverage info
vers="${CC#*-}"
lcov --directory build/ --capture --output-file coverage.info --gcov-tool /usr/bin/gcov-${vers}
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' ${{ github.workspace }}'/llvm-project/*' ${{ github.workspace }}'/unittests/*' --output-file coverage.info
# output coverage data for debugging (optional)
lcov --list coverage.info
- name: Upload to codecov.io
if: ${{ success() && (matrix.coverage == true) }}
uses: codecov/codecov-action@v4
with:
file: ./coverage.info
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build and Install cppyy-backend on Unix Systems
if: ${{ (runner.os != 'windows') && (matrix.cppyy == 'On') }}
run: |
# Download cppyy-backend
git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git
cd cppyy-backend
mkdir -p $CPPINTEROP_DIR/lib build && cd build
# Install CppInterOp
(cd $CPPINTEROP_BUILD_DIR && cmake --build . --target install --parallel ${{ env.ncpus }} )
# Build and Install cppyy-backend
cmake -DCppInterOp_DIR=$CPPINTEROP_DIR ..
cmake --build . --parallel ${{ env.ncpus }}
OS=$(uname -s)
if [[ "$OS" == "Darwin" ]]; then
cp libcppyy-backend.dylib $CPPINTEROP_DIR/lib/
else
cp libcppyy-backend.so $CPPINTEROP_DIR/lib/
fi
cd ..
- name: Install CPyCppyy on Unix Systems
if: ${{ (runner.os != 'windows') && (matrix.cppyy == 'On') }}
run: |
python3 -m venv .venv
source .venv/bin/activate
# Install CPyCppyy
git clone --depth=1 https://github.com/compiler-research/CPyCppyy.git
mkdir CPyCppyy/build
cd CPyCppyy/build
cmake ..
cmake --build . --parallel ${{ env.ncpus }}
#
export CPYCPPYY_DIR=$PWD
cd ../..
# We need CPYCPPYY_DIR later
echo "CPYCPPYY_DIR=$CPYCPPYY_DIR" >> $GITHUB_ENV
- name: Install cppyy on Unix Systems
if: ${{ (runner.os != 'windows') && (matrix.cppyy == 'On') }}
run: |
# source virtual environment
source .venv/bin/activate
# Install cppyy
git clone --depth=1 https://github.com/compiler-research/cppyy.git
cd cppyy
python -m pip install --upgrade . --no-deps
cd ..
- name: Run cppyy on Unix Systems
if: ${{ (runner.os != 'windows') && (matrix.cppyy == 'On') }}
run: |
# Run cppyy
source .venv/bin/activate
export PYTHONPATH=$PYTHONPATH:$CPYCPPYY_DIR:$CB_PYTHON_DIR
python -c "import cppyy"
# We need PYTHONPATH later
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
- name: Run the tests on Unix Systems
if: ${{ (runner.os != 'windows') && (matrix.cppyy == 'On') }}
run: |
# Run the tests
source .venv/bin/activate
cd cppyy/test
echo ::group::Prepare For Testing
make all
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install pytest-xdist
python -m pip install numba
echo ::endgroup::
echo ::group::Run complete test suite
set -o pipefail
python -m pytest -sv | tee complete_testrun.log 2>&1
set +o pipefail
echo ::group::Crashing Test Logs
# See if we don't have a crash that went away
# Comment out all xfails but the ones that have a run=False condition.
find . -name "*.py" -exec sed -i '/run=False/!s/^ *@mark.xfail\(.*\)/#&/' {} \;
python -m pytest -n 1 -m "xfail" --runxfail -sv --max-worker-restart 512 | tee test_crashed.log 2>&1 || true
git checkout .
echo ::endgroup::
echo ::group::XFAIL Test Logs
# Rewrite all xfails that have a run clause to skipif. This way we will
# avoid conditionally crashing xfails
find . -name "*.py" -exec sed -i -E 's/(^ *)@mark.xfail\(run=(.*)/\[email protected](condition=not \2/g' {} \;
# See if we don't have an xfail that went away
python -m pytest --runxfail -sv | tee test_xfailed.log 2>&1 || true
git checkout .
echo ::endgroup::
echo ::group::Passing Test Logs
# Run the rest of the non-crashing tests.
declare -i RETCODE=0
set -o pipefail
if [[ "${{ matrix.os }}" == macos-* ]]; then
echo "Skipping Valgrind checks on OS X"
else
echo "Running valgrind on passing tests"
CLANG_VERSION="${{ matrix.clang-runtime }}"
SUPPRESSION_FILE="../etc/clang${CLANG_VERSION}-valgrind.supp"
valgrind --show-error-list=yes --error-exitcode=1 --track-origins=yes --suppressions="${SUPPRESSION_FILE}" --suppressions=../etc/valgrind-cppyy-cling.supp python -m pytest -m "not xfail" -v
fi
export RETCODE=+$?
echo ::endgroup::
RETCODE=+$?
echo "Complete Test Suite Summary: \n"
tail -n1 complete_testrun.log
echo "Crashing Summary: \n"
tail -n1 test_crashed.log
echo "XFAIL Summary:"
tail -n1 test_xfailed.log
echo "Return Code: ${RETCODE}"
exit $RETCODE
- name: Show debug info
if: ${{ failure() && (runner.os != 'windows') }}
run: |
export
echo $GITHUB_ENV
- name: Setup tmate session
if: ${{ failure() && runner.debug }}
uses: mxschmitt/action-tmate@v3
# When debugging increase to a suitable value!
timeout-minutes: 30
emscripten_wasm:
needs: [build_cache]
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: ubu22-x86-gcc12-clang-repl-18-emscripten_wasm
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '18'
cling: Off
micromamba_shell_init: bash
- name: ubu22-x86-gcc12-clang-repl-17-emscripten_wasm
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '17'
cling: Off
micromamba_shell_init: bash
- name: ubu22-x86-gcc12-clang-repl-16-emscripten_wasm
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '16'
cling: Off
micromamba_shell_init: bash
- name: ubu22-x86-gcc9-clang13-cling-emscripten_wasm
os: ubuntu-22.04
compiler: gcc-9
clang-runtime: '13'
cling: On
cling-version: '1.0'
micromamba_shell_init: bash
- name: osx14-arm-clang-clang-repl-18-emscripten_wasm
os: macos-14
compiler: clang
clang-runtime: '18'
cling: Off
micromamba_shell_init: bash
- name: osx14-arm-clang-clang-repl-17-emscripten_wasm
os: macos-14
compiler: clang
clang-runtime: '17'
cling: Off
micromamba_shell_init: bash
- name: osx14-arm-clang-clang-repl-16-emscripten_wasm
os: macos-14
compiler: clang
clang-runtime: '16'
cling: Off
micromamba_shell_init: bash
- name: osx14-arm-clang-clang13-cling-emscripten_wasm
os: macos-14
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
micromamba_shell_init: bash
- name: osx13-x86-clang-clang-repl-18-emscripten_wasm
os: macos-13
compiler: clang
clang-runtime: '18'
cling: Off
micromamba_shell_init: bash
- name: osx13-x86-clang-clang-repl-17-emscripten_wasm
os: macos-13
compiler: clang
clang-runtime: '17'
cling: Off
micromamba_shell_init: bash
- name: osx13-x86-clang-clang-repl-16-emscripten_wasm
os: macos-13
compiler: clang
clang-runtime: '16'
cling: Off
micromamba_shell_init: bash
- name: osx13-x86-clang-clang13-cling-emscripten_wasm
os: macos-13
compiler: clang
clang-runtime: '13'
cling: On
cling-version: '1.0'
micromamba_shell_init: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Save PR Info on Unix systems
if: ${{ runner.os != 'windows' }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.repository }} > ./pr/REPO
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "$cling_on" == "ON" ]]; then
export CLING_HASH=$(git ls-remote https://github.com/root-project/cling.git refs/tags/v${{ matrix.cling-version }} | tr '\t' '-')
export LLVM_HASH=$(git ls-remote https://github.com/root-project/llvm-project.git cling-llvm${{ matrix.clang-runtime}} | tr '\t' '-')
else
export CLING_HASH="Repl"
# May need to revert back to both having same llvm_hash, as below cause llvm to be rebuilt everytime commit is made to llvm/llvm-project for release a.x
# which could be quite often for new releases
export LLVM_HASH=$(git ls-remote https://github.com/llvm/llvm-project.git refs/heads/release/${{ matrix.clang-runtime}}.x | tr '\t' '-')
fi
echo "CLING_HASH=$CLING_HASH" >> $GITHUB_ENV
echo "LLVM_HASH=$LLVM_HASH" >> $GITHUB_ENV
- name: Setup default Build Type on *nux
if: runner.os != 'windows'
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CODE_COVERAGE=0" >> $GITHUB_ENV
os="${{ matrix.os }}"
if [[ "${os}" == "macos"* ]]; then
echo "ncpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
else
echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
fi
- name: install mamba
uses: mamba-org/setup-micromamba@main
with:
environment-file: environment-wasm-build.yml
init-shell: >-
${{ matrix.micromamba_shell_init }}
environment-name: CppInterOp-wasm-build
- name: Setup emsdk
shell: bash -l {0}
run: |
emsdk install 3.1.45
- name: Restore Cache LLVM/Clang runtime build directory
uses: actions/cache/restore@v4
id: cache
with:
path: |
llvm-project
${{ matrix.cling=='On' && 'cling' || '' }}
key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-patch-${{ hashFiles(format('patches/llvm/clang{0}-*.patch', matrix.clang-runtime)) || 'none' }}
- name: Emscripten build of CppInterOp on Unix systems
if: ${{ runner.os != 'windows' }}
shell: bash -l {0}
run: |
emsdk activate 3.1.45
source $CONDA_EMSDK_DIR/emsdk_env.sh
micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
export EMPACK_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build
export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm
export CMAKE_PREFIX_PATH=$PREFIX
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
LLVM_DIR="$(pwd)/llvm-project"
LLVM_BUILD_DIR="$(pwd)/llvm-project/build"
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "${cling_on}" == "ON" ]]; then
CLING_DIR="$(pwd)/cling"
CLING_BUILD_DIR="$(pwd)/cling/build"
CPLUS_INCLUDE_PATH="${CLING_DIR}/tools/cling/include:${CLING_BUILD_DIR}/include:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include"
else
CPLUS_INCLUDE_PATH="${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include"
fi
# Build CppInterOp next to cling and llvm-project.
mkdir build
cd build
export CPPINTEROP_BUILD_DIR=$PWD
if [[ "${cling_on}" == "ON" ]]; then
emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_CLING=ON \
-DUSE_REPL=OFF \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCling_DIR=$LLVM_BUILD_DIR/tools/cling \
-DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
-DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
-DBUILD_SHARED_LIBS=OFF \
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DZLIB_INCLUDE_DIR=$PREFIX/include \
-DZLIB_LIBRARY=$PREFIX/lib/ \
../
else
emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_CLING=OFF \
-DUSE_REPL=ON \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
-DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
-DBUILD_SHARED_LIBS=OFF \
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DZLIB_INCLUDE_DIR=$PREFIX/include \
-DZLIB_LIBRARY=$PREFIX/lib/ \
../
fi
EMCC_CFLAGS='-sERROR_ON_UNDEFINED_SYMBOLS=0' emmake make -j ${{ env.ncpus }}
cd ..
echo "CB_PYTHON_DIR=$CB_PYTHON_DIR" >> $GITHUB_ENV
echo "CPPINTEROP_BUILD_DIR=$CPPINTEROP_BUILD_DIR" >> $GITHUB_ENV
echo "CPPINTEROP_DIR=$CPPINTEROP_DIR" >> $GITHUB_ENV
echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV
echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
echo "PREFIX=$PREFIX" >> $GITHUB_ENV
- name: Build xeus-cpp
shell: bash -l {0}
run: |
emsdk activate 3.1.45
source $CONDA_EMSDK_DIR/emsdk_env.sh
micromamba activate CppInterOp-wasm
git clone https://github.com/compiler-research/xeus-cpp.git
cd ./xeus-cpp
mkdir build
pushd build
export EMPACK_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build
export CMAKE_PREFIX_PATH=${{ env.PREFIX }}
export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }}
emcmake cmake \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DCppInterOp_DIR="${{ env.CPPINTEROP_BUILD_DIR }}/lib/cmake/CppInterOp" \
..
EMCC_CFLAGS='-sERROR_ON_UNDEFINED_SYMBOLS=0' emmake make -j ${{ env.ncpus }}