-
Notifications
You must be signed in to change notification settings - Fork 54
236 lines (216 loc) · 9.38 KB
/
mcxtrace-basictest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
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:
fail-fast: false
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-22.04, CC: gcc, CXX: g++, python: '3.10' }
- { os: ubuntu-22.04, CC: clang, CXX: clang++, python: '3.11' }
- { os: ubuntu-22.04, 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" }
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@v5
with:
python-version: ${{ matrix.python }}
- name: Setup Bison (macOS)
id: setup-flex-bison-macos
if: runner.os == 'macOS'
run: |
brew install bison flex
- name: Setup Bison (Windows)
id: setup-flex-bison-Windows
if: runner.os == 'Windows'
run: |
choco install winflexbison3
pip install mslex
- name: Setup OpenMPI (Linux)
id: setup-openmpi-linux
if: runner.os == 'Linux'
run: |
sudo apt -y install libopenmpi-dev
- name: Setup OpenMPI (macOS-12,13)
id: setup-openmpi-macos12
if: runner.os == 'macOS' && matrix.os != 'macos-11'
run: |
brew install openmpi
- 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, on mac we
#inject these via a brew keg later
- name: Configure build and install mcxtrace
id: mcxtrace-install
run: |
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" ]; then export EXTRA_ARGS_FOR_CMAKE="-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison -DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex"; fi
if [ "$RUNNER_OS" == "Linux" ]; 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 [ "$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"
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
python3 -mpip install PyYAML ply McStasscript
- 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
if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.os != 'macos-11') # Linux or macos-12/13 only
run: |
set -e
set -u
set -x
export MCXTRACE_EXECUTABLE="mcxtrace"
export MCXTRACE_PYGEN_EXECUTABLE="mcxtrace-pygen"
export MXRUN_EXECUTABLE="mxrun"
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} --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
if: runner.os == 'Linux' || runner.os == 'macOS' # Linux or macOS only
# 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/
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/Test_MCPL_input/Test_MCPL_input.instr .
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} Test_MCPL_input.instr repeat=10
- name: Launch MCPL test instrument (MPI)
id: mcpl-test-mpi
if: runner.os == 'Linux' || (runner.os == 'macOS' && matrix.os != 'macos-11') # Linux or macos-12/13 only
# 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/
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/Test_MCPL_input/Test_MCPL_input.instr .
../install_mcxtrace/bin/${MXRUN_EXECUTABLE} --mpi=2 Test_MCPL_input.instr repeat=20
- name: 'Tar output files'
id: tar-package
if: always()
run: |
set -e
set -u
set -x
tar cvfz mcxtrace-${{ matrix.os }}.${{ matrix.CC }}.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 }}.python-${{ matrix.python }}
path: "mcxtrace-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}_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