test CI #19
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: basictest | |
on: push | |
# Workflow which pip installs the source code and checks that both bundles build | |
# and runs tests in both release and debug mode. | |
#sudo apt install bison | |
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" } | |
name: ${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }} | |
runs-on: ${{ matrix.os }} | |
env: | |
CC: ${{ matrix.CC }} | |
CXX: ${{ matrix.CXX }} | |
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 | |
run: | | |
( which brew > /dev/null && brew install bison ) || true | |
( which brew > /dev/null && brew install flex ) || true | |
- name: Check versions | |
run: | | |
which python3 | |
python3 --version | |
which cmake | |
cmake --version | |
#bison --version | |
#flex --version | |
- name: Configure build and install mcstas | |
run: | | |
( which xcrun >/dev/null && export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) ) || true | |
set -e | |
set -u | |
set -x | |
mkdir build_mcstas | |
cd build_mcstas | |
export EXTRA_ARGS_FOR_CMAKE="" | |
( which brew > /dev/null && export EXTRA_ARGS_FOR_CMAKE="-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison -DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex" ) || true | |
cmake \ | |
-DCMAKE_INSTALL_PREFIX=../install_mcstas \ | |
-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_MCSTAS=ON \ | |
-DMCCODE_USE_LEGACY_DESTINATIONS=OFF \ | |
-DBUILD_TOOLS=ON \ | |
-DENABLE_COMPONENTS=ON \ | |
-DENSURE_MCPL=OFF \ | |
-DENSURE_NCRYSTAL=OFF \ | |
-DENABLE_CIF2HKL=OFF \ | |
-DENABLE_NEUTRONICS=OFF \ | |
${EXTRA_ARGS_FOR_CMAKE} | |
cmake --build . --config Release | |
cmake --build . --target install --config Release | |
test -f "../install_mcstas/bin/mcstas" | |
test -f "../install_mcstas/bin/mcrun" | |
test -f "../install_mcstas/share/mcstas/tools/Python/mccodelib/__init__.py" | |
test -d "../install_mcstas/share/mcstas/resources/data" | |
- name: Pip install PyYAML | |
run: | | |
set -e | |
set -u | |
set -x | |
python3 -mpip install PyYAML | |
- name: Launch test instrument | |
run: | | |
set -e | |
set -u | |
set -x | |
test -f ./install_mcstas/bin/mcstas | |
./install_mcstas/bin/mcstas --version | |
mkdir run_BNL_H8 && cd run_BNL_H8 | |
cp ../install_mcstas/share/mcstas/resources/examples/BNL_H8.instr . | |
#Not a final solution!!!: | |
( which brew > /dev/null && export MCSTAS_CC_OVERRIDE=/usr/bin/clang ) || true | |
../install_mcstas/bin/mcrun BNL_H8.instr lambda=2.36 |