Skip to content

Commit 1a43936

Browse files
committed
PR review
2 parents e425e2b + a8a3580 commit 1a43936

27 files changed

+308
-161
lines changed

.ci/azure-pipelines.yml

Lines changed: 62 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# azure pipelines build and test pymapdl
1+
# azure pipelines build and test pydpf
22

33
variables:
44
ALLOW_PLOTTING: true
@@ -8,7 +8,8 @@ variables:
88
trigger:
99
branches:
1010
include:
11-
- '*'
11+
- 'master*'
12+
- 'release-*'
1213
exclude:
1314
- gh-pages
1415
tags:
@@ -26,9 +27,11 @@ jobs:
2627
- job: Windows
2728
variables:
2829
python.version: '3.8'
30+
ANSYS_VERSION: 221
2931
DISPLAY: ':99.0'
3032
PYANSYS_OFF_SCREEN: True
3133
DPF_PORT: 32772
34+
vstsPackageVersion: '22.1.1'
3235
pool:
3336
vmImage: 'windows-2019'
3437

@@ -42,50 +45,39 @@ jobs:
4245
ArtifactName: 'ansys_dpf_core_wheel'
4346
enabled: true
4447

48+
- template: templates\kill-servers-windows.yml
49+
4550
- script: |
51+
cd $(System.DefaultWorkingDirectory)
4652
pip install -r requirements_test.txt
4753
displayName: Install Test Environment
48-
49-
- script: |
50-
set THISDIR=$(System.DefaultWorkingDirectory)
51-
cd tests
52-
set AWP_ROOT212=%THISDIR%\server\v212
53-
pytest -v --junitxml=junit/test-results.xml --cov ansys.dpf.core --cov-report=xml --reruns 3
54-
55-
displayName: Test Core API
56-
timeoutInMinutes: 10
57-
58-
- task: PublishTestResults@2
59-
inputs:
60-
testResultsFormat: 'JUnit'
61-
testResultsFiles: 'tests/junit/test-results.xml'
62-
testRunTitle: 'windowsTests'
63-
publishRunAttachments: true
6454
condition: always()
6555
6656
- script: |
67-
set THISDIR=$(System.DefaultWorkingDirectory)
6857
cd $(System.DefaultWorkingDirectory)
69-
set AWP_ROOT212=%THISDIR%\server\v212
70-
pytest --doctest-modules --junitxml=junit/test-doctests-results.xml ansys\dpf\core
58+
pytest --doctest-modules --junitxml=junit/test-doctests-results.xml ansys/dpf/core
7159
condition: always()
7260
displayName: Test API Docstrings
73-
timeoutInMinutes: 5
61+
timeoutInMinutes: 15
7462
7563
- task: PublishTestResults@2
7664
inputs:
7765
testResultsFormat: 'JUnit'
78-
testResultsFiles: 'junit/test-doctests-results.xml'
66+
testResultsFiles: '$(System.DefaultWorkingDirectory)/junit/test-doctests-results.xml'
7967
testRunTitle: 'docTestsTests'
8068
publishRunAttachments: true
8169
condition: always()
8270

83-
- script: |
84-
set THISDIR=$(System.DefaultWorkingDirectory)
85-
set AWP_ROOT212=%THISDIR%\server\v212
86-
python .ci/run_examples.py
87-
displayName: 'Run example scripts'
88-
timeoutInMinutes: 5
71+
- template: templates\kill-servers-windows.yml
72+
73+
- script: |
74+
@echo on
75+
cd $(System.DefaultWorkingDirectory)
76+
rmdir /s /q .\ansys\
77+
displayName: Remove local copy of ansys-dpf-core
78+
condition: always()
79+
80+
- template: templates\run-unit-tests-windows.yml
8981

