-
Notifications
You must be signed in to change notification settings - Fork 6
283 lines (242 loc) · 8.22 KB
/
ci_cd.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
name: GitHub CI
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
- release/*
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: 0
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
MAIN_PYTHON_VERSION: '3.9'
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: 'DEBUG'
PYFLUENT_WATCHDOG_DEBUG: 'OFF'
PYFLUENT_HIDE_LOG_SECRETS: 1
jobs:
docs-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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
vale_flags: "--config=doc/.vale.ini"
tests:
name: Tests and coverage
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
- image-tag: v25.1.0
version: 251
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install pyfluent-parametric
run: make install
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.REPO_DOWNLOAD_PAT }}
- name: Pull Fluent docker image
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
- name: Test with pytest
run: make unittest-${{ matrix.version }}
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
tests-self-hosted:
name: Self-hosted tests and coverage
runs-on: [self-hosted, pyfluent]
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
- image-tag: v25.1.0
version: 251
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install pyfluent-parametric
run: make install
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.REPO_DOWNLOAD_PAT }}
- name: Pull Fluent docker image
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
- name: Test with pytest
run: make unittest-self-hosted-${{ matrix.version }}
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
docs:
name: Documentation
needs: [docs-style]
runs-on: [self-hosted, pyfluent]
env:
DOC_DEPLOYMENT_IMAGE_TAG: v24.2.0
DOCUMENTATION_CNAME: 'parametric.fluent.docs.pyansys.com'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install pyfluent-parametric
run: make install
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.REPO_DOWNLOAD_PAT }}
- name: Pull Fluent docker image
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Retrieve pyfluent-parametric version
run: |
echo "::set-output name=PYFLUENT_PARAMETRIC_VERSION::$(python -c "from ansys.fluent.parametric import __version__; print(__version__)")"
echo "pyfluent-parametric version is: $(python -c "from ansys.fluent.parametric import __version__; print(__version__)")"
id: version
- name: Cache examples
uses: actions/cache@v3
with:
path: doc/source/examples
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_PARAMETRIC_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('examples/**') }}-${{ github.sha }}
restore-keys: |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_PARAMETRIC_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('examples/**') }}
- name: Generate the documentation
run: make build-doc
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Upload HTML Documentation
uses: actions/upload-artifact@v4
with:
name: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
path: doc/_build/html
retention-days: 7
- name: Deploy
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev')
uses: ansys/actions/doc-deploy-stable@v5
with:
doc-artifact-name: 'HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}'
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build library
needs: [tests, tests-self-hosted, docs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Add version information
run: make version-info
- name: Install dependencies and build the library
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements/requirements_build.txt
python -m build
python -m twine check dist/*
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: PyFluent-packages
path: |
dist/*.whl
dist/*.tar.gz
retention-days: 7
release:
name: Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: build
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_PARAMETRIC_PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./**/*.whl
./**/*.tar.gz