Disable osx 11 and 13, install llvm along with openmpi via brew #5
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: mcxtrace-basictest | |
on: | |
push: | |
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: | |
matrix: | |
include: | |
- { os: ubuntu-20.04, CC: gcc-10, CXX: g++-10, python: '3.8' } | |
- { os: ubuntu-22.04, CC: gcc, CXX: g++, python: '3.9' } | |
- { os: ubuntu-latest, CC: gcc, CXX: g++, python: '3.10' } | |
- { os: ubuntu-latest, CC: clang, CXX: clang++, python: '3.11' } | |
- { os: ubuntu-latest, CC: gcc-12, CXX: g++-12, python: '3.11' } | |
# - { os: macos-11, CC: clang, CXX: clang++, python: "3.10" } | |
- { os: macos-12, CC: clang, CXX: clang++, python: "3.11" } | |
# - { os: macos-13, CC: clang, CXX: clang++, python: "3.11" } | |
- { os: windows-latest, CC: gcc, CXX: g++, python: "3.11" } | |
# - { os: windows-2019, CC: gcc, CXX: g++, python: "3.11" } | |
name: ${{ matrix.os }}.${{ matrix.CC }}.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@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Setup Bison | |
id: setup-flex-bison | |
run: | | |
if [ "x$(uname)" == "xDarwin" ]; then brew install bison flex; fi | |
if [ "x$(uname | cut -f1 -d_)" == "xMINGW64" ]; then choco install winflexbison3; fi | |
- name: Setup OpenMPI | |
id: setup-openmpi | |
run: | | |
if [ "x$(uname)" == "xLinux" ]; then sudo apt -y install libopenmpi-dev; fi | |
if [ "x$(uname)" == "xDarwin" ]; then brew install openmpi llvm; fi | |
- name: Check versions | |
id: version-checks | |
run: | | |
which python3 | |
python3 --version | |
which cmake | |
cmake --version | |
#NB: bison and flex in path are actually too old, we will install the | |
# keg-only recipes for them later: | |
#bison --version | |
#flex --version | |
- name: Configure build and install mcxtrace | |
id: mcxtrace-install | |
run: | | |
if [ "x$(uname)" == "xDarwin" ]; 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 [ "x$(uname)" == "xDarwin" ]; then export EXTRA_ARGS_FOR_CMAKE="-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison -DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex"; fi | |
if [ "x$(uname)" == "xLinux" ]; then export EXTRA_ARGS_FOR_CMAKE="-DNEXUSLIB=/usr/lib -DNEXUSINCLUDE=/usr/include/nexus"; fi | |
cmake \ | |
-DCMAKE_INSTALL_PREFIX=../install_mcxtrace \ | |
-S ../src \ | |
-G "Unix Makefiles" \ | |
-DMCVERSION="3.99.99" \ | |
-DMCCODE_BUILD_CONDA_PKG=ON \ | |
-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=ON \ | |
-DENSURE_NCRYSTAL=OFF \ | |
-DENABLE_CIF2HKL=OFF \ | |
${EXTRA_ARGS_FOR_CMAKE} | |
cmake --build . --config Release | |
cmake --build . --target install --config Release | |
export MCXTRACE_EXECUTABLE="mcxtrace" | |
export MXRUN_EXECUTABLE="mxrun" | |
if [ "x$(uname | cut -f1 -d_)" == "xMINGW64" ]; | |
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" | |
- name: Pip install various | |
id: pip-install | |
run: | | |
set -e | |
set -u | |
set -x | |
python3 -mpip install PyYAML ply McStasscript | |
- name: Launch basic test instrument | |
id: JJ_SAXS-tests | |
# 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" | |
if [ "x$(uname | cut -f1 -d_)" == "xMINGW64" ]; | |
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/JJ_SAXS.instr . | |
#Not a final solution!!!: | |
if [ "x$(uname)" == "xDarwin" ]; then export MCXTRACE_CC_OVERRIDE=/usr/bin/clang; fi | |
../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 | |
if [ "x$(uname | cut -f1 -d_)" != "xMINGW64" ]; | |
then | |
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} -c --mpi=2 JJ_SAXS.instr pin2_pos=0.2 pin3_pos=0.4 optic_L=0.1 sample_pos=0.2 detector_pos=2 | |
fi | |
- name: Launch MCPL test instrument | |
id: mcpl-test | |
# Status: Works on Unixes ("wrapper batches missing for Windows") | |
run: | | |
set -e | |
set -u | |
set -x | |
export MCXTRACE_EXECUTABLE="mcxtrace" | |
export MXRUN_EXECUTABLE="mxrun" | |
export PATH=${PATH}:${PWD}/install_mcxtrace/bin/:${PWD}/install_mcxtrace/mcxtrace/3.99.99/bin/ | |
if [ "x$(uname | cut -f1 -d_)" == "xMINGW64" ]; | |
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_Test_MCPL_input && cd run_Test_MCPL_input | |
cp ../install_mcxtrace/share/mcxtrace/resources/examples/Test_MCPL_input.instr . | |
#Not a final solution!!!: | |
if [ "x$(uname)" == "xDarwin" ]; then export MCXTRACE_CC_OVERRIDE=/usr/bin/clang; fi | |
if [ "x$(uname | cut -f1 -d_)" != "xMINGW64" ]; | |
then | |
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} Test_MCPL_input.instr repeat=10 | |
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} -c --mpi=2 Test_MCPL_input.instr repeat=20 | |
fi | |
- name: 'Tar output files' | |
id: tar-package | |
run: | | |
set -e | |
set -u | |
set -x | |
export TESTOS=`uname | cut -f1 -d_` && export TESTREL=`uname -r` && tar cvfz mcxtrace-${TESTOS}_${TESTREL}_output.tgz run_* | |
- name: 'Upload Artifact' | |
id: tar-upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: my-artifact | |
path: "*_output.tgz" | |
- name: Setup tmate session for manual debugging | |
uses: mxschmitt/action-tmate@v3 | |
if: always() && (inputs.manual-debugging == true || steps.tar-package.outcome != 'success') | |
with: | |
limit-access-to-actor: true |