9082
- script: |
9183
pip install twine
@@ -100,48 +92,55 @@ jobs:
10092
10193
10294
- script: |
103-
type $(System.DefaultWorkingDirectory)\server\v212\aisol\bin\winx64\log.txt
95+
type $(System.DefaultWorkingDirectory)\server\v$(ANSYS_VERSION)\aisol\bin\winx64\log.txt
10496
displayName: 'Show DPF Server Logs'
105-
condition: always()
97+
condition: always()
98+
continueOnError: true
10699
107100
- template: templates\kill-servers-windows.yml
108-
101+
102+
103+
- job: WindowsAnsys2021R2
104+
variables:
105+
python.version: '3.8'
106+
ANSYS_VERSION: 212
107+
DISPLAY: ':99.0'
108+
PYANSYS_OFF_SCREEN: True
109+
DPF_PORT: 32772
110+
vstsPackageVersion: '21.2.3'
111+
pool:
112+
vmImage: 'windows-2019'
113+
114+
steps:
115+
- template: templates\prepare-environment-windows.yml
116+
117+
- script: |
118+
pip install ansys-grpc-dpf==0.3.0
119+
displayName: Install proper version of ansys-grpc-dpf
120+
121+
- script: |
122+
rmdir /s /q .\ansys\
123+
displayName: Remove local copy of ansys-dpf-core
124+
125+
- template: templates\run-unit-tests-windows.yml
126+
109127

110128
- job: Linux
111129
variables:
112130
python.version: '3.7' # due to VTK 8.1.2 requirement for docbuild
113-
DISPLAY: ':99.0'
131+
ANSYS_VERSION: 221
114132
PYANSYS_OFF_SCREEN: True
115133
DPF_PORT: 50055
116134
TEMP: $(System.DefaultWorkingDirectory)/temp
117-
AWP_ROOT212: $(System.DefaultWorkingDirectory)/server/v212
118-
135+
AWP_ROOT221: $(System.DefaultWorkingDirectory)/server/v221
136+
vstsPackageVersion: "22.1.1"
119137
pool:
120138
vmImage: 'ubuntu-20.04'
121139
steps:
122140
- template: templates\prepare-environment-linux.yml
123141

124-
- script: |
125-
pip install -r requirements_test.txt
126-
pip install pytest-azurepipelines
127-
export AWP_ROOT212=${SYSTEM_DEFAULTWORKINGDIRECTORY}/server/v212
128-
cd tests
129-
export DPF_IP=$(hostname -i)
130-
xvfb-run pytest -v --junitxml=junit/test-results.xml --cov ansys.dpf.core --cov-report=xml --reruns 3
131-
export PATH=`pwd`
132-
echo ${PATH}
133-
displayName: Test Core API
134-
135-
- task: PublishTestResults@2
136-
inputs:
137-
testResultsFormat: 'JUnit'
138-
testResultsFiles: 'junit/test-results.xml'
139-
testRunTitle: 'linuxTests'
140-
publishRunAttachments: true
141-
searchFolder: 'tests/'
142-
condition: always()
143-
144-
142+
- template: templates\run-unit-tests-linux.yml
143+
145144
- script : |
146145
echo $0
147146
if pgrep -x "Ans.Dpf.Grpc" > /dev/null
@@ -155,12 +154,13 @@ jobs:
155154
- job: DocumentationLinux
156155
variables:
157156
python.version: '3.7' # due to VTK 8.1.2 requirement for docbuild
157+
ANSYS_VERSION: 221
158158
PYANSYS_OFF_SCREEN: True
159159
DPF_PORT: 50055
160160
TEMP: $(System.DefaultWorkingDirectory)/temp
161-
AWP_ROOT212: $(System.DefaultWorkingDirectory)/server/v212
161+
AWP_ROOT221: $(System.DefaultWorkingDirectory)/server/v$(ANSYS_VERSION)
162162
GH_DOC_BRANCH: 'gh-pages'
163-
163+
vstsPackageVersion: "22.1.1"
164164
pool:
165165
vmImage: 'ubuntu-20.04'
166166
steps:
@@ -174,6 +174,7 @@ jobs:
174174
sphinx-apidoc -o docs/source/api ansys ansys/dpf/core/aeneid.py -f --implicit-namespaces --separate --no-headings
175175
xvfb-run make -C docs html SPHINXOPTS="-w build_errors.txt -N"
176176
displayName: Build Documentation
177+
retryCountOnTaskFailure: 1 # Max number of retries; default is zero
177178
178179
- task: ArchiveFiles@2
179180
inputs:
@@ -183,13 +184,15 @@ jobs:
183184
archiveFile: '$(System.DefaultWorkingDirectory)/docs/archive/doc-ansys-dpf-core.zip'
184185
replaceExistingArchive: true
185186
displayName: 'DOCUMENTATION: zip artifacts'
187+
condition: always()
186188

