Skip to content

fix gtests, making it generic across CRPropa versions and systems #12

fix gtests, making it generic across CRPropa versions and systems

fix gtests, making it generic across CRPropa versions and systems #12

name: crpropa-testing_plugin-template
on:
push:
paths:
- ".github/workflows/testing_plugin-template.yml"
- "plugin-template/**.cpp"
- "plugin-template/**.h"
- "plugin-template/**.py"
- "plugin-template/**.i"
- "plugin-template/**/CMakeLists.txt"
pull_request:
paths:
- ".github/workflows/testing_plugin-template.yml"
- "plugin-template/**.cpp"
- "plugin-template/**.h"
- "plugin-template/**.py"
- "plugin-template/**.i"
- "plugin-template/**/CMakeLists.txt"
jobs:
x64:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-24"
os: ubuntu-24.04
cxx: "g++-14"
cc: "gcc-14"
fc: "gfortran-14"
swig_builtin: "On"
py: "/usr/bin/python3"
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Preinstall
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev python-dev-is-python3 libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov
pip install numpy
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
cd plugin-template
mkdir build
cd build
cmake .. -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none" -DUSE_OWN_CRPROPA=ON
- name: Build CRPropa
run: |
cd plugin-template/build
make
- name: Run tests
run: |
cd plugin-template/build
ctest --output-on-failure --repeat until-pass:3
- name: Archive test results
if: always()
uses: actions/upload-artifact@v7
with:
name: "test-report_${{matrix.config.os}}"
path: plugin-template/build/Testing/Temporary/LastTest.log
arm:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-24"
os: ubuntu-24.04-arm
cxx: "g++-14"
cc: "gcc-14"
fc: "gfortran-14"
swig_builtin: "On"
py: "/usr/bin/python3"
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Preinstall
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev python-dev-is-python3 libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov
pip install numpy
pip show numpy
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
cd plugin-template
mkdir build
cd build
cmake .. -DENABLE_PYTHON=True -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS="none" -DUSE_OWN_CRPROPA=ON
- name: Build CRPropa
run: |
cd plugin-template/build
make
- name: Run tests
run: |
cd plugin-template/build
ctest --output-on-failure --repeat until-pass:3
- name: Archive test results
if: always()
uses: actions/upload-artifact@v7
with:
name: "test-report_${{matrix.config.os}}"
path: plugin-template/build/Testing/Temporary/LastTest.log
mac:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "macos-14"
os: macos-14
cxx: "clang++"
cc: "clang"
fc: "gfortran-14"
swig_builtin: "On" #uses swig 4.0.2
py: "/usr/bin/python3" # python 3.14
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Preinstall
run: |
brew install hdf5 fftw cfitsio muparser libomp swig
python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install numpy cmake
pip show numpy # cross-check numpy version for Python_NumPy_INCLUDE_DIR
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
CRPROPA_DATA_PATH: "/Users/runner/work/CRPropa3/CRPropa3/build/data"
run: |
cd plugin-template
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/venv \
-DENABLE_PYTHON=True \
-DPython_EXECUTABLE=$GITHUB_WORKSPACE/venv/bin/python \
-DENABLE_TESTING=On \
-DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} \
-DPython_INSTALL_PACKAGE_DIR=$GITHUB_WORKSPACE/venv/lib/python3.14/site-packages \
-DUSE_OWN_CRPROPA=ON
- name: Build CRPropa
run: |
cd plugin-template/build
make
- name: Run tests
env:
CRPROPA_DATA_PATH: "/Users/runner/work/CRPropa3/CRPropa3/plugin-template/build/data"
run: |
cd plugin-template/build
ctest --output-on-failure --repeat until-pass:3
- name: Archive test results
if: always()
uses: actions/upload-artifact@v7
with:
name: "test-report_${{matrix.config.name}}"
path: plugin-template/build/Testing/Temporary/LastTest.log