Merge pull request #313 from fnalacceleratormodeling/egstern/312-pyth… #1451
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI:ubuntu-clang | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_cmake_enabled: | |
description: 'tmate before cmake' | |
required: false | |
default: false | |
debug_tests_enabled: | |
description: 'tmate before ctest' | |
required: false | |
default: false | |
push: | |
branches: [ devel3 ] | |
paths-ignore: | |
- 'wiki/**' | |
pull_request: | |
branches: [ devel3 ] | |
paths-ignore: | |
- 'wiki/**' | |
env: | |
BUILD_TYPE: RelWithDebInfo | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/fnalacceleratormodeling/synergia2-containers/ubuntu-clang:main | |
steps: | |
- name: Cancel Previous runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
# Debug: checkpoint at which to open tmate session | |
- name: ubuntu-clang pre CMake | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{github.event_name == 'workflow_dispatch' && github.event.inputs.debug_cmake_enabled }} | |
with: | |
sudo: false | |
- name: CMake | |
run: | | |
lscpu | |
. /opt/spack-environment/activate.sh | |
CC=/usr/bin/clang-17 CXX=/usr/bin/clang++-17 cmake -B ${{github.workspace}}/build \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ | |
-DCMAKE_LINKER_TYPE=MOLD \ | |
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \ | |
-DBUILD_PYTHON_BINDINGS=on -DPYTHON_EXECUTABLE=$(which python3) \ | |
-DENABLE_KOKKOS_BACKEND=OpenMP \ | |
-DBUILD_FD_SPACE_CHARGE_SOLVER=ON \ | |
-DUSE_OPENPMD_IO=ON \ | |
-DUSE_EXTERNAL_OPENPMD=ON \ | |
-DUSE_EXTERNAL_KOKKOS=OFF -GNinja | |
- name: build | |
# build synergia2 | |
run: | | |
. /opt/spack-environment/activate.sh | |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 2 | |
- name: install | |
# install synergia2 | |
run: | | |
. /opt/spack-environment/activate.sh | |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
# Debug: checkpoint at which to open tmate session | |
- name: ubuntu-clang pre ctest | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{github.event_name == 'workflow_dispatch' && github.event.inputs.debug_tests_enabled }} | |
with: | |
sudo: false | |
- name: ctest | |
# Execute tests defined by the CMake configuration. | |
run: | | |
. /opt/spack-environment/activate.sh | |
cd ${{github.workspace}}/build | |
ctest -C ${{env.BUILD_TYPE}} -VV --output-on-failure | |
- name: run-fodopy | |
# Run the fodopy example from README. | |
run: | | |
. /opt/spack-environment/activate.sh | |
export SYNINSTALL=${{github.workspace}}/install | |
export LD_LIBRARY_PATH=${SYNINSTALL}/lib:${SYNINSTALL}/lib64:\${LD_LIBRARY_PATH} | |
export PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') | |
export PYTHONPATH=${SYNINSTALL}/lib:${SYNINSTALL}/lib/python${PYTHON_VERSION}/site-packages:\${PYTHONPATH} | |
cd ${{github.workspace}}/build/examples/fodo | |
mpirun -np 1 python fodo_readme.py |