187189
- task: PublishBuildArtifacts@1
188190
displayName: 'DOCUMENTATION: publish artifacts'
189191
inputs:
190192
PathtoPublish: '$(System.DefaultWorkingDirectory)/docs/archive'
191193
ArtifactName: doc-ansys-dpf-core
192-
enabled: true
194+
enabled: true
195+
condition: always()
193196

194197
- powershell: |
195198
git init

.ci/build_doc.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
ECHO %AWP_ROOT212%
21
set SPHINX_APIDOC_OPTIONS=inherited-members
32
call sphinx-apidoc -o ../docs/source/api ../ansys ../ansys/dpf/core/aeneid.py -f --implicit-namespaces --separate --no-headings
43
pushd .

.ci/edit_ansys_version.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sys
2+
import pkgutil
3+
import os
4+
5+
if __name__ == "__main__":
6+
directory = os.path.dirname(pkgutil.get_loader("ansys.dpf.core").path)
7+
file_path = os.path.join(directory, "_version.py")
8+
for i, arg in enumerate(sys.argv):
9+
if arg == "--version":
10+
print(sys.argv[i+1])
11+
version = sys.argv[i+1]
12+
file = open(file_path, 'r')
13+
lines = file.readlines()
14+
for i, line in enumerate(lines):
15+
if "__ansys_version__" in line:
16+
lines[i] = f'__ansys_version__ = "{version}"\n'
17+
file.close()
18+
with open(file_path, 'w') as file:
19+
file.writelines(lines)

.ci/templates/prepare-environment-linux.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ steps:
1515
displayName: Install OS packages
1616
1717
- script: |
18+
.ci/setup_headless_display.sh
1819
pip install -r .ci/requirements_test_xvfb.txt
1920
xvfb-run python .ci/display_test.py
2021
displayName: Test virtual framebuffer
22+
continueOnError: true
2123
2224
- script: |
2325
pip install -r requirements_build.txt
@@ -29,14 +31,21 @@ steps:
2931
xvfb-run python -c "from ansys.dpf import core; print(core.Report())"
3032
displayName: Install ansys-dpf-core
3133
34+
- task: PythonScript@0
35+
inputs:
36+
scriptSource: 'filePath'
37+
scriptPath: ".ci/edit_ansys_version.py"
38+
arguments: "--version $(ANSYS_VERSION)"
39+
displayName: "Set ansys version"
40+
3241
- task: UniversalPackages@0
3342
inputs:
3443
command: "download"
3544
downloadDirectory: "$(System.DefaultWorkingDirectory)"
3645
feedsToUse: "internal"
3746
vstsFeed: "705e121a-9631-49f5-8aaf-c7142856f923"
3847
vstsFeedPackage: "dpf-linux" #TODO: update hash of packages
39-
vstsPackageVersion: "21.2.5"
48+
vstsPackageVersion: $(vstsPackageVersion)
4049
displayName: Download DPF linux package
4150

4251
- script: |
@@ -54,11 +63,13 @@ steps:
5463
displayName: Display env
5564
5665
- script: |
57-
cd ${AWP_ROOT212}/aisol/bin/linx64
66+
cd ${AWP_ROOT$(ANSYS_VERSION)}/aisol/bin/linx64
5867
pwd
5968
chmod 755 Ans.Dpf.Grpc.sh
6069
chmod 755 Ans.Dpf.Grpc.exe
6170
./Ans.Dpf.Grpc.sh --port 50054 & > log.txt
6271
export DPF_IP=$(hostname -i)
6372
python -c "from ansys.dpf import core; core.connect_to_server(ip= '${DPF_IP}', port=50054); print('Python Connected')"
6473
displayName: Start DPF Server
74+
timeoutInMinutes: 1
75+
retryCountOnTaskFailure: 1 # Max number of retries; default is zero

