Skip to content

Commit 8f37eab

Browse files
jorgepilotomoe-adPProfizi
authored
ci(workflow): optimize syntax (#2292)
Co-authored-by: Muhammed Adedigba <[email protected]> Co-authored-by: moe-ad <[email protected]> Co-authored-by: Paul Profizi <[email protected]>
1 parent 134728f commit 8f37eab

File tree

3 files changed

+83
-202
lines changed

3 files changed

+83
-202
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ jobs:
100100
name: ${{ steps.wheel.outputs.wheel_name }}
101101
path: dist/${{ steps.wheel.outputs.wheel_name }}
102102

103-
tests:
103+
tests-latest:
104+
name: "Test ${{ matrix.test-any == 'true' && 'any' || 'platform-specific' }} wheel against latest DPF version"
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
test-any: ['false', 'true']
104109
uses: ./.github/workflows/tests.yml
105110
needs: pick_server_suffix
106111
with:
@@ -109,18 +114,8 @@ jobs:
109114
wheel: true
110115
wheelhouse: false
111116
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
112-
secrets: inherit
113-
114-
tests_any:
115-
uses: ./.github/workflows/tests.yml
116-
needs: pick_server_suffix
117-
with:
118-
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }}
119-
python_versions: '["3.10"]'
120-
wheel: true
121-
wheelhouse: false
122-
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
123-
test_any: true
117+
test_any: ${{ matrix.test-any }}
118+
DOCSTRING: ${{ !matrix.test-any }}
124119
secrets: inherit
125120

126121
docker_tests:
@@ -190,77 +185,23 @@ jobs:
190185
test_docstrings: "true"
191186
secrets: inherit
192187

193-
retro_252:
194-
name: "retro 252"
195-
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
196-
uses: ./.github/workflows/tests.yml
197-
with:
198-
ANSYS_VERSION: "252"
199-
python_versions: '["3.10"]'
200-
DOCSTRING: false
201-
standalone_suffix: ''
202-
secrets: inherit
203-
204-
retro_251:
205-
name: "retro 251"
206-
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
207-
uses: ./.github/workflows/tests.yml
208-
with:
209-
ANSYS_VERSION: "251"
210-
python_versions: '["3.10"]'
211-
DOCSTRING: false
212-
standalone_suffix: ''
213-
secrets: inherit
214-
215-
retro_242:
216-
name: "retro 242"
217-
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
218-
uses: ./.github/workflows/tests.yml
219-
with:
220-
ANSYS_VERSION: "242"
221-
python_versions: '["3.10"]'
222-
DOCSTRING: false
223-
standalone_suffix: ''
224-
secrets: inherit
225-
226-
retro_241:
227-
name: "retro 241"
228-
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
229-
uses: ./.github/workflows/tests.yml
230-
with:
231-
ANSYS_VERSION: "241"
232-
python_versions: '["3.10"]'
233-
DOCSTRING: false
234-
standalone_suffix: '.sp01'
235-
secrets: inherit
236-
237-
retro_232:
238-
name: "retro 232"
239-
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
240-
uses: ./.github/workflows/tests.yml
241-
with:
242-
ANSYS_VERSION: "232"
243-
python_versions: '["3.10"]'
244-
DOCSTRING: false
245-
standalone_suffix: ''
246-
secrets: inherit
247-
248-
retro_231:
249-
name: "retro 231"
250-
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
251-
uses: ./.github/workflows/tests.yml
252-
with:
253-
ANSYS_VERSION: "231"
254-
python_versions: '["3.10"]'
255-
DOCSTRING: false
256-
secrets: inherit
257-
258-
retro_222:
259-
name: "retro 222"
188+
tests-retro:
189+
name: "Test DPF ${{ matrix.dpf.version }} compatibility"
260190
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
191+
strategy:
192+
fail-fast: false
193+
matrix:
194+
dpf:
195+
- {"version": "251", "standalone-suffix": ""}
196+
- {"version": "242", "standalone-suffix": ""}
197+
- {"version": "241", "standalone-suffix": ".sp01"}
198+
- {"version": "232", "standalone-suffix": ""}
199+
- {"version": "231", "standalone-suffix": ""}
200+
- {"version": "222", "standalone-suffix": ""}
261201
uses: ./.github/workflows/tests.yml
262202
with:
263-
ANSYS_VERSION: "222"
203+
ANSYS_VERSION: ${{ matrix.dpf.version }}
264204
python_versions: '["3.10"]'
265205
DOCSTRING: false
206+
standalone_suffix: ${{ matrix.dpf.standalone-suffix }}
266207
secrets: inherit

