-
Notifications
You must be signed in to change notification settings - Fork 64
287 lines (267 loc) · 9.98 KB
/
mcxtrace-conda-basictest.yml
File metadata and controls
287 lines (267 loc) · 9.98 KB
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
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: Get conda dependency list
id: conda-deps
run: |
./src/devel/bin/mccode-create-conda-yml -m mcxtrace -n mcxtrace -o dependencies.yml
cat dependencies.yml
- name: Update conda
id: update-conda
run: |
conda install mamba -y
mamba env update --file dependencies.yml
- 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