-
Notifications
You must be signed in to change notification settings - Fork 12
243 lines (212 loc) · 8.23 KB
/
ci.yml
File metadata and controls
243 lines (212 loc) · 8.23 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
name: CI
# run only on main branch. This avoids duplicated actions on PRs
on:
pull_request:
push:
tags:
- "*"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAIN_PYTHON_VERSION: "3.13"
PACKAGE_NAME: "ansys-workbench-core"
DOCUMENTATION_CNAME: 'workbench.docs.pyansys.com'
permissions: {}
jobs:
code-style:
name: "Code style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/code-style@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-style:
name: "Documentation Style Check"
runs-on: ubuntu-latest
steps:
- name: "Running documentation style checks"
uses: ansys/actions/doc-style@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
vulnerabilities:
name: "Vulnerabilities"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/check-vulnerabilities@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
python-package-name: ${{ env.PACKAGE_NAME }}
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
dev-mode: ${{ github.ref != 'refs/heads/main' }}
actions-security:
name: "Check actions security"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/check-actions-security@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
generate-summary: true
token: ${{ secrets.GITHUB_TOKEN }}
auditing-level: 'high'
trust-ansys-actions: true
update-changelog:
name: "Update CHANGELOG (on release)"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write # needed to create changelog entry in the repo
pull-requests: write # needed to create pull request for the changelog update
steps:
- uses: ansys/actions/doc-deploy-changelog@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
doc-build:
name: "Build documentation"
runs-on: ubuntu-latest
needs: [doc-style]
steps:
- uses: ansys/actions/doc-build@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
needs-quarto: true
build-wheelhouse:
name: "Build wheelhouse for latest Python versions"
runs-on: ${{ matrix.os }}
needs: [code-style]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.11', '3.12', '3.13', '3.14']
steps:
- name: "Build a wheelhouse for ${{ matrix.python-version }}"
uses: ansys/actions/build-wheelhouse@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
unit-tests:
name: "Test library"
runs-on: [self-hosted, pyworkbench]
needs: [build-wheelhouse]
steps:
- name: "Checkout project"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Setup Python"
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Install dependencies"
run: |
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install .[tests]
- name: "Run tests"
run: |
.venv\Scripts\Activate.ps1
pytest -vv
- name: "Upload coverage report"
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: coverage-html
path: .cov/html
- name: "Clean tasks"
if: ${{ always() }}
run: |
$processNames = @("ANSYS", "ANSYS241", "AnsysWBU", "AnsysFWW", "RunWB2")
$foundAnyProcess = $false
foreach ($processName in $processNames) {
$process = Get-Process -Name $processName -ErrorAction SilentlyContinue
if ($process) {
$process | Stop-Process -Force
$foundAnyProcess = $true
} else {
Write-Output "No process named '$processName' was found."
}
}
if (-not $foundAnyProcess) {
Write-Output "No specified processes were found."
}
- name: "Remove temporary folders"
if: ${{ always() }}
run: |
Get-ChildItem -Path "C:\Users\ansys\AppData\Local\Temp" -Directory -Filter "act_tmp*" | Remove-Item -Recurse -Force
Get-ChildItem -Path "C:\Users\ansys\AppData\Local\Temp" -Directory -Filter "WB_ansys*" | Remove-Item -Recurse -Force
continue-on-error: true # ignore locked files
build-library:
name: "Build library"
runs-on: ubuntu-latest
needs: [unit-tests, doc-build]
steps:
- uses: ansys/actions/build-library@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build-library, update-changelog]
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
id-token: write # needed to authenticate during release
contents: write # needed to create GitHub releases and upload assets
steps:
- name: Release to the private PyPI repository
uses: ansys/actions/release-pypi-private@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
- name: "Download the library artifacts from build-library step"
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }}-artifacts
path: ${{ env.PACKAGE_NAME }}-artifacts
- name: "Upload artifacts to PyPI using trusted publisher"
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: "https://upload.pypi.org/legacy/"
print-hash: true
packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
skip-existing: false
- name: Release to GitHub
uses: ansys/actions/release-github@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
library-name: ${{ env.PACKAGE_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: false
add-artifact-attestation-notes: true
doc-deploy-dev:
name: "Deploy development documentation"
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: doc-build
permissions:
contents: write # needed to push documentation commit
steps:
- uses: ansys/actions/doc-deploy-dev@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
doc-deploy-stable:
name: "Deploy stable docs"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}