-
Notifications
You must be signed in to change notification settings - Fork 0
380 lines (365 loc) · 15.4 KB
/
test-suite.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
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
name: Test of package installation & execution
'on':
push:
branches-ignore:
- gh-pages
tags:
- '*'
schedule:
- cron: 0 10 * * 1
jobs:
build_cpp:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-install: [pip, conda]
install-zmq: [true, false]
install-mpi: [true]
with-coverage: [false, true]
with-asan: [false]
with-elf: [false]
with-valgrind: [false]
exclude:
- python-install: conda
with-coverage: false
- python-install: pip
with-coverage: true
- os: windows-latest
install-zmq: false
- os: windows-latest
with-asan: true
- python-install: conda
install-zmq: false
- python-install: conda
install-mpi: false
- python-install: conda
with-asan: true
include:
- os: ubuntu-latest
python-install: pip
install-zmq: true
install-mpi: true
with-coverage: true
with-asan: false
with-elf: true
with-valgrind: false
- os: ubuntu-latest
python-install: pip
install-zmq: true
install-mpi: false
with-coverage: true
with-asan: false
with-elf: true
with-valgrind: false
- os: macos-latest
python-install: pip
install-zmq: true
install-mpi: false
with-coverage: false
with-asan: true
with-elf: true
with-valgrind: false
- os: ubuntu-latest
python-install: pip
install-zmq: true
install-mpi: false
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: true
- os: macos-latest
python-install: pip
install-zmq: true
install-mpi: false
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: true
fail-fast: false
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
submodules: true
###################################
# PIP SETUP
###################################
- name: Install dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest' && matrix.python-install == 'pip'
run: |
sudo apt-get update
sudo apt-get install -y libc6-dbg gdb valgrind lcov libcmocka-dev
sudo apt upgrade --fix-missing
valgrind --version
- name: Install dependencies on Mac
if: matrix.os == 'macos-latest' && matrix.python-install == 'pip'
run: |
brew install llvm cmocka lcov gnutls
- name: Install dependencies on Windows
if: matrix.os == 'windows-latest' && matrix.python-install == 'pip'
run: |
vcpkg.exe install cmocka --triplet x64-windows
# ZeroMQ dependencies
- name: Install ZeroMQ
if: matrix.os == 'ubuntu-latest' && matrix.install-zmq && matrix.python-install == 'pip'
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev libgomp1
sudo apt upgrade --fix-missing
- name: Install ZeroMQ
if: matrix.os == 'macos-latest' && matrix.install-zmq && matrix.python-install == 'pip'
run: |
brew install zeromq libomp
- name: Install ZeroMQ
if: matrix.os == 'windows-latest' && matrix.install-zmq && matrix.python-install == 'pip'
run: |
vcpkg.exe install zeromq --triplet x64-windows
# MPI dependencies
- name: Install MPI dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest' && matrix.install-mpi && matrix.python-install == 'pip'
run: |
sudo apt-get update
sudo apt-get install -y mpich
sudo apt upgrade --fix-missing
- name: Install MPI dependencies on Mac
if: matrix.os == 'macos-latest' && matrix.install-mpi && matrix.python-install == 'pip'
run: |
brew install open-mpi
# - name: MPI dependencies on Windows
# if: matrix.os == 'windows-latest' && matrix.install-mpi && matrix.python-install == 'pip'
# run: |
# vcpkg.exe install msmpi --triplet x64-windows
- name: Setup Python
if: matrix.python-install == 'pip'
id: pysetup
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Fix Python path on mac
if: matrix.os == 'macos-latest' && matrix.python-install == 'pip'
run: |
tee -a ~/.profile <<<'export PATH="${pythonLocation}/bin:${PATH}"'
- name: Install Python dependencies
if: matrix.python-install == 'pip'
run: |
python -m pip install -r requirements.txt
python -m pip install -r requirements-test.txt
###################################
# CONDA SETUP
###################################
- name: Set up MSVC Compiler on windows
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest' && matrix.python-install == 'conda'
with:
toolset: 14.0
- name: Set up miniconda test environment
if: matrix.python-install == 'conda'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: yggdrasil
environment-file: environment.yml
auto-update-conda: true
channels: conda-forge
channel-priority: strict
- name: Install LLVM on mac for OpenMP
if: matrix.os == 'macos-latest' && matrix.python-install == 'conda'
run: |
conda install llvm -y
###################################
# SET CONFIG FLAGS
###################################
- name: Global config flags
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=-DYGG_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_PYTHON_LIBRARY=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" >> "$GITHUB_ENV"
echo "TEST_FLAGS=-C Debug --output-on-failure -VV" >> "$GITHUB_ENV"
echo "PYTHON_CMAKE_ARGS=" >> "$GITHUB_ENV"
- name: Coverage config flags
if: matrix.with-coverage == true
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_ENABLE_COVERAGE=ON" >> "$GITHUB_ENV"
- name: ASAN config flags
if: matrix.with-asan == true
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_BUILD_ASAN=ON -DYGG_BUILD_UBSAN=ON -DYGGDRASIL_DISABLE_PYTHON_C_API=ON" >> "$GITHUB_ENV"
echo "PYTHON_CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }} -DYGG_BUILD_ASAN=ON -DYGG_BUILD_UBSAN=ON" >> "$GITHUB_ENV"
echo "ASAN_OPTIONS=detect_odr_violation=0:detect_container_overflow=0" >> $GITHUB_ENV
echo "TEST_FLAGS=${{ env.TEST_FLAGS }} -E valgrind*" >> "$GITHUB_ENV"
- name: ASAN dynamic library
if: matrix.with-asan == true && matrix.os == 'macos-latest'
shell: bash -l {0}
run: |
echo "DYLD_INSERT_LIBRARIES=$(clang -print-file-name=libclang_rt.asan_osx_dynamic.dylib)" >> "$GITHUB_ENV"
- name: ELF config flags
if: matrix.with-elf == false
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_ENABLE_ELF=OFF" >> "$GITHUB_ENV"
- name: Valgrind on config flags
if: matrix.with-valgrind == true
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_ENABLE_INSTRUMENTATION_OPT=OFF -DYGGDRASIL_DISABLE_PYTHON_C_API=ON" >> "$GITHUB_ENV"
- name: Valgrind off config flags
if: matrix.with-valgrind == false
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_SKIP_VALGRIND_TESTS=ON" >> "$GITHUB_ENV"
- name: Pip config flags
if: matrix.python-install == 'pip'
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DPython3_ROOT_DIR=${{ env.pythonLocation }}" >> "$GITHUB_ENV"
# echo "PYTHON_CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }} -DPython3_ROOT_DIR=${{ env.pythonLocation }}" >> "$GITHUB_ENV"
- name: Conda config flags
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DCMAKE_PREFIX_PATH=${CONDA_PREFIX}" >> "$GITHUB_ENV"
# echo "PYTHON_CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }} -DCMAKE_PREFIX_PATH=${CONDA_PREFIX}" >> "$GITHUB_ENV"
- name: Pip config flags on Windows
if: matrix.python-install == 'pip' && matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} \"-DCMAKE_PREFIX_PATH=${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\"" >> "$GITHUB_ENV"
# echo "PYTHON_CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }} \"-DCMAKE_PREFIX_PATH=${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\"" >> "$GITHUB_ENV"
echo "PYTHON_CONFIG_FLAGS=${{ env.PYTHON_CONFIG_FLAGS }} --config-settings=cmake.define.CMAKE_PREFIX_PATH=${VCPKG_INSTALLATION_ROOT}\installed\x64-windows --config-settings=cmake.define.Python3_ROOT_DIR=${{ env.pythonLocation }} --config-settings=cmake.define.Python_ROOT_DIR=${{ env.pythonLocation }}" >> "$GITHUB_ENV"
# echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} \"-DPython3_EXECUTABLE=${{ env.pythonLocation }}\python.exe\" \"-DCMAKE_PREFIX_PATH=${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\"" >> "$GITHUB_ENV"
###################################
# Add paths for Windows dlls
###################################
- name: Vcpkg library paths on Windows
if: matrix.python-install == 'pip' && matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
# DLL_DIRECTORY="${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin"
DLL_DIRECTORY="${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\debug\bin"
ls ${DLL_DIRECTORY}
echo "${DLL_DIRECTORY}" >> $GITHUB_PATH
- name: Conda library paths on Windows
if: matrix.python-install == 'conda' && matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
DLL_DIRECTORY="${CONDA_PREFIX}/Library/lib"
ls ${DLL_DIRECTORY}
echo "${DLL_DIRECTORY}" >> $GITHUB_PATH
###################################
# Check
###################################
- name: Check for numpy (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
python -c "import sys; print(sys.executable)"
python -c "import numpy; print(numpy.get_include())"
- name: Check for numpy (PIP)
if: matrix.python-install == 'pip'
run: |
python -c "import sys; print(sys.executable)"
python -c "import numpy; print(numpy.get_include())"
###################################
# Configure
###################################
- name: Configure (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
mkdir build
cd build
cmake .. ${{ env.CONFIG_FLAGS }}
- name: Configure (PIP)
if: matrix.python-install == 'pip'
run: |
mkdir build
cd build
cmake .. ${{ env.CONFIG_FLAGS }}
###################################
# Build CPP & C
###################################
- name: Build C++ & C (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
cd build
cmake --build . --config Debug
- name: Build C++ & C (PIP)
if: matrix.python-install == 'pip'
run: |
cd build
cmake --build . --config Debug
###################################
# Build Python
###################################
- name: Set CMAKE_ARGS for Python build
shell: bash -l {0}
run: |
echo "CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }}" >> "$GITHUB_ENV"
- name: Build Python (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
pip install . -v ${{ env.PYTHON_CONFIG_FLAGS }}
- name: Build Python (PIP)
if: matrix.python-install == 'pip'
run: |
pip install . -v ${{ env.PYTHON_CONFIG_FLAGS }}
###################################
# Test CPP & C
###################################
- name: Test C++ & C Interfaces (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
cd build
ctest ${{ env.TEST_FLAGS }}
- name: Test C++ & C Interfaces (PIP)
if: matrix.python-install == 'pip'
run: |
cd build
# echo "PATH=${PATH}"
ctest ${{ env.TEST_FLAGS }}
###################################
# Test Python
###################################
- name: Test Python Interfaces (CONDA)
if: matrix.python-install == 'conda' && matrix.with-elf == false && matrix.with-valgrind == false
shell: bash -l {0}
run: |
pytest -sv python/test
# - name: Check for Python Interfaces (PIP)
# # if: matrix.python-install == 'pip' && matrix.with-asan == false && matrix.with-elf == false && matrix.with-valgrind == false
# if: matrix.python-install == 'pip' && matrix.with-elf == false && matrix.with-valgrind == false
# shell: bash -l {0}
# run: |
# PYTHON_EXEC=${{ steps.pysetup.outputs.python-path }}
# ${PYTHON_EXEC} -m site
# ${PYTHON_EXEC} -c 'import site; print(site.getsitepackages())'
# ls $(${PYTHON_EXEC} -c 'import site; print(site.getsitepackages()[0])')
# ls $(${PYTHON_EXEC} -c 'import os; import site; print(os.path.join(site.getsitepackages()[0], "pyYggdrasil"))')
# - name: Test Python Interfaces w/ LLDB (PIP)
# if: matrix.python-install == 'pip' && matrix.with-elf == false && matrix.with-valgrind == false && matrix.os == 'macos-latest'
# run: |
# lldb -o 'run' -o 'quit' -- $(which python) -m pytest -svx python/test
# - name: Test Python Interfaces w/ GDB (PIP)
# if: matrix.python-install == 'pip' && matrix.with-elf == false && matrix.with-valgrind == false && matrix.os == 'ubuntu-latest'
# run: |
# gdb --batch -x gdb_commands.txt --args $(which python) -m pytest -svx python/test
- name: Test Python Interfaces (PIP)
if: matrix.python-install == 'pip' && matrix.with-elf == false && matrix.with-valgrind == false
run: |
pytest -sv python/test
###################################
# Coverage
###################################
- name: Upload coverage report
if: matrix.with-coverage == true
uses: codecov/codecov-action@v3
with:
name: ${{ matrix.os }}-${{ matrix.python-install }}-${{ matrix.install-zmq }}-${{ matrix.install-mpi }}-${{ matrix.with-coverage }}-${{ matrix.with-asan }}-${{ matrix.with-elf }}-${{ matrix.with-valgrind }}
token: ${{ secrets.CODECOV_TOKEN }}
file: build/coverage/coverage.info
# directory: build/Testing/CoverageInfo
functionalities: gcov