-
Notifications
You must be signed in to change notification settings - Fork 2
216 lines (188 loc) · 7.42 KB
/
geometry-mesh.yml
File metadata and controls
216 lines (188 loc) · 7.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Geometry Mesh Workflow
on:
workflow_dispatch:
inputs:
doc-build:
required: false
default: false
type: boolean
description: 'Whether to build the documentation'
workflow_call:
inputs:
doc-build:
required: false
default: false
type: boolean
description: 'Whether to build the documentation'
push:
branches:
- main
pull_request:
paths:
- 'geometry-mesh/**'
env:
MAIN_PYTHON_VERSION: '3.12'
GEOMETRY_DOCKER_IMAGE: 'ghcr.io/ansys/geometry'
PRIME_DOCKER_IMAGE: 'ghcr.io/ansys/prime'
ANSRV_GEO_PORT: 700
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
PYPRIMEMESH_LAUNCH_CONTAINER: 1
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER )}}
ANSYS_RELEASE_FOR_DOCS: 25.1
jobs:
is-only-docs-required:
uses: ./.github/workflows/check-docs-required.yml
with:
doc-build: ${{ inputs.doc-build || false }}
geometry:
name: Geometry
runs-on: [self-hosted, Windows, pyansys-workflows]
needs: is-only-docs-required
strategy:
fail-fast: false
matrix:
ansys-release: ${{ needs.is-only-docs-required.outputs.only-docs == 'true' && fromJSON('[25.1]') || fromJSON('[24.1, 24.2, 25.1]') }}
steps:
- name: Checkout code
uses: actions/checkout@v6.0.2
with:
sparse-checkout: |
geometry-mesh
doc
- name: Set up Python ${{ env.MAIN_PYTHON_VERSION }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m venv .venv
.venv/Scripts/activate
pip install -r geometry-mesh/requirements_${{ matrix.ansys-release }}.txt
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download (if needed) and run Geometry service container
run: |
# If we are on 25.1 or above - the tag name is different - remember we are on powershell
if (${{ matrix.ansys-release }} -ge 25.2) {
$env:ANSYS_GEOMETRY_RELEASE = "${{ env.GEOMETRY_DOCKER_IMAGE }}:core-windows-${{ matrix.ansys-release }}"
} else {
$env:ANSYS_GEOMETRY_RELEASE = "${{ env.GEOMETRY_DOCKER_IMAGE }}:windows-${{ matrix.ansys-release }}"
}
Write-Host "Running Geometry service container: $env:ANSYS_GEOMETRY_RELEASE"
# Pull the container image
docker pull $env:ANSYS_GEOMETRY_RELEASE
# Define the ANSYS_GEOMETRY_RELEASE environment variable to be used in the next stages
echo "ANSYS_GEOMETRY_RELEASE=$env:ANSYS_GEOMETRY_RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Run the PyAnsys Geometry script
run: |
.venv/Scripts/activate
python geometry-mesh/wf_gm_01_geometry.py
- name: Store the outputs
uses: actions/upload-artifact@v6
with:
name: geometry-mesh-workflow-geometry-outputs-${{ matrix.ansys-release }}
path: geometry-mesh/outputs
- name: (DOCS) Build the documentation (only on ${{ env.ANSYS_RELEASE_FOR_DOCS}})
if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS
env:
BUILD_DOCS_SCRIPT: 'geometry-mesh/wf_gm_01_geometry.py'
run: |
.venv/Scripts/activate
cd doc
pip install -r requirements.txt
./make.bat html
- name: (DOCS) Upload docs artifacts
if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS
uses: actions/upload-artifact@v6
with:
name: geometry-mesh-docs-stage-geometry
path: |
doc/_build/
doc/source/examples/geometry-mesh/
- name: Stop any remaining containers
if: always()
run: |
$dockerContainers = docker ps -a -q
if (-not [string]::IsNullOrEmpty($dockerContainers)) {
docker rm -f $dockerContainers
}
prime:
name: Meshing
runs-on: ubuntu-latest
needs: [geometry, is-only-docs-required]
strategy:
fail-fast: false
matrix:
ansys-release: ${{ needs.is-only-docs-required.outputs.only-docs == 'true' && fromJSON('[25.1]') || fromJSON('[24.1, 24.2, 25.1]') }}
steps:
- name: Checkout code
uses: actions/checkout@v6.0.2
with:
sparse-checkout: |
geometry-mesh
doc
- name: Set up Python ${{ env.MAIN_PYTHON_VERSION }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r geometry-mesh/requirements_${{ matrix.ansys-release }}.txt
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download PRIME service container
run: docker pull ${{ env.PRIME_DOCKER_IMAGE }}:${{ matrix.ansys-release }}
- name: Check out the geometry outputs
uses: actions/download-artifact@v7
with:
name: geometry-mesh-workflow-geometry-outputs-${{ matrix.ansys-release }}
path: geometry-mesh/outputs
- name: Run the PyPrimeMesh script
env:
PYPRIMEMESH_IMAGE_TAG: ${{ matrix.ansys-release }}
run: |
python geometry-mesh/wf_gm_02_mesh.py
- name: Store the outputs
uses: actions/upload-artifact@v6
with:
name: geometry-mesh-workflow-prime-outputs-${{ matrix.ansys-release }}
path: geometry-mesh/outputs
- name: (DOCS) Download the docs artifacts
uses: actions/download-artifact@v7
if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS
with:
name: geometry-mesh-docs-stage-geometry
path: doc
- name: (DOCS) Build the documentation (only on ${{ env.ANSYS_RELEASE_FOR_DOCS}})
if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS
env:
PYPRIMEMESH_IMAGE_TAG: ${{ matrix.ansys-release }}
BUILD_DOCS_SCRIPT: 'geometry-mesh/wf_gm_02_mesh.py'
run: |
cd doc
find . -type f -exec sed -i 's|C:\\Users\\ansys\\actions-runner\\_work\\pyansys-workflows\\pyansys-workflows\\doc\\source\\examples\\geometry-mesh\\images\\|./images/|g' {} +
pip install -r requirements.txt
make html
- name: (DOCS) Upload docs artifacts
if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS
uses: actions/upload-artifact@v6
with:
name: geometry-mesh-docs
path: |
doc/_build/
doc/source/examples/geometry-mesh/
overwrite: true