Skip to content

Commit edf86d5

Browse files
authored
Merge branch 'main' into dependabot/pip/requirements/build-1.3.0
2 parents 81b1194 + 9edb5f8 commit edf86d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2823
-935
lines changed

.ci/code_generation.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,36 @@
1111
core.set_default_server_context(core.AvailableServerContexts.premium)
1212
core.start_local_server(config=core.AvailableServerConfigs.LegacyGrpcServer)
1313

14+
files_to_keep = {
15+
"operator.mustache": "",
16+
"build.py": "",
17+
"specification.py": "",
18+
"translator.py": "",
19+
# Deprecated operator scripting names
20+
"result": [
21+
"gasket_deformation.py",
22+
"gasket_deformation_X.py",
23+
"gasket_deformation_XY.py",
24+
"gasket_deformation_XZ.py",
25+
],
26+
}
27+
1428
local_dir = Path(__file__).parent
1529
TARGET_PATH = local_dir.parent / "src" / "ansys" / "dpf" / "core" / "operators"
1630
files = TARGET_PATH.glob("*")
1731
for file_path in files:
18-
if file_path.stem == "specification":
19-
continue
20-
if file_path.stem == "translator":
21-
continue
22-
if file_path.name == "build.py":
32+
if file_path.is_file() and (file_path.name in files_to_keep):
2333
continue
24-
if file_path.name == "operator.mustache":
25-
continue
26-
try:
27-
if file_path.is_dir():
28-
shutil.rmtree(file_path)
34+
if file_path.is_dir():
35+
shutil.rmtree(file_path / "__pycache__", ignore_errors=True)
36+
if file_path.name in files_to_keep:
37+
sub_files = file_path.glob("*")
38+
for sub_file in sub_files:
39+
if sub_file.name not in files_to_keep[file_path.name]:
40+
sub_file.unlink()
2941
else:
30-
file_path.unlink()
31-
except:
32-
pass
42+
shutil.rmtree(file_path)
43+
else:
44+
file_path.unlink()
3345

3446
build.build_operators()

.github/workflows/ci.yml

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened, ready_for_review, closed, labeled]
5+
types: [opened, synchronize, reopened, ready_for_review]
66
branches-ignore:
77
- '*no-ci*'
88
push:
@@ -31,16 +31,14 @@ env:
3131
jobs:
3232
debug:
3333
runs-on: ubuntu-latest
34-
if: github.event.action != 'closed'
3534
steps:
36-
- name: Show the Github context for the triggered event
35+
- name: Show the GitHub context for the triggered event
3736
run: echo "$GITHUB_CONTEXT"
3837
env:
3938
GITHUB_CONTEXT: ${{ toJson(github) }}
4039

4140
pick_server_suffix:
4241
runs-on: ubuntu-latest
43-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
4442
outputs:
4543
suffix: ${{ steps.step1.outputs.suffix }}
4644
steps:
@@ -71,7 +69,6 @@ jobs:
7169
style:
7270
name: "Style Check"
7371
runs-on: ubuntu-latest
74-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
7572
steps:
7673
- uses: ansys/actions/code-style@v8
7774
with:
@@ -80,7 +77,6 @@ jobs:
8077
build_linux1:
8178
name: "Build linux1 wheel"
8279
runs-on: ubuntu-latest
83-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
8480
steps:
8581
- uses: actions/checkout@v4
8682

@@ -111,7 +107,6 @@ jobs:
111107
matrix:
112108
test-any: ['false', 'true']
113109
uses: ./.github/workflows/tests.yml
114-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
115110
needs: pick_server_suffix
116111
with:
117112
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }}
@@ -126,7 +121,6 @@ jobs:
126121
docker_tests:
127122
name: "Build and Test on Docker"
128123
uses: ./.github/workflows/test_docker.yml
129-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
130124
needs: pick_server_suffix
131125
with:
132126
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }}
@@ -136,7 +130,6 @@ jobs:
136130
docker_examples:
137131
name: "Run examples on Docker"
138132
uses: ./.github/workflows/examples_docker.yml
139-
if: github.event.action != 'closed' && (github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc')
140133
needs: pick_server_suffix
141134
with:
142135
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }}
@@ -146,8 +139,6 @@ jobs:
146139

147140
docs:
148141
if: |
149-
github.event.action != 'closed' &&
150-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
151142
(startsWith(github.head_ref, 'main') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft)
152143
uses: ./.github/workflows/docs.yml
153144
needs: pick_server_suffix
@@ -158,31 +149,9 @@ jobs:
158149
python_version: "3.11"
159150
secrets: inherit
160151

