Skip to content

Commit b36686d

Browse files
Merge branch 'master' into fnegri/expose_result_workflow
2 parents a1f3f11 + 6f656d4 commit b36686d

File tree

8 files changed

+103
-14
lines changed

8 files changed

+103
-14
lines changed

.github/workflows/ansys_lab.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Ansys Lab
2+
3+
on:
4+
# Can be called by the CI
5+
workflow_call:
6+
inputs:
7+
version:
8+
description: "Release version as 'X.Y.Z'"
9+
type: string
10+
required: true
11+
# Can be called manually
12+
workflow_dispatch:
13+
inputs:
14+
version:
15+
description: "Release version as 'X.Y.Z'"
16+
type: string
17+
required: true
18+
19+
env:
20+
DESTINATION_BRANCH_NAME: ansys_lab_examples
21+
22+
jobs:
23+
deploy_examples:
24+
name: "Deploy examples for Ansys Lab"
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
ref: ${{ env.DESTINATION_BRANCH_NAME }}
30+
31+
- name: "Clean-up working directory"
32+
shell: python
33+
run: |
34+
import glob
35+
import os
36+
37+
for example in glob.glob('**/*.ipynb', recursive=True):
38+
os.remove(example)
39+
print(f"Deleted {example}")
40+
41+
- name: "Download Release Asset - HTML"
42+
uses: dsaltares/[email protected]
43+
with:
44+
file: HTML-doc-ansys-dpf-post.zip
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
version: tags/v${{ inputs.version }}
47+
48+
- name: "Extract ipynb examples"
49+
shell: python
50+
run: |
51+
import glob
52+
import os
53+
import shutil
54+
import zipfile
55+
with zipfile.ZipFile("HTML-doc-ansys-dpf-post.zip", 'r') as z:
56+
[z.extract(file, "./") for file in z.namelist() if file.endswith(".ipynb")]
57+
os.remove("HTML-doc-ansys-dpf-post.zip")
58+
59+
if not "examples" in os.listdir(os.getcwd()):
60+
os.mkdir(os.path.join(os.getcwd(), "examples"))
61+
print(os.listdir(os.getcwd()))
62+
for folder in os.listdir(os.path.join(os.getcwd(), "_downloads")):
63+
print(os.listdir(os.path.join(os.path.join(os.getcwd(), "_downloads"), folder)))
64+
for example in glob.glob('**/*.ipynb', recursive=True):
65+
print(f"Moving {example}")
66+
shutil.move(example, os.path.join(os.getcwd(), "examples"))
67+
print(os.listdir(os.path.join(os.getcwd(), "examples")))
68+
69+
- name: "Push changes"
70+
shell: bash
71+
run: |
72+
git config --global user.name "rlagha"
73+
git add .
74+
git status
75+
git commit -a -m ${{ inputs.version }}
76+
git push https://${{ secrets.DPF_PIPELINE }}@github.com/ansys/pydpf-post.git --follow-tags

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525
MODULE: 'post'
2626
DOCUMENTATION_CNAME: 'post.docs.pyansys.com'
2727
MAIN_PYTHON_VERSION: '3.10'
28-
ANSYS_VERSION: '241'
28+
ANSYS_VERSION: '242'
2929

3030
jobs:
3131
debug:
@@ -129,7 +129,7 @@ jobs:
129129
matrix:
130130
python-version: ["3.10"]
131131
os: ["windows-latest", "ubuntu-latest"]
132-
ANSYS_VERSION: ["232", "231", "222"]
132+
ANSYS_VERSION: ["241", "232", "231", "222"]
133133

134134
steps:
135135
- uses: actions/checkout@v4
@@ -185,7 +185,7 @@ jobs:
185185
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
186186
uses: ./.github/workflows/examples.yml
187187
with:
188-
ANSYS_VERSION: "241"
188+
ANSYS_VERSION: "242"
189189
python_versions: '["3.10"]'
190190
standalone_suffix: ${{ inputs.standalone_suffix || ''}}
191191
secrets: inherit
@@ -194,7 +194,7 @@ jobs:
194194
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
195195
uses: ./.github/workflows/docs.yml
196196
with:
197-
ANSYS_VERSION: "241"
197+
ANSYS_VERSION: "242"
198198
python_version: "3.10"
199199
standalone_suffix: ${{ inputs.standalone_suffix || ''}}
200200
event_name: ${{ github.event_name }}

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
ANSYS_VERSION:
1212
required: false
1313
type: string
14-
default: "241"
14+
default: "242"
1515
standalone_suffix:
1616
description: "Suffix of the branch on standalone"
1717
required: false
@@ -42,7 +42,7 @@ on:
4242
description: "ANSYS version"
4343
required: true
4444
type: string
45-
default: "241"
45+
default: "242"
4646
standalone_suffix:
4747
description: "Suffix of the branch on standalone"
4848
required: false

.github/workflows/examples.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
ANSYS_VERSION:
1212
required: false
1313
type: string
14-
default: "241"
14+
default: "242"
1515
standalone_suffix:
1616
description: "Suffix of the branch on standalone"
1717
required: false
@@ -29,7 +29,7 @@ on:
2929
description: "ANSYS version to run."
3030
required: true
3131
type: string
32-
default: "241"
32+
default: "242"
3333
standalone_suffix:
3434
description: "Suffix of the branch on standalone"
3535
required: false

.github/workflows/releaser.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,9 @@ jobs:
5858
token: ${{ secrets.GITHUB_TOKEN }}
5959
doc-artifact-name: HTML-doc-ansys-dpf-post.zip
6060
decompress-artifact: true
61+
62+
update_ansys_lab_examples:
63+
uses: ./.github/workflows/ansys_lab.yml
64+
with:
65+
version: latest
66+
secrets: inherit

requirements/requirements_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
coverage==7.3.1
22
pytest-cov==4.0.0
3-
pytest-rerunfailures==12.0
3+
pytest-rerunfailures==13.0
44
pytest==7.4.2
55
pyvista==0.42.1

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ def grpc_server():
204204
server.shutdown()
205205

206206

207+
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0 = meets_version(
208+
get_server_version(core._global_server()), "8.0"
209+
)
210+
207211
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_1 = meets_version(
208212
get_server_version(core._global_server()), "7.1"
209213
)

tests/test_streamlines.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
from ansys.dpf import post
44
from ansys.dpf.post import examples
55
from ansys.dpf.post.helpers import streamlines
6-
from conftest import SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0
6+
from conftest import (
7+
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0,
8+
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0,
9+
)
710

811

912
@pytest.mark.skipif(
@@ -17,10 +20,10 @@ def simulation(self) -> post.FluidSimulation:
1720
return post.FluidSimulation(cas=files_cfx["cas"], dat=files_cfx["dat"]) # noqa
1821

1922
def test_plot_streamlines(self, simulation):
20-
# import pyvista as pv
21-
#
22-
# pv.OFF_SCREEN = False
23-
dataframe = simulation.velocity(times=[0.0], zone_ids=[5])
23+
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
24+
dataframe = simulation.velocity(times=[0.0], zone_ids=[1])
25+
else:
26+
dataframe = simulation.velocity(times=[0.0], zone_ids=[5])
2427
sources = [
2528
{"radius": 0.25, "center": (0.75, 0.0, 0.0), "n_points": 20},
2629
{

0 commit comments

Comments
 (0)