11
11
branches :
12
12
- main
13
13
14
+ env :
15
+ MAIN_PYTHON_VERSION : ' 3.10'
16
+ LIBRARY_NAME : ' ansys-openapi-common'
17
+
14
18
jobs :
15
19
code-style :
16
20
name : " Code style"
17
21
runs-on : windows-latest
18
22
steps :
19
23
- uses : ansys/actions/code-style@v5
20
24
with :
21
- python-version : " 3.10 "
25
+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
22
26
skip-install : " false"
23
27
24
- docs -style :
28
+ doc -style :
25
29
name : Documentation Style Check
26
30
runs-on : ubuntu-latest
27
31
steps :
30
34
with :
31
35
token : ${{ secrets.GITHUB_TOKEN }}
32
36
33
- test :
37
+ doc-build :
38
+ name : Build Documentation
39
+ runs-on : ubuntu-latest
40
+ needs : doc-style
41
+
42
+ steps :
43
+ - name : " Checkout the repository"
44
+ uses : actions/checkout@v4
45
+
46
+ - name : " Set up Python"
47
+ uses : actions/setup-python@v5
48
+ with :
49
+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
50
+
51
+ - name : " Install system dependencies"
52
+ run : |
53
+ sudo apt-get update && sudo apt-get install pandoc libkrb5-dev
54
+
55
+ - name : " Install Python dependencies"
56
+ run : |
57
+ python -m pip install --upgrade pip tox
58
+ python -m pip install poetry~=1.7.0
59
+
60
+ - name : Install library
61
+ run : |
62
+ poetry install --with docs --extras "oidc linux-kerberos"
63
+
64
+ - name : Build HTML
65
+ run : make -C doc html SPHINXOPTS="-W"
66
+
67
+ - name : Build PDF Documentation
68
+ run : |
69
+ sudo apt update
70
+ sudo apt-get install -y texlive-latex-extra latexmk texlive-xetex fonts-freefont-otf xindy
71
+ make -C doc latexpdf
72
+
73
+ - name : Upload HTML Documentation
74
+ uses : actions/upload-artifact@v4
75
+ with :
76
+ name : documentation-html
77
+ path : doc/build/html
78
+ retention-days : 7
79
+
80
+ - name : Upload PDF Documentation
81
+ uses : actions/upload-artifact@v4
82
+ with :
83
+ name : documentation-pdf
84
+ path : doc/build/latex/*.pdf
85
+ retention-days : 7
86
+
87
+ smoke-tests :
88
+ name : " Build wheelhouse for latest Python versions"
89
+ runs-on : ${{ matrix.os }}
90
+ needs : code-style
91
+ strategy :
92
+ matrix :
93
+ os : [ubuntu-latest, windows-latest]
94
+ python-version : ['3.9', '3.10', '3.11', '3.12']
95
+ steps :
96
+ - name : Install kerberos headers
97
+ if : matrix.os == "ubuntu-latest"
98
+ run : |
99
+ sudo apt-get update
100
+ sudo apt install libkrb5-dev
101
+
102
+ - uses : ansys/actions/build-wheelhouse@v5
103
+ with :
104
+ library-name : ${{ env.LIBRARY_NAME }}
105
+ operating-system : ${{ matrix.os }}
106
+ python-version : ${{ matrix.python-version }}
107
+
108
+ tests :
34
109
name : Unit test on supported platforms
35
110
runs-on : ubuntu-latest
111
+ needs : smoke-tests
36
112
services :
37
113
# Label used to access the service container
38
114
kdc-server :
@@ -83,97 +159,44 @@ jobs:
83
159
fail_ci_if_error : true
84
160
token : ${{ secrets.CODECOV_TOKEN }}
85
161
86
- build :
87
- name : Build
162
+ build-library :
163
+ name : " Build library "
88
164
runs-on : ubuntu-latest
89
-
165
+ needs : [ doc-build, tests ]
90
166
steps :
91
- - uses : actions/checkout@v4
92
- - name : Setup Python
93
- uses : actions/setup-python@v5
94
- with :
95
- python-version : ' 3.10'
96
-
97
167
- name : Install kerberos headers
98
168
run : |
99
169
sudo apt-get update
100
170
sudo apt install libkrb5-dev
101
171
102
- - name : Create wheel
103
- run : |
104
- pip install poetry
105
- poetry build
106
-
107
- - name : Validate wheel
108
- run : |
109
- pip install twine
110
- twine check dist/*
111
-
112
- - name : Upload wheel
113
- uses : actions/upload-artifact@v4
172
+ - uses : ansys/actions/build-library@v5
114
173
with :
115
- name : ansys-grantami-common-wheel
116
- path : dist/
117
- retention-days : 7
174
+ library-name : ${{ env.LIBRARY_NAME }}
175
+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
118
176
119
- docs :
120
- name : Build Documentation
177
+ release :
178
+ if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
179
+ needs : [build-library]
121
180
runs-on : ubuntu-latest
122
-
123
181
steps :
124
- - uses : actions/checkout@v4
125
- - name : Setup Python
126
- uses : actions/setup-python@v5
127
- with :
128
- python-version : ' 3.10'
129
-
130
- - name : Install kerberos headers
131
- run : |
132
- sudo apt-get update
133
- sudo apt install libkrb5-dev
134
-
135
- - name : Install library
136
- run : |
137
- pip install poetry
138
- poetry config installer.modern-installation false
139
- poetry install --with docs --extras "oidc linux-kerberos"
140
-
141
- - name : Build HTML
142
- run : make -C doc html SPHINXOPTS="-W"
143
-
144
- - name : Build PDF Documentation
145
- run : |
146
- sudo apt update
147
- sudo apt-get install -y texlive-latex-extra latexmk texlive-xetex fonts-freefont-otf xindy
148
- make -C doc latexpdf
149
-
150
- - name : Upload HTML Documentation
151
- uses : actions/upload-artifact@v4
182
+ - uses : ansys/actions/release-pypi-public@v5
183
+ name : " Release to public PyPI"
152
184
with :
153
- name : Documentation-html
154
- path : doc/build/html
155
- retention-days : 7
185
+ library- name : ${{ env.LIBRARY_NAME }}
186
+ twine-username : " __token__ "
187
+ twine-token : ${{ secrets.PYPI_TOKEN }}
156
188
157
- - name : Upload PDF Documentation
158
- uses : actions/upload-artifact@v4
189
+ - uses : ansys/actions/release-github@v5
190
+ name : " Release to GitHub "
159
191
with :
160
- name : Documentation-pdf
161
- path : doc/build/latex/*.pdf
162
- retention-days : 7
192
+ library-name : ${{ env.LIBRARY_NAME }}
163
193
164
- Release :
165
- if : contains(github.ref, 'refs/tags')
166
- needs : [build, test, code-style, docs]
194
+ doc-deploy-stable :
195
+ name : " Deploy stable documentation"
167
196
runs-on : ubuntu-latest
197
+ needs : release
198
+ if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
168
199
steps :
169
- - name : Set up Python
170
- uses : actions/setup-python@v5
171
- with :
172
- python-version : ' 3.10'
173
-
174
- - uses : actions/checkout@v4
175
-
176
- # used for documentation deployment
177
200
- name : Get Bot Application Token
178
201
id : get_workflow_token
179
202
uses : peter-murray/workflow-application-token-action@v3
@@ -183,17 +206,7 @@ jobs:
183
206
184
207
- uses : actions/download-artifact@v4
185
208
with :
186
- name : ansys-grantami-common-wheel
187
- path : ~/dist
188
-
189
- - uses : actions/download-artifact@v4
190
- with :
191
- name : Documentation-pdf
192
- path : ~/pdf
193
-
194
- - uses : actions/download-artifact@v4
195
- with :
196
- name : Documentation-html
209
+ name : documentation-html
197
210
path : ~/html
198
211
199
212
- name : Deploy
@@ -204,21 +217,3 @@ jobs:
204
217
BRANCH : gh-pages
205
218
FOLDER : ~/html
206
219
CLEAN : true
207
-
208
- # note how we use the PyPI tokens
209
- - name : Upload to PyPi
210
- run : |
211
- pip install twine
212
- twine upload --non-interactive --skip-existing ~/**/*.whl
213
- env :
214
- TWINE_USERNAME : __token__
215
- TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
216
-
217
- - name : Release
218
- uses : softprops/action-gh-release@v1
219
- with :
220
- generate_release_notes : true
221
- files : |
222
- ./**/*.whl
223
- ./**/*.zip
224
- ./**/*.pdf
0 commit comments