161-
doc-deploy-pr:
162-
name: "Deploy PR documentation"
163-
runs-on: ubuntu-latest
164-
needs: docs
165-
if: |
166-
always() &&
167-
github.event.pull_request.draft != true &&
168-
(needs.docs.result == 'success' || needs.docs.result == 'skipped') &&
169-
contains(github.event.pull_request.labels.*.name, 'deploy-pr-doc')
170-
steps:
171-
- uses: ansys/actions/doc-deploy-pr@v10
172-
with:
173-
cname: ${{ env.DOCUMENTATION_CNAME }}
174-
token: ${{ secrets.GITHUB_TOKEN }}
175-
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
176-
decompress-artifact: true
177-
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
178-
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
179-
maximum-pr-doc-deployments: 10
180-
181152
upload-development-docs:
182153
runs-on: ubuntu-latest
183154
if: |
184-
github.event.action != 'closed' &&
185-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
186155
(github.ref == 'refs/heads/main' && github.event_name == 'push')
187156
needs: [docs]
188157
steps:
@@ -198,8 +167,6 @@ jobs:
198167

199168
examples:
200169
if: |
201-
github.event.action != 'closed' &&
202-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
203170
(startsWith(github.head_ref, 'main') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft)
204171
uses: ./.github/workflows/examples.yml
205172
needs: pick_server_suffix
@@ -212,8 +179,6 @@ jobs:
212179
pydpf-post:
213180
name: "PyDPF-Post"
214181
if: |
215-
github.event.action != 'closed' &&
216-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
217182
(startsWith(github.head_ref, 'main') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft)
218183
uses: ./.github/workflows/pydpf-post.yml
219184
needs: pick_server_suffix
@@ -225,28 +190,21 @@ jobs:
225190
secrets: inherit
226191

227192
tests-retro:
228-
name: "Test DPF ${{ matrix.dpf.version }} compatibility"
193+
name: "Test DPF ${{ matrix.version }} compatibility"
229194
if: |
230-
github.event.action != 'closed' &&
231-
(github.event.action != 'labeled' || github.event.label.name == 'deploy-pr-doc') &&
232195
(startsWith(github.head_ref, 'main') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft)
233196
strategy:
234197
fail-fast: false
235198
matrix:
236-
dpf:
237-
- {"version": "252", "standalone-suffix": ""}
238-
- {"version": "251", "standalone-suffix": ""}
239-
- {"version": "242", "standalone-suffix": ""}
240-
- {"version": "241", "standalone-suffix": ".sp01"}
241-
- {"version": "232", "standalone-suffix": ""}
242-
- {"version": "231", "standalone-suffix": ""}
243-
- {"version": "222", "standalone-suffix": ""}
199+
version:
200+
- ${{ fromJson(vars.ANSYS_VERSIONS_RETRO) }}
201+
- ${{ fromJson(vars.ANSYS_VERSION_LAST_RELEASED) }}
244202
uses: ./.github/workflows/tests.yml
245203
with:
246-
ANSYS_VERSION: ${{ matrix.dpf.version }}
204+
ANSYS_VERSION: ${{ matrix.version }}
247205
python_versions: '["3.10"]'
248206
DOCSTRING: false
249-
standalone_suffix: ${{ matrix.dpf.standalone-suffix }}
207+
standalone_suffix: ${{ matrix.version == '241' && '.sp01' || '' }}
250208
secrets: inherit
251209

252210
sync-main-with-master:

.github/workflows/ci_release.yml

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ on:
99
workflow_dispatch:
1010
inputs:
1111
ansys_version:
12-
description: "Ansys version of the standalone."
12+
description: "ANSYS version"
1313
required: false
14-
default: '251'
14+
type: string
1515
standalone_branch_suffix:
1616
description: 'Suffix of the branch on standalone'
1717
required: false
@@ -100,7 +100,7 @@ jobs:
100100
DOCSTRING: false
101101
test_any: true
102102
with:
103-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
103+
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_LAST_RELEASED }}
104104
python_versions: ${{ matrix.python_versions }}
105105
wheel: ${{ matrix.wheel }}
106106
wheelhouse: ${{ matrix.wheelhouse }}
@@ -112,70 +112,69 @@ jobs:
112112
docs:
113113
uses: ./.github/workflows/docs.yml
114114
with:
115-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
115+
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_LAST_RELEASED }}
116116
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
117117
event_name: ${{ github.event_name }}
118118
secrets: inherit
119119

120120
examples:
121121
uses: ./.github/workflows/examples.yml
122122
with:
123-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
123+
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_LAST_RELEASED }}
124124
python_versions: '["3.10", "3.11", "3.12", "3.13"]'
125125
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
126126
secrets: inherit
127127

128128
tests-retro:
129-
name: "Test DPF ${{ matrix.dpf.version }} compatibility"
129+
name: "Test DPF ${{ matrix.version }} compatibility"
130130
strategy:
131131
fail-fast: false
132132
matrix:
133-
dpf:
134-
- {"version": "242", "standalone-suffix": ""}
135-
- {"version": "241", "standalone-suffix": ".sp01"}
136-
- {"version": "232", "standalone-suffix": ""}
137-
- {"version": "231", "standalone-suffix": ""}
138-
- {"version": "222", "standalone-suffix": ""}
133+
version:
134+
- ${{ fromJson(vars.ANSYS_VERSIONS_RETRO) }}
139135
uses: ./.github/workflows/tests.yml
140136
with:
141-
ANSYS_VERSION: ${{ matrix.dpf.version }}
137+
ANSYS_VERSION: ${{ matrix.version }}
142138
python_versions: '["3.10"]'
143139
DOCSTRING: false
144-
standalone_suffix: ${{ matrix.dpf.standalone-suffix }}
140+
standalone_suffix: ${{ matrix.version == '241' && '.sp01' || '' }}
145141
secrets: inherit
146142

