Skip to content

Commit b008bbe

Browse files
sudo-pandavgvassilev
authored andcommitted
Add cppyy build to ci matrix
1 parent 2e5e702 commit b008bbe

File tree

1 file changed

+128
-7
lines changed

1 file changed

+128
-7
lines changed

.github/workflows/ci.yml

Lines changed: 128 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,19 @@ jobs:
2626
compiler: gcc-9
2727
clang-runtime: '16'
2828
cling: Off
29+
cppyy: Off
2930
- name: ubu22-gcc9-clang13-cling
3031
os: ubuntu-22.04
3132
compiler: gcc-9
3233
clang-runtime: '13'
3334
cling: On
35+
cppyy: Off
36+
- name: ubu22-gcc9-clang13-cling-cppyy
37+
os: ubuntu-22.04
38+
compiler: gcc-9
39+
clang-runtime: '13'
40+
cling: On
41+
cppyy: On
3442
steps:
3543
- uses: actions/checkout@v3
3644
with:
@@ -55,15 +63,14 @@ jobs:
5563
export LLVM_HASH=$(git ls-remote https://github.com/root-project/llvm-project.git cling-llvm${{ matrix.clang-runtime}} | tr '\t' '-')
5664
echo "CLING_HASH=$CLING_HASH" >> $GITHUB_ENV
5765
echo "LLVM_HASH=$LLVM_HASH" >> $GITHUB_ENV
58-
5966
- uses: nelonoel/[email protected]
6067
- name: Setup compiler on Linux
6168
if: runner.os == 'Linux'
6269
run: |
6370
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
6471
vers="${compiler#*-}"
6572
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`"
66-
sudo apt update
73+
##sudo apt update
6774
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
6875
sudo apt install -y gcc-${vers} g++-${vers} lld
6976
echo "CC=gcc-${vers}" >> $GITHUB_ENV
@@ -84,8 +91,8 @@ jobs:
8491
if: runner.os == 'Linux'
8592
run: |
8693
# Install deps
87-
sudo apt-get update
88-
sudo apt-get install git g++ debhelper devscripts gnupg python3
94+
##sudo apt update
95+
sudo apt install git g++ debhelper devscripts gnupg python3 valgrind
8996
conda install -y -q -c conda-forge \
9097
distro \
9198
pytest
@@ -107,7 +114,7 @@ jobs:
107114
git clone --depth=1 https://github.com/root-project/cling.git
108115
git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git
109116
else # repl
110-
git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git
117+
git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git
111118
fi
112119
cd llvm-project
113120
# Apply patches
@@ -155,12 +162,25 @@ jobs:
155162
llvm-project
156163
${{ matrix.cling=='On' && 'cling' || '' }}
157164
key: ${{ steps.cache.outputs.cache-primary-key }}
158-
- name: Build and Test CppInterOp
165+
- name: Build and Test/Install CppInterOp
159166
run: |
167+
LLVM_DIR="$(realpath llvm-project)"
160168
LLVM_BUILD_DIR="$(realpath llvm-project/build)"
169+
cling_on="${{ matrix.cling }}"
170+
if [[ "${cling_on^^}" == "ON" ]]; then
171+
CLING_DIR="$(realpath cling)"
172+
CLING_BUILD_DIR="$(realpath cling/build)"
173+
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"
174+
else # repl
175+
CPLUS_INCLUDE_PATH="${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include"
176+
fi
177+
178+
export CB_PYTHON_DIR="$PWD/cppyy-backend/python"
179+
export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend"
180+
161181
# Build CppInterOp next to cling and llvm-project.
162-
pwd
163182
mkdir build && cd build
183+
export CPPINTEROP_BUILD_DIR=$PWD
164184
cling_on="${{ matrix.cling }}"
165185
if [[ "${cling_on^^}" == "ON" ]]; then
166186
cmake -DCMAKE_BUILD_TYPE=Release \
@@ -169,16 +189,117 @@ jobs:
169189
-DCling_DIR=$LLVM_BUILD_DIR \
170190
-DLLVM_DIR=$LLVM_BUILD_DIR \
171191
-DLLVM_USE_LINKER=lld \
192+
-DBUILD_SHARED_LIBS=ON \
193+
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
172194
../
173195
else
174196
cmake -DCMAKE_BUILD_TYPE=Release \
175197
-DUSE_CLING=OFF \
176198
-DUSE_REPL=ON \
177199
-DLLVM_DIR=$LLVM_BUILD_DIR \
178200
-DLLVM_USE_LINKER=lld \
201+
-DBUILD_SHARED_LIBS=ON \
202+
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
179203
../
180204
fi
181205
cmake --build . --target check-cppinterop --parallel $(nproc --all)
206+
cd ..
207+
# We need CB_PYTHON_DIR later
208+
echo "CB_PYTHON_DIR=$CB_PYTHON_DIR" >> $GITHUB_ENV
209+
# We need CPPINTEROP_DIR, LLVM_BUILD_DIR and CPLUS_INCLUDE_PATH later
210+
echo "CPPINTEROP_BUILD_DIR=$CPPINTEROP_BUILD_DIR" >> $GITHUB_ENV
211+
echo "CPPINTEROP_DIR=$CPPINTEROP_DIR" >> $GITHUB_ENV
212+
echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV
213+
echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
214+
- name: Build and Install cppyy-backend on Linux
215+
if: runner.os == 'Linux' && ${{ matrix.cppyy }} == 'On'
216+
run: |
217+
# Download cppyy-backend
218+
git clone https://github.com/compiler-research/cppyy-backend.git
219+
cd cppyy-backend
220+
mkdir -p $CPPINTEROP_DIR/lib build && cd build
221+
# Install CppInterOp
222+
(cd $CPPINTEROP_BUILD_DIR && cmake --build . --target install --parallel $(nproc --all))
223+
# Build and Install cppyy-backend
224+
cmake -DInterOp_DIR=$CPPINTEROP_DIR ..
225+
cmake --build . --parallel $(nproc --all)
226+
cp libcppyy-backend.so $CPPINTEROP_DIR/lib/
227+
##cling_on="${{ matrix.cling }}"
228+
##if [[ "${cling_on^^}" == "ON" ]]; then
229+
## cp $LLVM_BUILD_DIR/lib/libcling.so $CPPINTEROP_DIR/lib/
230+
##fi
231+
#
232+
cd ..
233+
- name: Install CPyCppyy on Linux
234+
if: runner.os == 'Linux' && ${{ matrix.cppyy }} == 'On'
235+
run: |
236+
# Setup virtual environment
237+
python3 -m venv .venv
238+
source .venv/bin/activate
239+
# Install CPyCppyy
240+
git clone https://github.com/compiler-research/CPyCppyy.git
241+
cd CPyCppyy
242+
mkdir build && cd build
243+
cmake ..
244+
cmake --build . --parallel $(nproc --all)
245+
#
246+
export CPYCPPYY_DIR=$PWD
247+
cd ../..
248+
# We need CPYCPPYY_DIR later
249+
echo "CPYCPPYY_DIR=$CPYCPPYY_DIR" >> $GITHUB_ENV
250+
- name: Install cppyy on Linux
251+
if: runner.os == 'Linux' && ${{ matrix.cppyy }} == 'On'
252+
run: |
253+
# source virtual environment
254+
source .venv/bin/activate
255+
# Install cppyy
256+
git clone https://github.com/compiler-research/cppyy.git
257+
cd cppyy
258+
python -m pip install --upgrade . --no-deps
259+
cd ..
260+
- name: Run cppyy on Linux
261+
if: runner.os == 'Linux' && ${{ matrix.cppyy }} == 'On'
262+
run: |
263+
# Run cppyy
264+
source .venv/bin/activate
265+
export PYTHONPATH=$PYTHONPATH:$CPYCPPYY_DIR:$CB_PYTHON_DIR
266+
python -c "import cppyy"
267+
# We need PYTHONPATH later
268+
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
269+
- name: Run the tests on Linux
270+
continue-on-error: true
271+
if: runner.os == 'Linux' && ${{ matrix.cppyy }} == 'On'
272+
run: |
273+
# Run the tests
274+
source .venv/bin/activate
275+
cd cppyy/test
276+
echo ::group::Prepare For Testing
277+
make all
278+
python -m pip install --upgrade pip
279+
python -m pip install pytest
280+
python -m pip install pytest-xdist
281+
echo ::endgroup::
282+
echo ::group::Crashing Test Logs
283+
# See if we don't have a crash that went away
284+
python -m pytest -n 1 -m "crashes" -sv --max-worker-restart 512 | tee test_crashed.log 2>&1
285+
echo ::endgroup::
286+
echo ::group::XFAIL Test Logs
287+
# See if we don't have an xfail that went away
288+
python -m pytest -m "not crashes" --runxfail -s | tee test_xfailed.log 2>&1
289+
echo ::endgroup::
290+
echo ::group::Passing Test Logs
291+
# Run the rest of the non-crashing tests.
292+
declare -i PYTEST_RETCODE=0
293+
#python -m pytest -m "not crashes" -v | tee test_passing.log 2>&1
294+
valgrind --error-exitcode=1 --suppressions=../etc/valgrind-cppyy-cling.supp python -m pytest -m "not crashes and not xfail" -v
295+
export PYTEST_RETCODE=+$?
296+
echo ::endgroup::
297+
echo "Crashing Summary: \n"
298+
tail -n1 test_crashed.log
299+
echo "XFAIL Summary:"
300+
tail -n1 test_xfailed.log
301+
echo "Passing Summary:"
302+
tail -n1 test_passing.log
182303
- name: Show debug info
183304
if: ${{ failure() }}
184305
run: |

0 commit comments

Comments
 (0)