.github/workflows/ci_release.yml

Lines changed: 60 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -73,48 +73,40 @@ jobs:
7373
name: ${{ steps.wheel.outputs.wheel_name }}
7474
path: dist/${{ steps.wheel.outputs.wheel_name }}
7575

76-
tests_3_10:
77-
uses: ./.github/workflows/tests.yml
78-
with:
79-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
80-
python_versions: '["3.10"]'
81-
wheel: true
82-
wheelhouse: true
83-
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
84-
secrets: inherit
85-
8676
tests:
77+
name: "Test ${{ matrix.test_any && 'any' || 'platform-specific' }} wheel"
8778
uses: ./.github/workflows/tests.yml
79+
strategy:
80+
matrix:
81+
include:
82+
- python_versions: '["3.10"]'
83+
wheel: true
84+
wheelhouse: true
85+
DOCSTRING: true
86+
test_any: false
87+
- python_versions: '["3.11", "3.12", "3.13"]'
88+
wheel: false
89+
wheelhouse: true
90+
DOCSTRING: false
91+
test_any: false
92+
- python_versions: '["3.10"]'
93+
wheel: true
94+
wheelhouse: false
95+
DOCSTRING: false
96+
test_any: true
97+
- python_versions: '["3.11", "3.12", "3.13"]'
98+
wheel: false
99+
wheelhouse: false
100+
DOCSTRING: false
101+
test_any: true
88102
with:
89103
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
90-
python_versions: '["3.11", "3.12", "3.13"]'
91-
DOCSTRING: false
92-
wheel: false
93-
wheelhouse: true
94-
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
95-
secrets: inherit
96-
97-
tests_any_3_10:
98-
uses: ./.github/workflows/tests.yml
99-
with:
100-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
101-
python_versions: '["3.10"]'
102-
wheel: true
103-
wheelhouse: false
104+
python_versions: ${{ matrix.python_versions }}
105+
wheel: ${{ matrix.wheel }}
106+
wheelhouse: ${{ matrix.wheelhouse }}
107+
DOCSTRING: ${{ matrix.DOCSTRING }}
108+
test_any: ${{ matrix.test_any }}
104109
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
105-
test_any: true
106-
secrets: inherit
107-
108-
tests_any:
109-
uses: ./.github/workflows/tests.yml
110-
with:
111-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
112-
python_versions: '["3.11", "3.12", "3.13"]'
113-
DOCSTRING: false
114-
wheel: false
115-
wheelhouse: false
116-
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
117-
test_any: true
118110
secrets: inherit
119111

120112
docs:
@@ -133,94 +125,42 @@ jobs:
133125
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
134126
secrets: inherit
135127

