Skip to content

Test a workflow for building EXP on Mac in CI #2

Test a workflow for building EXP on Mac in CI

Test a workflow for building EXP on Mac in CI #2

Workflow file for this run

name: "Build and Test pyEXP on Mac"
on:
push:
branches:
- '*'
pull_request:
branches:
- main
- devel
jobs:
exp:
strategy:
matrix:
os: [macos-latest]
name: "Test pyEXP Build on Mac"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install EXP dependencies (Mac)
run: |
brew install eigen fftw open-mpi hdf5 libomp
echo CC=mpicc >> $GITHUB_ENV
echo CXX=mpicxx >> $GITHUB_ENV
echo OMPI_CC="clang" >> $GITHUB_ENV
echo OMPI_CXX="clang++" >> $GITHUB_ENV
- name: Build EXP
run: |
# Get Python version info
PYTHON_VERSION=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
PYTHON_EXEC=$(which python)
PYTHON_LIBRARY_PATH=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
# Set Python library path based on OS
if [[ "$RUNNER_OS" == "macOS" ]]; then
PYTHON_LIBRARY=${PYTHON_LIBRARY_PATH}/libpython${PYTHON_VERSION}.dylib
else
PYTHON_LIBRARY=${PYTHON_LIBRARY_PATH}/libpython${PYTHON_VERSION}.so
fi
cmake -G Ninja -B build \
-DCMAKE_INSTALL_RPATH=$PWD/install/lib \
--install-prefix $PWD/install \
-DENABLE_NBODY=YES \
-DENABLE_PYEXP=YES \
-DDISABLE_OPENMP_COMPILE_FLAGS=YES \
-DPYTHON_EXECUTABLE=${PYTHON_EXEC} \
-DPYTHON_LIBRARY=${PYTHON_LIBRARY}
# Build and install EXP
cmake --build build
cmake --install build
# Add the pyEXP dir as a pyEXP.pth file in Python site-packages:
SITE_PACKAGES=$(python -c "import site; print(site.getsitepackages()[0])")
echo "$PWD/install/lib/python${PYTHON_VERSION}/site-packages" > "${SITE_PACKAGES}/pyEXP.pth"
- name: CTest Quick
run: ctest --output-on-failure -L quick
- name: Test pyEXP
run: |
python -c "import pyEXP; print('pyEXP successfully imported')"