forked from mccode-dev/McCode
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (117 loc) · 4.1 KB
/
mcstas-conda-testsuite.yml
File metadata and controls
131 lines (117 loc) · 4.1 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
name: mcstas-conda-testsuite
on:
schedule:
- cron: '00 02 * * *' # 02:00 every day
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
- 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: mcstas
auto-update-conda: true
conda-remove-defaults: true
channels: conda-forge
python-version: ${{ matrix.python }}
- name: Setup conda
id: setup-conda
run: |
./src/devel/bin/mccode-create-conda-yml -m mcstas -n mcstas -o dependencies.yml
conda env update --file dependencies.yml
echo DONE
- 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 mcstas
id: mcstas-install
run: |
./src/devel/bin/mccode-build-conda -m mcstas -s $PWD/src -b $PWD/build_mcstas
- 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/mcstas/tools/Python/mccodelib/mccode_config.json
fi
- name: Test suite, up to 2-core MPI
id: test-suite
run: |
# Create and cd to directory for test output data
mkdir run_test-suite && cd run_test-suite
# Test script name
export MCTEST_EXECUTABLE="mctest"
if [ "$RUNNER_OS" == "Windows" ];
then
export MCTEST_EXECUTABLE="mctest.bat"
fi
# Workaround for warning about "too long" tmpdir name on macOS/openmpi
if [ "$RUNNER_OS" == "macOS" ];
then
mkdir ${HOME}/tmp
export TMPDIR=${HOME}/tmp
fi
# Run the test with 2 core mpi
${MCTEST_EXECUTABLE} --verbose --testdir $PWD --suffix ${{ matrix.os }}_${{ matrix.mpi }} --mpi=2
- 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 mcstas-${{ matrix.os }}.${{ matrix.mpi }}.python-${{ matrix.python }}_output.tgz run_test-suite
- name: 'Upload Artifact'
id: tar-upload
uses: actions/upload-artifact@v4
if: always()
with:
name: mcstas-artefacts-${{ matrix.os }}.${{ matrix.mpi }}.python-${{ matrix.python }}
path: "mcstas-${{ 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