Skip to content

Commit c6d1b38

Browse files
committed
First stab at conda nightlies
1 parent 9eadf40 commit c6d1b38

1 file changed

Lines changed: 200 additions & 0 deletions

File tree

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
name: mcstas-testsuite
2+
on:
3+
schedule:
4+
- cron: '00 02 * * *' # 02:00 every day
5+
6+
workflow_dispatch:
7+
inputs:
8+
manual-debugging:
9+
type: boolean
10+
description: Launch manual debugging tmate for inspection (automatic in case of errors)
11+
default: false
12+
13+
jobs:
14+
build:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- { os: ubuntu-latest }
20+
- { os: ubuntu-24.04-arm }
21+
- { os: macos-latest }
22+
- { os: windows-latest }
23+
- { os: windows-11-arm }
24+
25+
- uses: mamba-org/setup-micromamba@v2
26+
with:
27+
environment-file: environment.yml
28+
init-shell: >-
29+
bash
30+
powershell
31+
cache-environment: true
32+
post-cleanup: 'all'
33+
- name: Import numpy in micromamba environment (bash)
34+
run: python -c "import numpy"
35+
shell: bash -el {0}
36+
- name: Import numpy in micromamba environment (pwsh)
37+
run: python -c "import numpy"
38+
shell: pwsh
39+
- name: Run custom command in micromamba environment
40+
run: pytest --version
41+
shell: micromamba-shell {0}
42+
43+
# - name: Setup python
44+
# uses: actions/setup-python@v5
45+
# with:
46+
# python-version: ${{ matrix.python }}
47+
48+
# - name: Setup MPI
49+
# uses: mpi4py/setup-mpi@v1
50+
# with:
51+
# mpi: ${{ matrix.mpi }}
52+
53+
# - name: Setup macOS
54+
# id: setup-macos
55+
# if: runner.os == 'macOS'
56+
# run: |
57+
# brew install bison flex gsl
58+
59+
# - name: Setup Windows
60+
# id: setup-Windows
61+
# if: runner.os == 'Windows'
62+
# run: |
63+
# choco install winflexbison3
64+
# pip install mslex
65+
66+
# - name: Setup Linux
67+
# id: setup-Linux
68+
# if: runner.os == 'Linux'
69+
# run: |
70+
# sudo apt install libgsl-dev libnexus-dev
71+
72+
# - name: Check versions
73+
# id: version-checks
74+
# run: |
75+
# which python3
76+
# python3 --version
77+
# which cmake
78+
# cmake --version
79+
# #NB: bison and flex in path are actually too old, on mac we
80+
# #inject these via a brew keg later
81+
82+
# - name: Configure build and install mcstas
83+
# id: mcstas-install
84+
# run: |
85+
# if [ "$RUNNER_OS" == "macOS" ]; then export SDKROOT=$(xcrun --sdk macosx --show-sdk-path); fi
86+
# set -e
87+
# set -u
88+
# set -x
89+
# mkdir build_mcstas
90+
# cd build_mcstas
91+
# export EXTRA_ARGS_FOR_CMAKE=""
92+
# 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"; fi
93+
# 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"; fi
94+
# 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
95+
# if [ "$RUNNER_OS" == "Linux" ]; then export EXTRA_ARGS_FOR_CMAKE="-DNEXUSLIB=/usr/lib -DNEXUSINCLUDE=/usr/include/nexus"; fi
96+
# 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} -DMCCODE_BUILD_WINDOWS_MINGW=ON"; fi
97+
# cmake \
98+
# -DCMAKE_INSTALL_PREFIX=../install_mcstas \
99+
# -S ../src \
100+
# -G "Unix Makefiles" \
101+
# -DMCVERSION="3.99.99" \
102+
# -DMCCODE_BUILD_CONDA_PKG=OFF \
103+
# -DBUILD_SHARED_LIBS=ON \
104+
# -DCMAKE_INSTALL_LIBDIR=lib \
105+
# -DCMAKE_BUILD_TYPE=Release \
106+
# -DBUILD_MCSTAS=ON \
107+
# -DMCCODE_USE_LEGACY_DESTINATIONS=OFF \
108+
# -DBUILD_TOOLS=ON \
109+
# -DENABLE_COMPONENTS=ON \
110+
# -DENSURE_MCPL=OFF \
111+
# -DENSURE_NCRYSTAL=OFF \
112+
# -DENABLE_CIF2HKL=ON \
113+
# -DENABLE_NEUTRONICS=OFF \
114+
# ${EXTRA_ARGS_FOR_CMAKE}
115+
# cmake --build . --config Release
116+
# cmake --build . --target install --config Release
117+
# export MCSTAS_EXECUTABLE="mcstas"
118+
# export MCRUN_EXECUTABLE="mcrun"
119+
# if [ "$RUNNER_OS" == "Windows" ];
120+
# then
121+
# export MCSTAS_EXECUTABLE="mcstas.exe"
122+
# export MCRUN_EXECUTABLE="mcrun.bat"
123+
# cd ../install_mcstas/
124+
# TOPDIR=`cygpath -m $PWD`
125+
# cd -
126+
# fi
127+
# test -f "../install_mcstas/bin/${MCSTAS_EXECUTABLE}"
128+
# test -f "../install_mcstas/bin/${MCRUN_EXECUTABLE}"
129+
# test -f "../install_mcstas/share/mcstas/tools/Python/mccodelib/__init__.py"
130+
# test -d "../install_mcstas/share/mcstas/resources/data"
131+
# if [ "${{ matrix.mpi }}" == "openmpi" ]; then sed -i.bak 's/mpirun/mpirun\ --verbose\ --mca\ btl\ self,vader,tcp/g' ../install_mcstas/share/mcstas/tools/Python/mccodelib/mccode_config.json ; fi
132+
# if [ "$RUNNER_OS" == "macOS" ]; then sed -i.bak "s+-lgsl\ -lgslcblas+${GSLFLAGS}+g" ../install_mcstas/share/mcstas/tools/Python/mccodelib/mccode_config.json ; fi
133+
# echo *******************************************************************************
134+
# echo Resulting mccode_config.json:
135+
# echo *******************************************************************************
136+
# cat ../install_mcstas/share/mcstas/tools/Python/mccodelib/mccode_config.json
137+
# echo *******************************************************************************
138+
139+
# - name: Pip install various
140+
# id: pip-install
141+
# run: |
142+
# set -e
143+
# set -u
144+
# set -x
145+
# if [ "$RUNNER_OS" == "Windows" ];
146+
# then
147+
# python3 -mpip install PyYAML ply McStasscript ncrystal mcpl
148+
# fi
149+
# if [ "$RUNNER_OS" == "macOS" ];
150+
# then
151+
# python3 -mpip install PyYAML ply McStasScript ncrystal mcpl --break-system-packages
152+
# fi
153+
# if [ "$RUNNER_OS" == "Linux" ];
154+
# then
155+
# python3 -mpip install PyYAML ply McStasscript ncrystal mcpl
156+
# fi
157+
158+
# - name: Test suite, up to 2-core MPI
159+
# id: test-suite
160+
# run: |
161+
# set -e
162+
# set -u
163+
# set -x
164+
# export PATH=${PATH}:${PWD}/install_mcstas/bin/:${PWD}/install_mcstas/mcstas/3.99.99/bin/
165+
# mkdir run_test-suite && cd run_test-suite
166+
# export MCTEST_EXECUTABLE="mctest"
167+
# if [ "$RUNNER_OS" == "Windows" ];
168+
# then
169+
# export MCTEST_EXECUTABLE="mctest.bat"
170+
# fi
171+
# if [ "$RUNNER_OS" == "macOS" ];
172+
# then
173+
# mkdir ${HOME}/tmp
174+
# export TMPDIR=${HOME}/tmp
175+
# fi
176+
# echo $PATH
177+
# ${MCTEST_EXECUTABLE} --verbose --testdir $PWD --suffix ${{ matrix.os }}_${{ matrix.mpi }}_${{ matrix.CC }} --mpi=2
178+
179+
# - name: 'Tar output files'
180+
# id: tar-package
181+
# if: always()
182+
# run: |
183+
# set -e
184+
# set -u
185+
# set -x
186+
# tar cvfz mcstas-${{ matrix.os }}.${{ matrix.CC }}.${{ matrix.mpi }}.python-${{ matrix.python }}_output.tgz run_*
187+
188+
# - name: 'Upload Artifact'
189+
# id: tar-upload
190+
# uses: actions/upload-artifact@v4
191+
# if: always()
192+
# with:
193+
# name: mcstas-artefacts-${{ matrix.os }}.${{ matrix.CC }}.${{ matrix.mpi }}.python-${{ matrix.python }}
194+
# path: "mcstas-${{ matrix.os }}.${{ matrix.CC }}.${{ matrix.mpi }}.python-${{ matrix.python }}_output.tgz"
195+
196+
- name: Setup tmate session for manual debugging
197+
uses: mxschmitt/action-tmate@v3
198+
if: always() && (inputs.manual-debugging == true)
199+
with:
200+
limit-access-to-actor: true

0 commit comments

Comments
 (0)