Skip to content

Commit e658d50

Browse files
authored
CI: Avoid using self-hosted runners in drafts (#5203)
1 parent 814ef79 commit e658d50

File tree

2 files changed

+290
-0
lines changed

2 files changed

+290
-0
lines changed

.github/workflows/ci_cd.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ jobs:
227227

228228
test-solvers-windows:
229229
name: Testing solvers and coverage (Windows)
230+
if: github.event.pull_request.draft == false
230231
needs: [smoke-tests]
231232
runs-on: [ self-hosted, Windows, pyaedt ]
232233
steps:
@@ -287,6 +288,7 @@ jobs:
287288
# TODO: Si if we can use ansys/actions
288289
test-solvers-linux:
289290
name: Testing solvers and coverage (Linux)
291+
if: github.event.pull_request.draft == false
290292
needs: [smoke-tests]
291293
runs-on: [ self-hosted, Linux, pyaedt ]
292294
env:
@@ -343,6 +345,7 @@ jobs:
343345

344346
test-windows:
345347
name: Testing and coverage (Windows)
348+
if: github.event.pull_request.draft == false
346349
needs: [smoke-tests]
347350
runs-on: [ self-hosted, Windows, pyaedt ]
348351
steps:
@@ -408,6 +411,7 @@ jobs:
408411
# TODO: Si if we can use ansys/actions
409412
test-linux:
410413
name: Testing and coverage (Linux)
414+
if: github.event.pull_request.draft == false
411415
needs: [smoke-tests]
412416
runs-on: [ self-hosted, Linux, pyaedt ]
413417
env:

.github/workflows/manual_draft.yml

Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
name: Draft workflow
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test-solvers-windows:
7+
description: "Testing solvers and coverage (Windows)"
8+
default: 'no'
9+
type: choice
10+
options:
11+
- 'yes'
12+
- 'no'
13+
test-solvers-linux:
14+
description: "Testing solvers and coverage (Linux)"
15+
default: 'no'
16+
type: choice
17+
options:
18+
- 'yes'
19+
- 'no'
20+
test-windows:
21+
description: "Testing solvers and coverage (Windows)"
22+
default: 'no'
23+
type: choice
24+
options:
25+
- 'yes'
26+
- 'no'
27+
test-linux:
28+
description: "Testing solvers and coverage (Linux)"
29+
type: choice
30+
default: 'no'
31+
options:
32+
- 'yes'
33+
- 'no'
34+
35+
jobs:
36+
37+
# # =================================================================================================
38+
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
39+
# # =================================================================================================
40+
41+
test-solvers-windows:
42+
name: Testing solvers and coverage (Windows)
43+
if: github.event.inputs.test-solvers-windows == 'yes'
44+
needs: [smoke-tests]
45+
runs-on: [ self-hosted, Windows, pyaedt ]
46+
steps:
47+
- name: Install Git and checkout project
48+
uses: actions/checkout@v4
49+
50+
- name: Setup Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
54+
55+
- name: Create virtual environment
56+
run: |
57+
python -m venv .venv
58+
.venv\Scripts\Activate.ps1
59+
python -m pip install pip -U
60+
python -m pip install wheel setuptools -U
61+
python -c "import sys; print(sys.executable)"
62+
63+
- name: Install pyaedt and tests dependencies
64+
run: |
65+
.venv\Scripts\Activate.ps1
66+
pip install .[tests]
67+
pip install pytest-azurepipelines
68+
69+
- name: Install CI dependencies (e.g. vtk-osmesa)
70+
run: |
71+
.venv\Scripts\Activate.ps1
72+
# Uninstall conflicting dependencies
73+
pip uninstall --yes vtk
74+
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
75+
76+
- name: Run tests on _unittest_solvers
77+
env:
78+
PYTHONMALLOC: malloc
79+
run: |
80+
.venv\Scripts\Activate.ps1
81+
pytest --durations=50 -v --cov=ansys.aedt.core --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest_solvers
82+
83+
- uses: codecov/codecov-action@v4
84+
with:
85+
token: ${{ secrets.CODECOV_TOKEN }}
86+
name: codecov-system-solver-tests
87+
file: ./coverage.xml
88+
flags: system,solver
89+
90+
- name: Upload pytest test results
91+
uses: actions/upload-artifact@v3
92+
with:
93+
name: pytest-solver-results
94+
path: junit/test-results.xml
95+
if: ${{ always() }}
96+
97+
# # =================================================================================================
98+
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
99+
# # =================================================================================================
100+
101+
test-solvers-linux:
102+
name: Testing solvers and coverage (Linux)
103+
if: github.event.inputs.test-solvers-linux == 'yes'
104+
needs: [smoke-tests]
105+
runs-on: [ self-hosted, Linux, pyaedt ]
106+
env:
107+
ANSYSEM_ROOT242: '/opt/AnsysEM/v242/Linux64'
108+
ANS_NODEPCHECK: '1'
109+
steps:
110+
- name: Install Git and checkout project
111+
uses: actions/checkout@v4
112+
113+
- name: Setup Python
114+
uses: actions/setup-python@v5
115+
with:
116+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
117+
118+
- name: Create virtual environment
119+
run: |
120+
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
121+
python -m venv .venv
122+
source .venv/bin/activate
123+
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U
124+
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U
125+
python -c "import sys; print(sys.executable)"
126+
127+
- name: Install pyaedt and tests dependencies
128+
run: |
129+
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
130+
source .venv/bin/activate
131+
pip install .[tests]
132+
pip install pytest-azurepipelines
133+
134+
- name: Run tests on _unittest_solvers
135+
run: |
136+
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
137+
source .venv/bin/activate
138+
pytest --durations=50 -v --cov=ansys.aedt.core --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest_solvers
139+
140+
- uses: codecov/codecov-action@v4
141+
with:
142+
token: ${{ secrets.CODECOV_TOKEN }}
143+
name: codecov-system-solver-tests
144+
file: ./coverage.xml
145+
flags: system,solver
146+
147+
- name: Upload pytest test results
148+
uses: actions/upload-artifact@v3
149+
with:
150+
name: pytest-solver-results
151+
path: junit/test-results.xml
152+
if: ${{ always() }}
153+
154+
# # =================================================================================================
155+
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
156+
# # =================================================================================================
157+
158+
test-windows:
159+
name: Testing and coverage (Windows)
160+
if: github.event.inputs.test-windows == 'yes'
161+
needs: [smoke-tests]
162+
runs-on: [ self-hosted, Windows, pyaedt ]
163+
steps:
164+
- name: Install Git and checkout project
165+
uses: actions/checkout@v4
166+
167+
- name: Setup Python
168+
uses: actions/setup-python@v5
169+
with:
170+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
171+
172+
- name: Create virtual environment
173+
run: |
174+
python -m venv .venv
175+
.venv\Scripts\Activate.ps1
176+
python -m pip install pip -U
177+
python -m pip install wheel setuptools -U
178+
python -c "import sys; print(sys.executable)"
179+
180+
- name: Install pyaedt and tests dependencies
181+
run: |
182+
.venv\Scripts\Activate.ps1
183+
pip install .[tests]
184+
pip install pytest-azurepipelines
185+
186+
- name: Install CI dependencies (e.g. vtk-osmesa)
187+
run: |
188+
.venv\Scripts\Activate.ps1
189+
# Uninstall conflicting dependencies
190+
pip uninstall --yes vtk
191+
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
192+
193+
- name: Run tests on _unittest
194+
uses: nick-fields/retry@v3
195+
env:
196+
PYTHONMALLOC: malloc
197+
with:
198+
max_attempts: 2
199+
retry_on: error
200+
timeout_minutes: 50
201+
command: |
202+
.venv\Scripts\Activate.ps1
203+
pytest -n 4 --dist loadfile --durations=50 -v --cov=ansys.aedt.core --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest
204+
205+
- uses: codecov/codecov-action@v4
206+
with:
207+
token: ${{ secrets.CODECOV_TOKEN }}
208+
name: codecov-system-tests
209+
file: ./coverage.xml
210+
flags: system
211+
212+
- name: Upload pytest test results
213+
uses: actions/upload-artifact@v3
214+
with:
215+
name: pytest-results
216+
path: junit/test-results.xml
217+
if: ${{ always() }}
218+
219+
# # =================================================================================================
220+
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
221+
# # =================================================================================================
222+
223+
test-linux:
224+
name: Testing and coverage (Linux)
225+
if: github.event.inputs.test-linux == 'yes'
226+
needs: [smoke-tests]
227+
runs-on: [ self-hosted, Linux, pyaedt ]
228+
env:
229+
ANSYSEM_ROOT242: '/opt/AnsysEM/v242/Linux64'
230+
ANS_NODEPCHECK: '1'
231+
steps:
232+
- name: Install Git and checkout project
233+
uses: actions/checkout@v4
234+
235+
- name: Setup Python
236+
uses: actions/setup-python@v5
237+
with:
238+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
239+
240+
- name: Create virtual environment
241+
run: |
242+
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
243+
python -m venv .venv
244+
source .venv/bin/activate
245+
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U
246+
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U
247+
python -c "import sys; print(sys.executable)"
248+
249+
- name: Install pyaedt and tests dependencies
250+
run: |
251+
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
252+
source .venv/bin/activate
253+
pip install .[tests]
254+
pip install pytest-azurepipelines
255+
256+
- name: Install CI dependencies (e.g. vtk-osmesa)
257+
run: |
258+
source .venv/bin/activate
259+
# Uninstall conflicting dependencies
260+
pip uninstall --yes vtk
261+
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
262+
263+
- name: Run tests on _unittest
264+
uses: nick-fields/retry@v3
265+
with:
266+
max_attempts: 2
267+
retry_on: error
268+
timeout_minutes: 50
269+
command: |
270+
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
271+
source .venv/bin/activate
272+
pytest -n 2 --dist loadfile --durations=50 -v --cov=ansys.aedt.core --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest
273+
274+
- uses: codecov/codecov-action@v4
275+
with:
276+
token: ${{ secrets.CODECOV_TOKEN }}
277+
name: codecov-system-solver-tests
278+
file: ./coverage.xml
279+
flags: system,solver
280+
281+
- name: Upload pytest test results
282+
uses: actions/upload-artifact@v3
283+
with:
284+
name: pytest-solver-results
285+
path: junit/test-results.xml
286+
if: ${{ always() }}

0 commit comments

Comments
 (0)