-
Notifications
You must be signed in to change notification settings - Fork 43
568 lines (491 loc) · 19.6 KB
/
ci.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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
name: GitHub Actions
on:
pull_request:
paths-ignore:
- '.github/workflows/run-custom-tests.yml'
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
paths-ignore:
- 'doc/**'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
# You should go up in number, if you go down (or repeat a previous value)
# you might end up reusing a previous cache if it haven't been deleted already.
# It applies 7 days retention policy by default.
RESET_EXAMPLES_CACHE: 6
API_CODE_CACHE: 3
DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com'
PACKAGE_NAME: 'ansys-fluent-core'
PACKAGE_NAMESPACE: 'ansys.fluent.core'
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
MAIN_PYTHON_VERSION: '3.9'
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1
PYFLUENT_SKIP_API_UPGRADE_ADVICE: 1
jobs:
docs-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pre-commit
run: python -m pip install pre-commit
- name: Run pre-commit for docformatter
run: pre-commit run --hook-stage manual --all-files --show-diff-on-failure docformatter
- name: Running Vale
uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: doc
reporter: github-pr-check
level: error
filter_mode: nofilter
fail_on_error: true
commit-style:
name: "Run commit style checks"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch-name-style:
name: "Run branch name style checks"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/[email protected]
test-import:
name: Build and Smoke tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
exclude:
- should-release: false
os: macos-latest
steps:
- name: Build wheelhouse and perform smoke test
uses: ansys/actions/build-wheelhouse@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
docs_build:
name: Build Documentation
needs: [docs-style]
runs-on: [self-hosted, pyfluent]
env:
DOC_DEPLOYMENT_IMAGE_TAG: v24.1.0
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install OS packages
run: |
sudo apt-get update
sudo apt-get install pandoc libegl1 make xvfb libfontconfig1 libxrender1 libxkbcommon-x11-0 -y
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}
- name: Install pyfluent
run: make install
- name: Retrieve PyFluent version
run: |
echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)"
id: version
- name: Cache API Code
uses: actions/cache@v4
id: cache-api-code
with:
path: |
src/ansys/fluent/core/datamodel_231
src/ansys/fluent/core/fluent_version_231.py
src/ansys/fluent/core/meshing/tui_231.py
src/ansys/fluent/core/solver/settings_231
src/ansys/fluent/core/solver/tui_231.py
doc/source/api/meshing/tui
doc/source/api/meshing/datamodel
doc/source/api/solver/tui
doc/source/api/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Login to GitHub Container Registry
if: steps.cache-api-code.outputs.cache-hit != 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ansys-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Fluent docker image
if: steps.cache-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Run API codegen
if: steps.cache-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Install again after codegen
run: |
rm -rf dist
make install > /dev/null
- name: Cache examples
uses: actions/cache@v4
with:
path: doc/source/examples
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('examples/**', 'doc/source/conf.py') }}
restore-keys: |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Build Source Documentation
run: |
pip install -r requirements/requirements_build.txt
poetry install --only docs
make build-doc-source
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Zip HTML Documentation before upload
run: |
sudo apt install zip -y
pushd doc/_build/html
zip -r ../../../HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip .
popd
- name: Upload HTML Documentation
uses: actions/upload-artifact@v4
with:
name: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
path: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip
retention-days: 7
build:
name: Build
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
needs: test-import
runs-on: [self-hosted, pyfluent]
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}
- name: Add version information
run: make version-info
- name: Install pyfluent
run: make install
- name: Retrieve PyFluent version
run: |
echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)"
id: version
- name: Cache 22.2 API Code
uses: actions/cache@v4
id: cache-222-api-code
with:
path:
src/ansys/fluent/core/datamodel_222
src/ansys/fluent/core/fluent_version_222.py
src/ansys/fluent/core/meshing/tui_222.py
src/ansys/fluent/core/solver/settings_222
src/ansys/fluent/core/solver/tui_222.py
src/ansys/fluent/core/data/api_tree_222.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v22.2.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v22.2.0
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ansys-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull 22.2 Fluent docker image
if: steps.cache-222-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v22.2.0
- name: Run 22.2 API codegen
if: steps.cache-222-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v22.2.0
- name: Print 22.2 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_222.py
python -c "from ansys.fluent.core.solver.settings_222 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 23.1 API Code
uses: actions/cache@v4
id: cache-231-api-code
with:
path:
src/ansys/fluent/core/datamodel_231
src/ansys/fluent/core/fluent_version_231.py
src/ansys/fluent/core/meshing/tui_231.py
src/ansys/fluent/core/solver/settings_231
src/ansys/fluent/core/solver/tui_231.py
src/ansys/fluent/core/data/api_tree_231.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.1.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.1.0
- name: Pull 23.1 Fluent docker image
if: steps.cache-231-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v23.1.0
- name: Run 23.1 API codegen
if: steps.cache-231-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v23.1.0
- name: Print 23.1 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_231.py
python -c "from ansys.fluent.core.solver.settings_231 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 23.2 API Code
uses: actions/cache@v4
id: cache-232-api-code
with:
path:
src/ansys/fluent/core/datamodel_232
src/ansys/fluent/core/fluent_version_232.py
src/ansys/fluent/core/meshing/tui_232.py
src/ansys/fluent/core/solver/settings_232
src/ansys/fluent/core/solver/tui_232.py
src/ansys/fluent/core/data/api_tree_232.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.2.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.2.0
- name: Pull 23.2 Fluent docker image
if: steps.cache-232-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v23.2.0
- name: Run 23.2 API codegen
if: steps.cache-232-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v23.2.0
- name: Print 23.2 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_232.py
python -c "from ansys.fluent.core.solver.settings_232 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 24.1 API Code
uses: actions/cache@v4
id: cache-241-api-code
with:
path:
src/ansys/fluent/core/datamodel_241
src/ansys/fluent/core/fluent_version_241.py
src/ansys/fluent/core/meshing/tui_241.py
src/ansys/fluent/core/solver/settings_241
src/ansys/fluent/core/solver/tui_241.py
src/ansys/fluent/core/data/api_tree_241.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.1.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.1.0
- name: Pull 24.1 Fluent docker image
if: steps.cache-241-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v24.1.0
- name: Run 24.1 API codegen
if: steps.cache-241-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v24.1.0
- name: Print 24.1 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_241.py
python -c "from ansys.fluent.core.solver.settings_241 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Cache 24.2 API Code
uses: actions/cache@v4
id: cache-242-api-code
with:
path:
src/ansys/fluent/core/datamodel_242
src/ansys/fluent/core/fluent_version_242.py
src/ansys/fluent/core/meshing/tui_242.py
src/ansys/fluent/core/solver/settings_242
src/ansys/fluent/core/solver/tui_242.py
src/ansys/fluent/core/data/api_tree_242.pickle
doc/source/api/core/meshing/tui
doc/source/api/core/meshing/datamodel
doc/source/api/core/solver/tui
doc/source/api/core/solver/datamodel
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.2.0-${{ hashFiles('codegen/**') }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.2.0
- name: Pull 24.2 Fluent docker image
if: steps.cache-242-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: v24.2.0
- name: Run 24.2 API codegen
if: steps.cache-242-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
FLUENT_IMAGE_TAG: v24.2.0
- name: Print 24.2 Fluent version info
run: |
cat src/ansys/fluent/core/fluent_version_242.py
python -c "from ansys.fluent.core.solver.settings_242 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
- name: Install again after codegen
run: |
rm -rf dist
make install > /dev/null
- name: Check package
run: |
pip install twine
twine check dist/*
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: PyFluent-packages
path: |
dist/*.whl
dist/*.tar.gz
retention-days: 7
test:
name: Unit Testing
if: ${{ always() }}
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image-tag: v22.2.0
version: 222
- image-tag: v23.1.0
version: 231
- image-tag: v23.2.0
version: 232
- image-tag: v24.1.0
version: 241
- image-tag: v24.2.0
version: 242
steps:
- uses: actions/checkout@v4
- name: Setup Python
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Download package
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
uses: actions/download-artifact@v4
with:
name: PyFluent-packages
path: dist
- name: Install pyfluent
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: pip install -q --force-reinstall dist/*.whl > /dev/null
- name: Retrieve PyFluent version
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: |
echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)"
id: version
- name: Login to GitHub Container Registry
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ansys-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Fluent docker image
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
- name: Unit Testing
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
run: |
make install-test
make unittest-dev-${{ matrix.version }}
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
- name: Upload 24.1 Coverage Artifacts
if: matrix.image-tag == 'v24.1.0'
uses: actions/upload-artifact@v4
with:
name: coverage_report
path: ./htmlcov
release:
name: Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- uses: actions/download-artifact@v4
- name: Display package file list
run: ls -R
- name: Upload to Private PyPi
run: |
pip install twine
python -m twine upload --skip-existing ./**/*.whl
python -m twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: PAT
TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload
- name: Upload to Public PyPi
run: |
pip install twine
twine upload --skip-existing ./**/*.whl
python -m twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.ANSYS_FLUENT_CORE_PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./**/*.whl
./**/*.tar.gz
./**/*-wheelhouse-*.zip