.ci/templates/prepare-environment-windows.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
steps:
1+
steps:
2+
- powershell: |
3+
$curDir = Get-Location
4+
New-Variable -Name "AWP_ROOT$($env:ANSYS_VERSION)" -Value $curDir\server\v$env:ANSYS_VERSION -Force
5+
write-host "##vso[task.setvariable variable=$((Get-Variable -Name "AWP_ROOT$($env:ANSYS_VERSION)").Name)]$((Get-Variable -Name "AWP_ROOT$($env:ANSYS_VERSION)").Value)"
6+
7+
"$((Get-Variable -Name "AWP_ROOT$($env:ANSYS_VERSION)").Value)"
8+
displayName: 'Set AWP_ROOT$(ANSYS_VERSION)'
9+
condition: always()
10+
211
- powershell: |
312
Set-StrictMode -Version Latest
413
$ErrorActionPreference = "Stop"
@@ -22,32 +31,41 @@ steps:
2231
inputs:
2332
artifactFeeds: 'pyansys'
2433
onlyAddExtraIndex: true
25-
34+
2635
- script: |
2736
pip install -r requirements_build.txt
2837
python setup.py bdist_wheel
2938
FOR /F %%a in ('dir /s/b dist\*.whl') do SET WHEELPATH=%%a
3039
ECHO %WHEELPATH%
3140
pip install %WHEELPATH%
3241
cd tests
33-
python -c "from ansys.dpf import core; print(core.Report(gpu=False))"
42+
python -c "from ansys.dpf import core; print(core.Report(gpu=False))"
3443
3544
displayName: Install ansys-dpf-core
3645
46+
- task: PythonScript@0
47+
inputs:
48+
scriptSource: 'filePath'
49+
scriptPath: ".ci/edit_ansys_version.py"
50+
arguments: "--version $(ANSYS_VERSION)"
51+
displayName: "Set ansys version"
52+
3753
- task: UniversalPackages@0
3854
inputs:
3955
command: 'download'
4056
downloadDirectory: '$(System.DefaultWorkingDirectory)'
4157
feedsToUse: 'internal'
4258
vstsFeed: '705e121a-9631-49f5-8aaf-c7142856f923'
4359
vstsFeedPackage: 'dpf-windows'
44-
vstsPackageVersion: '21.2.3'
60+
vstsPackageVersion: $(vstsPackageVersion)
4561

4662
- script: |
4763
@echo on
48-
dir $(System.DefaultWorkingDirectory)\server\v212\aisol\bin\winx64
49-
set THISDIR=$(System.DefaultWorkingDirectory)
50-
cd %THISDIR%\server\v212\aisol\bin\winx64
64+
cd %AWP_ROOT$(ANSYS_VERSION)%\aisol\bin\winx64
65+
dir %AWP_ROOT$(ANSYS_VERSION)%\aisol\bin\winx64
66+
echo %AWP_ROOT$(ANSYS_VERSION)%
5167
START /B Ans.Dpf.Grpc.bat --address 127.0.0.1 --port %DPF_PORT% > log.txt 2>&1
5268
python -c "from ansys.dpf import core; core.connect_to_server(port=$(DPF_PORT)); print('Python Connected')"
53-
displayName: Start DPF Server
69+
displayName: Start DPF Server
70+
timeoutInMinutes: 1
71+
retryCountOnTaskFailure: 1 # Max number of retries; default is zero
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
steps:
3+
- script: |
4+
pip install -r requirements_test.txt
5+
displayName: Install Test Environment
6+
condition: always()
7+
8+
- script: |
9+
xvfb-run python .ci/run_examples.py
10+
displayName: "Run example scripts"
11+
timeoutInMinutes: 15
12+
condition: always()
13+
14+
- script: |
15+
pip install pytest-azurepipelines
16+
cd tests
17+
export DPF_IP=$(hostname -i)
18+
xvfb-run pytest -v -k "not workflow" --junitxml=junit/test-results.xml --cov ansys.dpf.core --cov-report=xml --reruns 2
19+
displayName: Test Core API
20+
condition: always()
21+
22+
- task: PublishTestResults@2
23+
inputs:
24+
testResultsFormat: 'JUnit'
25+
testResultsFiles: 'junit/test-result*.xml'
26+
testRunTitle: 'linuxTests$(ANSYS_VERSION)'
27+
publishRunAttachments: true
28+
searchFolder: 'tests/'
29+
condition: always()
30+
displayName: Publish tests

0 commit comments

Comments
 (0)