-
Notifications
You must be signed in to change notification settings - Fork 3
220 lines (184 loc) · 6.49 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
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.10'
PYFLUENT_TIMEOUT_FORCE_EXIT: 5
PYFLUENT_LAUNCH_CONTAINER: 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: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ['3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install OS packages
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install libegl1
- name: Install pyfluent-visualization
run: make install
- name: Test with pytest
run: make unittest
docs:
name: Documentation
needs: docs-style
runs-on: [self-hosted, pyfluent]
env:
DOC_DEPLOYMENT_IMAGE_TAG: v24.2.0
DOCUMENTATION_CNAME: 'visualization.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 OS packages
run: |
sudo apt update
sudo apt install pandoc libegl1
- name: Install pyfluent-visualization
run: make install
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.BOT_APPLICATION_ID }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Fluent docker image
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
- name: Retrieve pyfluent-visualization version
run: |
echo "::set-output name=PYFLUENT_VISUALIZATION_VERSION::$(python -c "from ansys.fluent.visualization import __version__; print(__version__)")"
echo "pyfluent-visualization version is: $(python -c "from ansys.fluent.visualization import __version__; print(__version__)")"
id: version
- name: Cache examples
uses: actions/cache@v4
with:
path: doc/source/examples
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VISUALIZATION_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('examples/**') }}-${{ github.sha }}
restore-keys: |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VISUALIZATION_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@v6
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, 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
needs: build
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
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_VISUALIZATION_PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./**/*.whl
./**/*.tar.gz