Skip to content

[ci] Make Building and Testing cppyy in reusable action #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .github/actions/Build_and_Test_cppyy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: 'Builds and test cppyy'
description: 'This action builds and tests cppyy for native platforms'

runs:
using: composite
steps:
- name: Build and Install cppyy-backend
if: ${{ matrix.cppyy == 'On' && runner.os != 'Windows' }}
shell: bash
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="${{ matrix.os }}"
if [[ "${os}" == "macos"* ]]; then
cp libcppyy-backend.dylib $CPPINTEROP_DIR/lib/
else
cp libcppyy-backend.so $CPPINTEROP_DIR/lib/
fi
cd ..

- name: Install CPyCppyy
if: ${{ matrix.cppyy == 'On' && runner.os != 'Windows' }}
shell: bash
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
if: ${{ matrix.cppyy == 'On' && runner.os != 'Windows' }}
shell: bash
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
if: ${{ matrix.cppyy == 'On' && runner.os != 'Windows' }}
shell: bash
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
if: ${{ matrix.cppyy == 'On' && runner.os != 'Windows' }}
shell: bash
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 -ra | 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 -ra --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=(.*)/\1@mark.skipif(condition=not \2/g' {} \;
# See if we don't have an xfail that went away
python -m pytest --runxfail -sv -ra | 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
os="${{ matrix.os }}"
if [[ "${os}" != "macos"* ]]; then
echo "Running valgrind on passing tests"
CLANG_VERSION="${{ matrix.clang-runtime }}"

if [[ "${{ matrix.cling }}" == "On" ]]; then
CLANG_INTERPRETER="cling"
else
CLANG_INTERPRETER="clang"
fi

if [[ "${{ matrix.os }}" == *"arm"* ]]; then
SUPPRESSION_FILE="../etc/${CLANG_INTERPRETER}${CLANG_VERSION}-valgrind_arm.supp"
else
SUPPRESSION_FILE="../etc/${CLANG_INTERPRETER}${CLANG_VERSION}-valgrind.supp"
fi
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
102 changes: 1 addition & 101 deletions .github/workflows/MacOS-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,107 +390,7 @@ jobs:

- uses: ./.github/actions/Build_and_Test_CppInterOp

- name: Build and Install cppyy-backend
if: ${{ 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 }}
cp libcppyy-backend.dylib $CPPINTEROP_DIR/lib/
cd ..

- name: Install CPyCppyy
if: ${{ 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
if: ${{ 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
if: ${{ 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
if: ${{ 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 -ra | 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 gsed -i '/run=False/!s/^ *@mark.xfail\(.*\)/#&/' {} \;
python -m pytest -n 1 -m "xfail" --runxfail -sv -ra --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 gsed -i -E 's/(^ *)@mark.xfail\(run=(.*)/\1@mark.skipif(condition=not \2/g' {} \;
# See if we don't have an xfail that went away
python -m pytest --runxfail -sv -ra | 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
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
- uses: ./.github/actions/Build_and_Test_cppyy

- name: Show debug info
if: ${{ failure() }}
Expand Down
102 changes: 1 addition & 101 deletions .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,107 +359,7 @@ jobs:

- uses: ./.github/actions/Build_and_Test_CppInterOp

- name: Build and Install cppyy-backend
if: ${{ 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 }}
cp libcppyy-backend.dylib $CPPINTEROP_DIR/lib/
cd ..

- name: Install CPyCppyy
if: ${{ 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
if: ${{ 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
if: ${{ 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
if: ${{ 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 -ra | 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 gsed -i '/run=False/!s/^ *@mark.xfail\(.*\)/#&/' {} \;
python -m pytest -n 1 -m "xfail" --runxfail -sv -ra --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 gsed -i -E 's/(^ *)@mark.xfail\(run=(.*)/\1@mark.skipif(condition=not \2/g' {} \;
# See if we don't have an xfail that went away
python -m pytest --runxfail -sv -ra | 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
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
- uses: ./.github/actions/Build_and_Test_cppyy

- name: Show debug info
if: ${{ failure() }}
Expand Down
Loading
Loading