Merge pull request #2073 from mccode-dev/prep-for-3.5.30 #2428
This file contains hidden or 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: mcxtrace-basictest | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| - cron: '55 23 * * 0' # 23:55 every Sunday | |
| workflow_dispatch: | |
| inputs: | |
| manual-debugging: | |
| type: boolean | |
| description: Launch manual debugging tmate for inspection (automatic in case of errors) | |
| default: false | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: ubuntu-24.04, CC: gcc-13, CXX: g++-13, python: '3.12', mpi: 'openmpi' } | |
| - { os: ubuntu-24.04, CC: clang, CXX: clang++, python: '3.12', mpi: 'openmpi' } | |
| - { os: ubuntu-22.04, CC: clang, CXX: clang++, python: '3.11', mpi: 'openmpi' } | |
| - { os: ubuntu-22.04, CC: gcc-12, CXX: g++-12, python: '3.11', mpi: 'openmpi' } | |
| - { os: macos-13, CC: clang, CXX: clang++, python: "3.11", mpi: 'mpich' } | |
| - { os: macos-14, CC: clang, CXX: clang++, python: "3.12", mpi: 'mpich' } | |
| - { os: macos-15, CC: clang, CXX: clang++, python: "3.13", mpi: 'mpich' } | |
| #- { os: macos-13, CC: clang, CXX: clang++, python: "3.11", mpi: 'openmpi' } | |
| #- { os: macos-14, CC: clang, CXX: clang++, python: "3.12", mpi: 'openmpi' } | |
| #- { os: macos-15, CC: clang, CXX: clang++, python: "3.13", mpi: 'openmpi' } | |
| #- { os: windows-latest, CC: gcc, CXX: g++, python: "3.12", mpi: 'msmpi' } | |
| name: ${{ matrix.os }}.${{ matrix.CC }}.${{ matrix.mpi }}.python-${{ matrix.python }} | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| CC: ${{ matrix.CC }} | |
| CXX: ${{ matrix.CXX }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| path: src | |
| - name: Setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Setup MPI | |
| uses: mpi4py/setup-mpi@v1 | |
| with: | |
| mpi: ${{ matrix.mpi }} | |
| - name: Setup Bison (macOS) | |
| id: setup-flex-bison-macos | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install bison flex gfortran gsl | |
| brew tap tschoonj/tap | |
| brew install xraylib | |
| - name: Setup Bison (Windows) | |
| id: setup-flex-bison-Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| choco install winflexbison3 | |
| pip install mslex | |
| - name: Check versions | |
| id: version-checks | |
| run: | | |
| which python3 | |
| python3 --version | |
| which cmake | |
| cmake --version | |
| - name: Configure build and install mcxtrace | |
| id: mcxtrace-install | |
| run: | | |
| if [ "$RUNNER_OS" == "macOS" ]; then mkdir ${HOME}/tmp; fi | |
| if [ "$RUNNER_OS" == "macOS" ]; then export SDKROOT=$(xcrun --sdk macosx --show-sdk-path); fi | |
| set -e | |
| set -u | |
| set -x | |
| mkdir build_mcxtrace | |
| cd build_mcxtrace | |
| export EXTRA_ARGS_FOR_CMAKE="" | |
| if [ "$RUNNER_OS" == "macOS" ] && [ -f "/opt/homebrew/opt/flex/bin/flex" ]; then export HOMEBRW="/opt/homebrew/opt"; export GSLFLAGS="-lgsl -lgslcblas -L/opt/homebrew/lib -I/opt/homebrew/include"; export XRLFLAGS="-lxrl -L/opt/homebrew/lib -I/opt/homebrew/include"; fi | |
| if [ "$RUNNER_OS" == "macOS" ] && [ -f "/usr/local/opt/flex/bin/flex" ]; then export HOMEBRW="/usr/local/opt"; export GSLFLAGS="-lgsl -lgslcblas -L/usr/local/lib -I/usr/local/include"; export XRLFLAGS="-lxrl -L/usr/local/lib -I/usr/local/include"; fi | |
| if [ "$RUNNER_OS" == "macOS" ]; then export EXTRA_ARGS_FOR_CMAKE="-DBISON_EXECUTABLE=${HOMEBRW}/bison/bin/bison -DFLEX_EXECUTABLE=${HOMEBRW}/flex/bin/flex -DCMAKE_Fortran_COMPILER=${HOMEBRW}/gfortran/bin/gfortran"; fi | |
| if [ "$RUNNER_OS" == "Linux" ]; then export EXTRA_ARGS_FOR_CMAKE="-DNEXUSLIB=/usr/lib -DNEXUSINCLUDE=/usr/include/nexus"; fi | |
| if [ "$RUNNER_OS" == "Windows" ]; then export MPIINC=`cygpath -m -s "${MSMPI_INC}"`; export MPILIB=`cygpath -m -s "${MSMPI_LIB64}"`; export EXTRA_ARGS_FOR_CMAKE="-DMPILIBDIR=${MPILIB} -DMPIINCLUDEDIR=${MPIINC}"; fi | |
| cmake \ | |
| -DCMAKE_INSTALL_PREFIX=../install_mcxtrace \ | |
| -S ../src \ | |
| -G "Unix Makefiles" \ | |
| -DMCVERSION="3.99.99" \ | |
| -DMCCODE_BUILD_CONDA_PKG=OFF \ | |
| -DBUILD_SHARED_LIBS=ON \ | |
| -DCMAKE_INSTALL_LIBDIR=lib \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DBUILD_MCXTRACE=ON \ | |
| -DMCCODE_USE_LEGACY_DESTINATIONS=OFF \ | |
| -DBUILD_TOOLS=ON \ | |
| -DENABLE_COMPONENTS=ON \ | |
| -DENSURE_MCPL=OFF \ | |
| -DENSURE_NCRYSTAL=OFF \ | |
| -DENABLE_CIF2HKL=ON \ | |
| -DENABLE_NEUTRONICS=OFF \ | |
| ${EXTRA_ARGS_FOR_CMAKE} | |
| cmake --build . --config Release | |
| cmake --build . --target install --config Release | |
| export MCXTRACE_EXECUTABLE="mcxtrace" | |
| export MXRUN_EXECUTABLE="mxrun" | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| export MCXTRACE_EXECUTABLE="mcxtrace.exe" | |
| export MXRUN_EXECUTABLE="mxrun.bat" | |
| fi | |
| test -f "../install_mcxtrace/bin/${MCXTRACE_EXECUTABLE}" | |
| test -f "../install_mcxtrace/bin/${MXRUN_EXECUTABLE}" | |
| test -f "../install_mcxtrace/share/mcxtrace/tools/Python/mccodelib/__init__.py" | |
| test -d "../install_mcxtrace/share/mcxtrace/resources/data" | |
| if [ "${{ matrix.mpi }}" == "openmpi" ]; then sed -i.bak 's/mpirun/mpirun\ --mca\ btl\ self,vader,tcp/g' ../install_mcxtrace/share/mcxtrace/tools/Python/mccodelib/mccode_config.json ; fi | |
| if [ "$RUNNER_OS" == "macOS" ]; then sed -i.bak "s+-lgsl\ -lgslcblas+${GSLFLAGS}+g" ../install_mcxtrace/share/mcxtrace/tools/Python/mccodelib/mccode_config.json ; fi | |
| if [ "$RUNNER_OS" == "macOS" ]; then sed -i.bak "s+-lxrl+${XRLFLAGS}+g" ../install_mcxtrace/share/mcxtrace/tools/Python/mccodelib/mccode_config.json ; fi | |
| echo ******************************************************************************* | |
| echo Resulting mccode_config.json: | |
| echo ******************************************************************************* | |
| cat ../install_mcxtrace/share/mcxtrace/tools/Python/mccodelib/mccode_config.json | |
| echo ******************************************************************************* | |
| - name: Pip install various | |
| id: pip-install | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| python3 -mpip install PyYAML ply McStasscript mcpl mcpl-extra | |
| fi | |
| if [ "$RUNNER_OS" == "macOS" ]; | |
| then | |
| python3 -mpip install PyYAML ply McStasScript mcpl mcpl-extra --break-system-packages | |
| fi | |
| if [ "$RUNNER_OS" == "Linux" ]; | |
| then | |
| python3 -mpip install PyYAML ply McStasscript mcpl mcpl-extra | |
| fi | |
| - name: Launch RNG test instrument | |
| id: RNG-test | |
| # Status: Works on Windows + Unixes | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| export MCXTRACE_EXECUTABLE="mcxtrace" | |
| export MCXTRACE_PYGEN_EXECUTABLE="mcxtrace-pygen" | |
| export MXRUN_EXECUTABLE="mxrun" | |
| export MD5SUM="md5sum" | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| export MCXTRACE_EXECUTABLE="mcxtrace.exe" | |
| export MCXTRACE_PYGEN_EXECUTABLE="mcxtrace-pygen.exe" | |
| export MXRUN_EXECUTABLE="mxrun.bat" | |
| fi | |
| if [ "$RUNNER_OS" == "macOS" ]; | |
| then | |
| export MD5SUM="md5" | |
| fi | |
| test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} | |
| ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version | |
| mkdir run_RNG && cd run_RNG | |
| cp ../install_mcxtrace/share/mcxtrace/resources/examples/Tests_RNG/Test_RNG_rand01/Test_RNG_rand01.instr . | |
| ../install_mcxtrace/bin/${MXRUN_EXECUTABLE} Test_RNG_rand01.instr -s1000 seed=1000 -d RNGtest | |
| export SUM=`grep -v \# RNGtest/rngout.dat | ${MD5SUM} | cut -f1 -d\ ` | |
| export EXPECTED="f192ce4609e2225bf9d42ce9c5fa5a86" | |
| if [ "${EXPECTED}" == "${SUM}" ]; | |
| then | |
| echo RNG test success! | |
| true | |
| else | |
| echo RNG test failure! | |
| false | |
| fi | |
| - name: Launch JJ_SAXS instrument | |
| id: JJ_SAXS-basic | |
| # Status: Works on all systems | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| export MCXTRACE_EXECUTABLE="mcxtrace" | |
| export MCXTRACE_PYGEN_EXECUTABLE="mcxtrace-pygen" | |
| export MXRUN_EXECUTABLE="mxrun" | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| export MCXTRACE_EXECUTABLE="mcxtrace.exe" | |
| export MCXTRACE_PYGEN_EXECUTABLE="mcxtrace-pygen.exe" | |
| export MXRUN_EXECUTABLE="mxrun.bat" | |
| fi | |
| test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} | |
| ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version | |
| mkdir run_JJ_SAXS && cd run_JJ_SAXS | |
| cp ../install_mcxtrace/share/mcxtrace/resources/examples/SAXSLAB/JJ_SAXS/JJ_SAXS.instr . | |
| ../install_mcxtrace/bin/${MXRUN_EXECUTABLE} JJ_SAXS.instr pin2_pos=0.2 pin3_pos=0.4 optic_L=0.1 sample_pos=0.2 detector_pos=2 | |
| ../install_mcxtrace/bin/${MCXTRACE_PYGEN_EXECUTABLE} JJ_SAXS.instr | |
| - name: Launch JJ_SAXS instrument (MPI) | |
| id: JJ_SAXS-mpi | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| export MCXTRACE_EXECUTABLE="mcxtrace" | |
| export MCXTRACE_PYGEN_EXECUTABLE="mcxtrace-pygen" | |
| export MXRUN_EXECUTABLE="mxrun" | |
| if [ "$RUNNER_OS" == "macOS" ]; then export TMPDIR=${HOME}/tmp; fi | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| export MCXTRACE_EXECUTABLE="mcxtrace.exe" | |
| export MXRUN_EXECUTABLE="mxrun.bat" | |
| fi | |
| test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} | |
| ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version | |
| mkdir run_JJ_SAXS_mpi && cd run_JJ_SAXS_mpi | |
| cp ../install_mcxtrace/share/mcxtrace/resources/examples/SAXSLAB/JJ_SAXS/JJ_SAXS.instr . | |
| ../install_mcxtrace/bin/${MXRUN_EXECUTABLE} --verbose --mpi=2 JJ_SAXS.instr pin2_pos=0.2 pin3_pos=0.4 optic_L=0.1 sample_pos=0.2 detector_pos=2 | |
| - name: Launch MCPL test instrument | |
| id: mcpl-test | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| export MCXTRACE_EXECUTABLE="mcxtrace" | |
| export MXRUN_EXECUTABLE="mxrun" | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| export MCXTRACE_EXECUTABLE="mcxtrace.exe" | |
| export MXRUN_EXECUTABLE="mxrun.bat" | |
| fi | |
| export PATH=${PATH}:${PWD}/install_mcxtrace/bin/:${PWD}/install_mcxtrace/mcxtrace/3.99.99/bin/ | |
| test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} | |
| ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version | |
| mkdir run_Test_MCPL_input && cd run_Test_MCPL_input | |
| cp ../install_mcxtrace/share/mcxtrace/resources/examples/Tests_MCPL_etc/Test_MCPL_input/Test_MCPL_input.instr . | |
| cp ../install_mcxtrace/share/mcxtrace/resources/examples/Tests_MCPL_etc/Test_MCPL_input/voutput.mcpl.gz . | |
| ../install_mcxtrace/bin/${MXRUN_EXECUTABLE} Test_MCPL_input.instr repeat=10 MCPLFILE=voutput.mcpl.gz | |
| - name: Launch MCPL test instrument (MPI) | |
| id: mcpl-test-mpi | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| export MCXTRACE_EXECUTABLE="mcxtrace" | |
| export MXRUN_EXECUTABLE="mxrun" | |
| if [ "$RUNNER_OS" == "macOS" ]; then export TMPDIR=${HOME}/tmp; fi | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| export MCXTRACE_EXECUTABLE="mcxtrace.exe" | |
| export MXRUN_EXECUTABLE="mxrun.bat" | |
| fi | |
| export PATH=${PATH}:${PWD}/install_mcxtrace/bin/:${PWD}/install_mcxtrace/mcxtrace/3.99.99/bin/ | |
| test -f ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} | |
| ./install_mcxtrace/bin/${MCXTRACE_EXECUTABLE} --version | |
| mkdir run_Test_MCPL_input_mpi && cd run_Test_MCPL_input_mpi | |
| cp ../install_mcxtrace/share/mcxtrace/resources/examples/Tests_MCPL_etc/Test_MCPL_input/Test_MCPL_input.instr . | |
| cp ../install_mcxtrace/share/mcxtrace/resources/examples/Tests_MCPL_etc/Test_MCPL_input/voutput.mcpl.gz . | |
| ../install_mcxtrace/bin/${MXRUN_EXECUTABLE} --verbose --mpi=2 Test_MCPL_input.instr repeat=20 MCPLFILE=voutput.mcpl.gz | |
| - name: 'Tar output files' | |
| id: tar-package | |
| if: always() | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| tar cvfz mcxtrace-${{ matrix.os }}.${{ matrix.CC }}.${{ matrix.mpi }}.python-${{ matrix.python }}_output.tgz run_* | |
| - name: 'Upload Artifact' | |
| id: tar-upload | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mcxtrace-artefacts-${{ matrix.os }}.${{ matrix.CC }}.${{ matrix.mpi }}.python-${{ matrix.python }} | |
| path: "mcxtrace-${{ matrix.os }}.${{ matrix.CC }}.${{ matrix.mpi }}.python-${{ matrix.python }}_output.tgz" | |
| - name: Setup tmate session for manual debugging | |
| uses: mxschmitt/action-tmate@v3 | |
| if: always() && (inputs.manual-debugging == true) | |
| with: | |
| limit-access-to-actor: true |