@@ -26,11 +26,19 @@ jobs:
26
26
compiler : gcc-9
27
27
clang-runtime : ' 16'
28
28
cling : Off
29
+ cppyy : Off
29
30
- name : ubu22-gcc9-clang13-cling
30
31
os : ubuntu-22.04
31
32
compiler : gcc-9
32
33
clang-runtime : ' 13'
33
34
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
34
42
steps :
35
43
- uses : actions/checkout@v3
36
44
with :
@@ -55,15 +63,14 @@ jobs:
55
63
export LLVM_HASH=$(git ls-remote https://github.com/root-project/llvm-project.git cling-llvm${{ matrix.clang-runtime}} | tr '\t' '-')
56
64
echo "CLING_HASH=$CLING_HASH" >> $GITHUB_ENV
57
65
echo "LLVM_HASH=$LLVM_HASH" >> $GITHUB_ENV
58
-
59
66
-
uses :
nelonoel/[email protected]
60
67
- name : Setup compiler on Linux
61
68
if : runner.os == 'Linux'
62
69
run : |
63
70
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
64
71
vers="${compiler#*-}"
65
72
os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`"
66
- sudo apt update
73
+ ## sudo apt update
67
74
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
68
75
sudo apt install -y gcc-${vers} g++-${vers} lld
69
76
echo "CC=gcc-${vers}" >> $GITHUB_ENV
84
91
if : runner.os == 'Linux'
85
92
run : |
86
93
# 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
89
96
conda install -y -q -c conda-forge \
90
97
distro \
91
98
pytest
@@ -107,7 +114,7 @@ jobs:
107
114
git clone --depth=1 https://github.com/root-project/cling.git
108
115
git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git
109
116
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
111
118
fi
112
119
cd llvm-project
113
120
# Apply patches
@@ -155,12 +162,25 @@ jobs:
155
162
llvm-project
156
163
${{ matrix.cling=='On' && 'cling' || '' }}
157
164
key : ${{ steps.cache.outputs.cache-primary-key }}
158
- - name : Build and Test CppInterOp
165
+ - name : Build and Test/Install CppInterOp
159
166
run : |
167
+ LLVM_DIR="$(realpath llvm-project)"
160
168
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
+
161
181
# Build CppInterOp next to cling and llvm-project.
162
- pwd
163
182
mkdir build && cd build
183
+ export CPPINTEROP_BUILD_DIR=$PWD
164
184
cling_on="${{ matrix.cling }}"
165
185
if [[ "${cling_on^^}" == "ON" ]]; then
166
186
cmake -DCMAKE_BUILD_TYPE=Release \
@@ -169,16 +189,117 @@ jobs:
169
189
-DCling_DIR=$LLVM_BUILD_DIR \
170
190
-DLLVM_DIR=$LLVM_BUILD_DIR \
171
191
-DLLVM_USE_LINKER=lld \
192
+ -DBUILD_SHARED_LIBS=ON \
193
+ -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
172
194
../
173
195
else
174
196
cmake -DCMAKE_BUILD_TYPE=Release \
175
197
-DUSE_CLING=OFF \
176
198
-DUSE_REPL=ON \
177
199
-DLLVM_DIR=$LLVM_BUILD_DIR \
178
200
-DLLVM_USE_LINKER=lld \
201
+ -DBUILD_SHARED_LIBS=ON \
202
+ -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
179
203
../
180
204
fi
181
205
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
182
303
- name : Show debug info
183
304
if : ${{ failure() }}
184
305
run : |
0 commit comments