Skip to content

Temporarily disable this instr from McXtrace tests #445

Temporarily disable this instr from McXtrace tests

Temporarily disable this instr from McXtrace tests #445

name: mcxtrace-conda-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-latest, python: '3.12', mpi: 'openmpi' }
- { os: ubuntu-latest, python: '3.12', mpi: 'mpich' }
- { os: macos-latest, python: '3.12', mpi: 'openmpi' }
- { os: macos-latest, python: '3.12', mpi: 'mpich' }
- { os: windows-latest, python: '3.12', mpi: 'msmpi' }
name: ${{ matrix.os }}.${{ 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@v5
with:
path: src
fetch-depth: 2
- name: Setup VS in shell Intel
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: mcxtrace
auto-update-conda: true
conda-remove-defaults: true
channels: conda-forge
python-version: ${{ matrix.python }}
- name: Setup conda
id: setup-conda
run: |
./src/devel/bin/mccode-create-conda-yml -m mcxtrace -n mcxtrace -o dependencies.yml
conda env update --file dependencies.yml
echo DONE
- name: Check versions
id: version-checks
run: |
which python3
python3 --version
which cmake
cmake --version
if [ "$RUNNER_OS" != "Windows" ];
then
echo C compiler: $CC
$CC --version
else
echo C compiler: cl.exe
cl.exe
fi
- name: Configure build and install mcxtrace
id: mcxtrace-install
run: |
./src/devel/bin/mccode-build-conda -m mcxtrace -s $PWD/src -b $PWD/build_mcxtrace
- name: Post install openmpi hacks macOS
id: post-install-openmpi-hacks-macOS
if: runner.os == 'macOS'
run: |
if [ "${{ matrix.mpi }}" == "openmpi" ]; then
sed -i.bak 's+mpirun+mpirun\ -mca\ regx\ naive\ --verbose\ --mca\ btl_tcp_if_include\ lo0+g' ${CONDA_PREFIX}/share/mcxtrace/tools/Python/mccodelib/mccode_config.json
fi
# Start of tests
- name: Launch RNG test instrument
id: RNG-test
run: |
set -e
set -u
set -x
export MD5SUM="md5sum"
if [ "$RUNNER_OS" == "macOS" ];
then
export MD5SUM="md5"
fi
if [ "$RUNNER_OS" == "Windows" ];
then
export SUFFIX=".bat"
else
export SUFFIX=""
fi
test -f ${CONDA_PREFIX}/bin/mcxtrace
mcxtrace --version
mxtest${SUFFIX} --instr=Test_RNG_rand01 --testdir=run_singletests --suffix=${{ matrix.mpi }}
export SUM=`find run_singletests -name rngout.dat | xargs -n1 grep -v \# | ${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
run: |
set -e
set -u
set -x
if [ "$RUNNER_OS" == "Windows" ];
then
export SUFFIX=".bat --permissive"
else
export SUFFIX=""
fi
test -f ${CONDA_PREFIX}/bin/mcxtrace
mcxtrace --version
mxtest${SUFFIX} --instr=JJ_SAXS --testdir=run_singletests --suffix=${{ matrix.mpi }}
mxtest${SUFFIX} --instr=JJ_SAXS --mpi=2 --testdir=run_singletests --suffix=${{ matrix.mpi }}
- name: Launch ESRF_BM29 instrument
id: ESRF_BM29
run: |
set -e
set -u
set -x
if [ "$RUNNER_OS" == "Windows" ];
then
export SUFFIX=".bat"
else
export SUFFIX=""
fi
test -f ${CONDA_PREFIX}/bin/mcxtrace
mcxtrace --version
mxtest${SUFFIX} --instr=ESRF_BM29 --testdir=run_singletests --suffix=${{ matrix.mpi }}
mxtest${SUFFIX} --instr=ESRF_BM29 --mpi=2 --testdir=run_singletests --suffix=${{ matrix.mpi }}
- name: Launch MCPL test instrument
id: mcpl-test
run: |
set -e
set -u
set -x
if [ "$RUNNER_OS" == "Windows" ];
then
export SUFFIX=".bat"
else
export SUFFIX=""
fi
test -f ${CONDA_PREFIX}/bin/mcxtrace
mcxtrace --version
mxtest${SUFFIX} --instr=Test_MCPL_input --testdir=run_singletests --suffix=${{ matrix.mpi }}
mxtest${SUFFIX} --instr=Test_MCPL_output --testdir=run_singletests --suffix=${{ matrix.mpi }}
mxtest${SUFFIX} --instr=Test_MCPL_input --mpi=2 --testdir=run_singletests --suffix=${{ matrix.mpi }}
mxtest${SUFFIX} --instr=Test_MCPL_output --mpi=2 --testdir=run_singletests --suffix=${{ matrix.mpi }}
- name: Launch Absorption test instrument
id: Absorption-test
run: |
set -e
set -u
set -x
if [ "$RUNNER_OS" == "Windows" ];
then
export SUFFIX=".bat"
else
export SUFFIX=""
fi
test -f ${CONDA_PREFIX}/bin/mcxtrace
mcxtrace --version
mxtest${SUFFIX} --instr=Test_Absorption --testdir=run_singletests --suffix=${{ matrix.mpi }}
mxtest${SUFFIX} --instr=Test_Absorption --mpi=2 --testdir=run_singletests --suffix=${{ matrix.mpi }}
- name: Check for modified instruments
id: instr-test
run: |
set -e
set -u
set -x
export MCXTRACE_EXECUTABLE="mcxtrace"
export MXRUN_EXECUTABLE="mxrun"
export MXTEST_EXECUTABLE="mxtest"
export PERMISSIVE=" "
export PATH=${PATH}:${PWD}/install_mcxtrace/bin/:${PWD}/install_mcxtrace/mcxtrace/3.99.99/bin/
# Check if any instr files were modified during last commit
cd src
export CHANGEDCOMPS=`git diff --name-only HEAD HEAD~1| grep \.comp\$ | grep mcxtrace-comps | xargs -n1 basename | sed s/\.comp//g | xargs echo`
export NUMCHANGEDCOMPS=`git diff --name-only HEAD HEAD~1|grep \.comp\$ | grep mcxtrace-comps | wc -l | xargs echo`
cd -
if [ "$NUMCHANGEDCOMPS" != "0" ];
then
for comp in $CHANGEDCOMPS;
do
echo Finding tests including component $comp
NUMMATCH=`find src/mcxtrace-comps -name \*.instr -exec grep -H ${comp} \{\} \; | cut -f1 -d: | sort | uniq | wc -l`
if [ "$NUMMATCH" -gt "0" ];
then
if [ "$RUNNER_OS" != "Windows" ]; then
mxtest --mpi=2 --testdir run_${comp} --comp=${comp} --suffix=CHANGES_${{ matrix.mpi }} $PERMISSIVE --verbose
else
mxtest.bat --mpi=2 --testdir run_${comp} --comp=${comp} --suffix=CHANGES_${{ matrix.mpi }} $PERMISSIVE --verbose
fi
else
echo No matching tests found
fi
done
fi
cd src
export RUNALL="NO"
export CHANGEDINSTR=`git diff --name-only HEAD HEAD~1| grep \.instr\$ | grep mcxtrace-comps | xargs -n1 basename | sed s/\.instr//g | xargs echo`
export CHANGEDINSTR=`echo $CHANGEDINSTR | xargs -n1 echo | sort | uniq | xargs echo | sed s/\ /,/g`
export NUMCHANGEDINSTR=`git diff --name-only HEAD HEAD~1|grep \.instr\$ | grep mcxtrace-comps | wc -l | xargs echo`
echo ----
echo $NUMCHANGEDCOMPS components and $NUMCHANGEDINSTR instruments were changed, resulting in this list:
echo $CHANGEDINSTR
echo ----
cd -
if [ "$NUMCHANGEDINSTR" -gt "20" ];
then
export RUNALL="YES"
fi
if [ "$NUMCHANGEDINSTR" != "0" ];
then
if [ "$RUNALL" == "NO" ];
then
export SCOPE="--instr=$CHANGEDINSTR"
else
export SCOPE=" "
fi
mkdir run_mxtest && cd run_mxtest
if [ "$RUNNER_OS" != "Windows" ]; then
mxtest --mpi=2 --testdir $PWD $SCOPE --suffix=CHANGES_${{ matrix.mpi }} $PERMISSIVE
mxviewtest --nobrowse $PWD
else
mxtest.bat --mpi=2 --testdir $PWD $SCOPE --suffix=CHANGES_${{ matrix.mpi }} $PERMISSIVE
mxviewtest.bat --nobrowse $PWD
fi
fi
- name: 'Tar output files'
id: tar-package
if: always()
run: |
set -e
set -u
set -x
# Clear out binaries from sim dir and tar up artifact
ls | grep run_ | xargs -n1 ./src/devel/bin/mccode-simdir-cleanfiles -d
tar cvfz mcxtrace-${{ matrix.os }}.${{ 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.mpi }}.python-${{ matrix.python }}
path: "mcxtrace-${{ matrix.os }}.${{ 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