136-
retro_242:
137-
name: "retro 242"
138-
uses: ./.github/workflows/tests.yml
139-
with:
140-
ANSYS_VERSION: "242"
141-
python_versions: '["3.10"]'
142-
DOCSTRING: false
143-
secrets: inherit
144-
145-
retro_241:
146-
name: "retro 241"
147-
uses: ./.github/workflows/tests.yml
148-
with:
149-
ANSYS_VERSION: "241"
150-
python_versions: '["3.10"]'
151-
standalone_suffix: '.sp01'
152-
DOCSTRING: false
153-
secrets: inherit
154-
155-
retro_232:
156-
name: "retro 232"
157-
uses: ./.github/workflows/tests.yml
158-
with:
159-
ANSYS_VERSION: "232"
160-
python_versions: '["3.10"]'
161-
DOCSTRING: false
162-
secrets: inherit
163-
164-
retro_231:
165-
name: "retro 231"
166-
uses: ./.github/workflows/tests.yml
167-
with:
168-
ANSYS_VERSION: "231"
169-
python_versions: '["3.10"]'
170-
DOCSTRING: false
171-
secrets: inherit
172-
173-
retro_222:
174-
name: "retro 222"
128+
tests-retro:
129+
name: "Test DPF ${{ matrix.dpf.version }} compatibility"
130+
strategy:
131+
fail-fast: false
132+
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": ""}
175139
uses: ./.github/workflows/tests.yml
176140
with:
177-
ANSYS_VERSION: "222"
141+
ANSYS_VERSION: ${{ matrix.dpf.version }}
178142
python_versions: '["3.10"]'
179143
DOCSTRING: false
180-
secrets: inherit
181-
182-
pydpf-post_251:
183-
name: "PyDPF-Post with 251"
184-
uses: ./.github/workflows/pydpf-post.yml
185-
with:
186-
ANSYS_VERSION: ${{ inputs.ansys_version || '251' }}
187-
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
188-
test_docstrings: "true"
189-
secrets: inherit
190-
191-
pydpf-post_242:
192-
name: "PyDPF-Post with 242"
193-
uses: ./.github/workflows/pydpf-post.yml
194-
with:
195-
ANSYS_VERSION: "242"
196-
secrets: inherit
197-
198-
pydpf-post_241:
199-
name: "PyDPF-Post with 241"
200-
uses: ./.github/workflows/pydpf-post.yml
201-
with:
202-
ANSYS_VERSION: "241"
203-
secrets: inherit
204-
205-
pydpf-post_232:
206-
name: "PyDPF-Post with 232"
207-
uses: ./.github/workflows/pydpf-post.yml
208-
with:
209-
ANSYS_VERSION: "232"
210-
secrets: inherit
211-
212-
pydpf-post_231:
213-
name: "PyDPF-Post with 231"
214-
uses: ./.github/workflows/pydpf-post.yml
215-
with:
216-
ANSYS_VERSION: "231"
217-
secrets: inherit
218-
219-
pydpf-post_222:
220-
name: "PyDPF-Post with 222"
144+
standalone_suffix: ${{ matrix.dpf.standalone-suffix }}
145+
secrets: inherit
146+
147+
tests-pydpf-post:
148+
name: "Test PyDPF-Post with ${{ matrix.dpf.version}}"
149+
strategy:
150+
fail-fast: false
151+
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"}
221159
uses: ./.github/workflows/pydpf-post.yml
222160
with:
223-
ANSYS_VERSION: "222"
161+
ANSYS_VERSION: ${{ matrix.dpf.version }}
162+
standalone_suffix: ${{ matrix.dpf.standalone-suffix }}
163+
test_docstrings: ${{ matrix.dpf.test_docstrings }}
224164
secrets: inherit
225165

226166
docker_tests:
@@ -243,7 +183,7 @@ jobs:
243183
draft_release:
244184
name: "Draft Release"
245185
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
246-
needs: [style, tests, tests_3_10, tests_any, tests_any_3_10, docs, examples, retro_232, retro_231, retro_222, docker_tests]
186+
needs: [style, tests, docs, examples, tests-retro, docker_tests]
247187
runs-on: ubuntu-latest
248188
steps:
249189
- name: "Download artifacts"

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
DEBUG: true
210210

211211
- name: "Test Docstrings"
212-
if: (inputs.DOCSTRING == 'true') && !((inputs.test_any == 'true') && (matrix.os == 'ubuntu-latest'))
212+
if: (inputs.DOCSTRING == 'true')
213213
uses: ansys/pydpf-actions/[email protected]
214214
with:
215215
MODULE: ${{env.MODULE}}

0 commit comments

Comments
 (0)