147143
tests-pydpf-post:
148-
name: "Test PyDPF-Post with ${{ matrix.dpf.version}}"
144+
name: "Test PyDPF-Post with ${{ matrix.version}}"
149145
strategy:
150146
fail-fast: false
151147
matrix:
152-
dpf:
153-
- {"version": "251", "standalone-suffix": "${{ github.event.inputs.standalone_branch_suffix || '' }}", "test_docstrings": "true"}
154-
- {"version": "242", "standalone-suffix": "", "test_docstrings": "false"}
155-
- {"version": "241", "standalone-suffix": "", "test_docstrings": "false"}
156-
- {"version": "232", "standalone-suffix": "", "test_docstrings": "false"}
157-
- {"version": "231", "standalone-suffix": "", "test_docstrings": "false"}
158-
- {"version": "222", "standalone-suffix": "", "test_docstrings": "false"}
148+
version:
149+
- ${{ fromJson(vars.ANSYS_VERSIONS_RETRO) }}
150+
standalone_suffix:
151+
- ""
152+
test_docstrings:
153+
- "false"
154+
include:
155+
- version: ${{ vars.ANSYS_VERSION_LAST_RELEASED }}
156+
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
157+
test_docstrings": "true"
159158
uses: ./.github/workflows/pydpf-post.yml
160159
with:
161-
ANSYS_VERSION: ${{ matrix.dpf.version }}
162-
standalone_suffix: ${{ matrix.dpf.standalone-suffix }}
163-
test_docstrings: ${{ matrix.dpf.test_docstrings }}
160+
ANSYS_VERSION: ${{ matrix.version }}
161+
standalone_suffix: ${{ matrix.version == '241' && '.sp01' || matrix.standalone_suffix }}
162+
test_docstrings: ${{ matrix.test_docstrings }}
164163
secrets: inherit
165164

166165
docker_tests:
167166
name: "Build and Test on Docker"
168167
uses: ./.github/workflows/test_docker.yml
169168
with:
170-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
169+
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_LAST_RELEASED }}
171170
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
172171
secrets: inherit
173172

174173
docker_examples:
175174
name: "Run examples on Docker"
176175
uses: ./.github/workflows/examples_docker.yml
177176
with:
178-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
177+
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_LAST_RELEASED }}
179178
python_versions: '["3.10", "3.11", "3.12", "3.13"]'
180179
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
181180
secrets: inherit
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: doc-deploy-PR
2+
3+
on:
4+
workflow_run:
5+
workflows: [ci]
6+
types: [completed]
7+
pull_request:
8+
types: [closed]
9+
10+
env:
11+
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com'
12+
13+
jobs:
14+
debug:
15+
name: debug
16+
runs-on: ubuntu-latest
17+
env:
18+
EVENT_OBJ: ${{ toJson(github.event) }}
19+
steps:
20+
- run: echo $EVENT_OBJ
21+
doc-deploy-pr:
22+
name: "Deploy PR documentation"
23+
runs-on: ubuntu-latest
24+
if: |
25+
(
26+
github.event_name == 'workflow_run' &&
27+
github.event.workflow_run.conclusion == 'success' &&
28+
contains(github.event.workflow_run.pull_requests.*.labels.*.name, 'deploy-pr-doc')
29+
) || (
30+
github.event_name == 'pull_request' &&
31+
github.event.action == 'closed' &&
32+
contains(github.event.pull_request.labels.*.name, 'deploy-pr-doc')
33+
)
34+
steps:
35+
- name: Set PR number
36+
id: pr
37+
run: |
38+
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
39+
echo "pr_number=${{ fromJson(toJson(github.event.workflow_run.pull_requests[0])).number }}" >> "$GITHUB_OUTPUT"
40+
else
41+
echo "pr_number=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
42+
fi
43+
44+
- name: Print PR number
45+
run: echo "PR number is ${{ steps.pr.outputs.pr_number }}"
46+
47+
- name: Download artifacts (if workflow_run)
48+
if: ${{ github.event_name == 'workflow_run' }}
49+
uses: dawidd6/action-download-artifact@v11
50+
with:
51+
workflow: docs.yml
52+
name: HTML-doc-ansys-dpf-core.zip
53+
github_token: ${{ secrets.GITHUB_TOKEN }}
54+
run_id: ${{ github.event.workflow_run.id }}
55+
56+
- name: Display downloaded files (if workflow_run)
57+
if: ${{ github.event_name == 'workflow_run' }}
58+
run: ls -R
59+
60+
- name: Deploy PR documentation
61+
uses: ansys/actions/doc-deploy-pr@v10
62+
with:
63+
cname: ${{ env.DOCUMENTATION_CNAME }}
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
doc-artifact-name: HTML-doc-ansys-dpf-core.zip
66+
decompress-artifact: true
67+
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
68+
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
69+
maximum-pr-doc-deployments: 10

0 commit comments

Comments
 (0)