forked from open-atmos/PySDM
-
Notifications
You must be signed in to change notification settings - Fork 0
326 lines (311 loc) · 14.1 KB
/
tests.yml
File metadata and controls
326 lines (311 loc) · 14.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
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
name: tests
defaults:
run:
shell: bash
env:
# arbitrarily selected runs for generating animation
anim_python-version: '3.12'
anim_test-suite: 'multi-process_a'
# common options for pytest
pytest_options: "--durations=10 -v -s -We -p no:unraisableexception"
on:
push:
branches: [ main ]
paths-ignore: ['docs/**', '**.md']
pull_request:
branches: [ main ]
paths-ignore: ['docs/**', '**.md']
schedule:
- cron: '0 13 * * 4'
jobs:
env-unit-tests-setup:
strategy:
matrix:
platform: [ ubuntu-24.04, macos-15-intel, macos-14, windows-latest ]
python-version: [ "3.10", "3.12" ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4.1.6
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/env-setup
with:
python-version: ${{ matrix.python-version }}
setup-name: unit-tests-${{ matrix.platform }}-${{ matrix.python-version }}
env-nonunit-tests-setup:
strategy:
matrix:
platform: [ubuntu-24.04, macos-14, windows-latest]
python-version: ["3.12"]
include: # for pylint
- platform: ubuntu-24.04
python-version: "3.10"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4.1.6
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/env-setup
with:
python-version: ${{ matrix.python-version }}
setup-name: nonunit-tests-${{ matrix.platform }}-${{ matrix.python-version }}
pylint:
needs: env-nonunit-tests-setup
strategy:
matrix:
platform: [ubuntu-24.04]
python-version: ["3.10"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4.1.6
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/env-setup
with:
python-version: ${{ matrix.python-version }}
setup-name: nonunit-tests-${{ matrix.platform }}-${{ matrix.python-version }}
- run: |
# TODO #1160 https://github.com/pylint-dev/pylint/issues/9099
pip install "pylint<3.0.0" nbqa
- run: |
# TODO #682
pylint --unsafe-load-any-extension=y --disable=fixme,invalid-name,missing-function-docstring,missing-class-docstring,protected-access,duplicate-code $(git ls-files '*.py' | grep -v -e ^examples -e ^tutorials)
- run: |
# TODO #682
pylint --max-module-lines=550 --unsafe-load-any-extension=y --disable=fixme,too-many-function-args,unsubscriptable-object,consider-using-with,protected-access,too-many-statements,too-many-public-methods,too-many-branches,duplicate-code,invalid-name,missing-function-docstring,missing-module-docstring,missing-class-docstring,too-many-locals,too-many-instance-attributes,too-few-public-methods,too-many-arguments,c-extension-no-member $(git ls-files '*.py' | grep ^examples)
- run: |
# TODO #682
nbqa pylint --unsafe-load-any-extension=y --disable=fixme,duplicate-code,invalid-name,trailing-whitespace,line-too-long,missing-function-docstring,wrong-import-position,missing-module-docstring,wrong-import-order,ungrouped-imports,no-member,too-many-locals,unnecessary-lambda-assignment $(git ls-files '*.ipynb')
unit-tests-without-jit-plus-codecov:
needs: env-unit-tests-setup
strategy:
matrix:
platform: [ ubuntu-24.04, macos-15-intel, macos-14, windows-latest ]
python-version: [ "3.10", "3.12" ]
runs-on: ${{ matrix.platform }}
env:
NUMBA_DISABLE_JIT: 1
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4.1.6
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/env-setup
with:
python-version: ${{ matrix.python-version }}
setup-name: unit-tests-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Generate coverage report
run: |
python -m pip install pytest-cov
python -m pytest ${{ env.pytest_options }} tests/unit_tests --cov-report=xml --cov=PySDM
- uses: codecov/codecov-action@v4.5.0
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: PYTHON,RUNNER_OS
unit-tests-with-jit:
needs: [ pylint, unit-tests-without-jit-plus-codecov ]
strategy:
matrix:
platform: [ ubuntu-24.04, macos-14, windows-latest ]
python-version: [ "3.12" ]
test-suite: [ "unit_tests/!(dynamics)", "unit_tests/dynamics/!(condensation|collisions)", "unit_tests/dynamics/condensation", "unit_tests/dynamics/collisions" ]
exclude:
- platform: "macos-14"
test-suite: "unit_tests/!(dynamics)"
fail-fast: true
runs-on: ${{ matrix.platform }}
timeout-minutes: ${{ startsWith(matrix.platform, 'ubuntu-') && 25 || 40 }}
steps:
- uses: actions/checkout@v4.1.6
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/env-setup
with:
python-version: ${{ matrix.python-version }}
setup-name: unit-tests-${{ matrix.platform }}-${{ matrix.python-version }}
- if: startsWith(matrix.platform, 'ubuntu-')
run: echo NUMBA_THREADING_LAYER=omp >> $GITHUB_ENV
- name: Run pytest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUMBA_OPT: 1
run: |
shopt -s extglob
python -m pip install pytest-timeout
python -m pytest ${{ env.pytest_options }} --timeout=900 --timeout_method=thread tests/${{ matrix.test-suite }}
smoke-tests-with-jit:
needs: [ pylint, env-nonunit-tests-setup ]
strategy:
matrix:
platform: [ ubuntu-24.04, macos-14, windows-latest ]
python-version: [ "3.12" ]
test-suite:
- "tests/smoke_tests/no_env tests/smoke_tests/box tests/tutorials_tests"
- "tests/smoke_tests/parcel_a"
- "tests/smoke_tests/parcel_b"
- "tests/smoke_tests/parcel_c"
- "tests/smoke_tests/parcel_d"
- "tests/smoke_tests/kinematic_1d"
- "tests/smoke_tests/kinematic_2d"
include:
- platform: "macos-14"
python-version: "3.12"
test-suite: "tests/smoke_tests/parcel_b tests/smoke_tests/parcel_c tests/smoke_tests/parcel_d" # combined for macos
- platform: "macos-14"
python-version: "3.12"
test-suite: "tests/smoke_tests/no_env tests/tutorials_tests tests/smoke_tests/kinematic_2d tests/smoke_tests/kinematic_1d" # combined for macos
exclude:
# TODO #1406
- platform: "macos-14"
test-suite: "tests/smoke_tests/no_env tests/smoke_tests/box tests/tutorials_tests"
- platform: "macos-14"
test-suite: "tests/smoke_tests/parcel_a"
# test-suites already included in combined run
- platform: "macos-14"
test-suite: "tests/smoke_tests/kinematic_1d"
- platform: "macos-14"
test-suite: "tests/smoke_tests/kinematic_2d"
- platform: "macos-14"
test-suite: "tests/smoke_tests/parcel_b"
- platform: "macos-14"
test-suite: "tests/smoke_tests/parcel_c"
- platform: "macos-14"
test-suite: "tests/smoke_tests/parcel_d"
fail-fast: true
runs-on: ${{ matrix.platform }}
timeout-minutes: ${{ startsWith(matrix.platform, 'windows-') && 35 || 20 }}
steps:
- uses: actions/checkout@v4.1.6
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/env-setup
with:
python-version: ${{ matrix.python-version }}
setup-name: nonunit-tests-${{ matrix.platform }}-${{ matrix.python-version }}
- if: startsWith(matrix.platform, 'ubuntu-')
run: echo NUMBA_THREADING_LAYER=omp >> $GITHUB_ENV
- name: Run pytest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUMBA_OPT: 1
run: |
shopt -s extglob
python -m pip install pytest-timeout
python -m pytest ${{ env.pytest_options }} --timeout=900 --timeout_method=thread ${{ matrix.test-suite }}
examples:
needs: [pylint, env-nonunit-tests-setup]
strategy:
matrix:
platform: [ubuntu-24.04, macos-14, windows-latest]
python-version: ["3.12"]
test-suite:
- "isotopes_chemistry_extraterrestrial"
- "coagulation_freezing"
- "condensation_a"
- "condensation_b"
- "condensation_c"
- "multi-process_a"
- "multi-process_b"
- "multi-process_c_breakup"
- "multi-process_d"
- "multi-process_e"
include:
- platform: "macos-14"
python-version: "3.12"
test-suite: "multi-process_a,multi-process_b,multi-process_d,multi-process_e"
exclude:
- platform: "macos-14"
test-suite: "multi-process_a"
- platform: "macos-14"
test-suite: "multi-process_b"
- platform: "macos-14"
test-suite: "multi-process_d"
- platform: "macos-14"
test-suite: "multi-process_e"
fail-fast: true
runs-on: ${{ matrix.platform }}
timeout-minutes: ${{ startsWith(matrix.platform, 'windows-') && 28 || 30 }}
steps:
- name: Debug contexts
run: |
echo "MATRIX:"
printf '%s\n' "${{ toJson(matrix) }}"
echo "ENV:"
printf '%s\n' "${{ toJson(env) }}"
echo "anim_test-suite=${{ env.anim_test_suite }}, anim_python-version=${{ env.anim_python_version }}"
- uses: actions/checkout@v4.1.6
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/env-setup
with:
python-version: ${{ matrix.python-version }}
setup-name: nonunit-tests-${{ matrix.platform }}-${{ matrix.python-version }}
# https://github.com/numba/numba/issues/6350#issuecomment-728174860
- if: startsWith(matrix.platform, 'ubuntu-')
run: echo NUMBA_THREADING_LAYER=omp >> $GITHUB_ENV
- if: startsWith(matrix.platform, 'ubuntu-') && (contains(matrix.test-suite, 'multi-process_a') || contains(matrix.test-suite, 'multi-process_b'))
run: |
sudo apt-get update
sudo apt-get install libegl1 libopengl0 ghostscript ffmpeg
wget -nv "https://paraview.org/paraview-downloads/download.php?submit=Download&version=v5.13&type=binary&os=Linux&downloadFile=ParaView-5.13.1-egl-MPI-Linux-Python3.10-x86_64.tar.gz" -O paraview.tar.gz
tar xzf paraview.tar.gz
echo `pwd`/`dirname ParaView*/bin/pvpython` >> $GITHUB_PATH
- if: startsWith(matrix.platform, 'macos-') && (contains(matrix.test-suite, 'multi-process_a') || contains(matrix.test-suite, 'multi-process_b'))
run: |
brew update
brew install --cask paraview
echo `dirname /Applications/ParaView-*.app/Contents/bin/pvpython | head -1` >> $GITHUB_PATH
brew install ghostscript ffmpeg
- if: startsWith(matrix.platform, 'windows-') && (contains(matrix.test-suite, 'multi-process_a') || contains(matrix.test-suite, 'multi-process_b'))
run: |
curl "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v5.13&type=binary&os=Windows&downloadFile=ParaView-5.13.1-Windows-Python3.10-msvc2017-AMD64.msi" -o paraview.msi
msiexec //i paraview.msi //quiet //qn //norestart
echo "C:\\Program Files\\ParaView 5.13.1\\bin\\" >> $GITHUB_PATH
- if: contains(matrix.test-suite, 'multi-process_a') || contains(matrix.test-suite, 'multi-process_b')
run: |
pvpython --version
pvpython -c "from paraview import simple"
- run: |
python -m pytest ${{ env.pytest_options }} tests/examples_tests/test_tests_completeness.py
- run: |
python -m pip install pytest-timeout
python -m pytest ${{ env.pytest_options }} --basetemp=/tmp/pytest --timeout_method=thread --timeout=${{ startsWith(matrix.platform, 'windows-') && 1000 || 900 }} tests/examples_tests/test_run* --suite ${{ matrix.test-suite }}
- if: ( ! startsWith(matrix.platform, 'windows-') ) && contains(matrix.test-suite, env.anim_test-suite) && matrix.python-version == env.anim_python-version
run: |
set -x
mkdir -p $HOME/work/_temp/_github_home/figures
rm /tmp/pytest/test_run_notebooks_*current
ls /tmp/pytest/test_run_notebooks_*/
ls /tmp/pytest/test_run_notebooks_*/output/
ffmpeg -i /tmp/pytest/test_run_notebooks_*/output/docs_intro_animation.ogv -loop 0 -vf "fps=10,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" $HOME/work/_temp/_github_home/figures/docs_intro_animation_${{ matrix.platform }}.gif
mv /tmp/pytest/test_run_notebooks_*/output/last_animation_frame.pdf $HOME/work/_temp/_github_home/figures/last_animation_frame_${{ matrix.platform }}.pdf
ls $HOME/work/_temp/_github_home/figures
- name: animation movie upload
if: ( ! startsWith(matrix.platform, 'windows-') ) && contains(matrix.test-suite, env.anim_test-suite) && matrix.python-version == env.anim_python-version
uses: actions/upload-artifact@v4
with:
name: animation-movie-${{ matrix.platform }}
if-no-files-found: error
path: ~/work/_temp/_github_home/figures/*.gif
- name: animation frame upload
if: ( ! startsWith(matrix.platform, 'windows-') ) && contains(matrix.test-suite, env.anim_test-suite) && matrix.python-version == env.anim_python-version
uses: actions/upload-artifact@v4
with:
name: animation-frame-${{ matrix.platform }}
if-no-files-found: error
path: ~/work/_temp/_github_home/figures/*.pdf
- name: tip release upload
if: github.ref == 'refs/heads/main' && ( startsWith(matrix.platform, 'ubuntu-') ) && contains(matrix.test-suite, env.anim_test-suite) && matrix.python-version == env.anim_python-version
uses: eine/tip@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: /github/home/figures/*.gif