@@ -2,6 +2,11 @@ name: CI
22on :
33 pull_request :
44 workflow_dispatch :
5+ inputs :
6+ PyDynaRunContainer :
7+ description : ' Run container name'
8+ required : false
9+ default : ghcr.io/ansys/pydyna-run:latest
510 push :
611 tags :
712 - " *"
1318 PACKAGE_NAME : ' ansys-dyna-core'
1419 PACKAGE_NAMESPACE : ' ansys.dyna.core'
1520 DOCUMENTATION_CNAME : " dyna.docs.pyansys.com"
21+ PYDYNA_RUN_CONTAINER : ${{ github.event.inputs.PyDynaRunContainer || 'ghcr.io/ansys/pydyna-run:latest'}}
1622
1723concurrency :
1824 group : ${{ github.workflow }}-${{ github.ref }}
1925 cancel-in-progress : true
2026
2127jobs :
2228
29+ update-changelog :
30+ name : " Update CHANGELOG (on release)"
31+ if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
32+ runs-on : ubuntu-latest
33+ permissions :
34+ contents : write
35+ pull-requests : write
36+ steps :
37+ - uses : ansys/actions/doc-deploy-changelog@v8
38+ with :
39+ token : ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
40+ bot-user : ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
41+ bot-email : ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
42+
43+ pr-name :
44+ if : github.event_name == 'pull_request'
45+ name : Check the name of the PR
46+ runs-on : ubuntu-latest
47+ steps :
48+ - name : Check commit name
49+ uses : ansys/actions/check-pr-title@v8
50+ with :
51+ token : ${{ secrets.GITHUB_TOKEN }}
52+
2353 code-style :
2454 name : " Code style"
2555 runs-on : ubuntu-latest
2858 with :
2959 python-version : ${{ env.MAIN_PYTHON_VERSION }}
3060
61+ codegen-testing :
62+ name : Build and Testing for codegen
63+ runs-on : ubuntu-latest
64+
65+ steps :
66+ - uses : actions/checkout@v4
67+ - name : Setup Python
68+ uses : actions/setup-python@v5
69+ with :
70+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
71+
72+ - name : Install library
73+ run : pip install -e .[codegen]
74+
75+ - name : Generate codegen
76+ run : |
77+ python codegen/generate.py -c
78+ python codegen/generate.py
79+
80+ - name : Run codegen testing
81+ run : |
82+ if git -C src/ansys/dyna/core/keywords/keyword_classes/auto diff --relative --exit-code; then
83+ echo "CHANGES=false" >> "$GITHUB_ENV"
84+ else
85+ echo "CHANGES=true" >> "$GITHUB_ENV"
86+ fi
87+ - name : Exit on changes
88+ if : ${{ env.CHANGES == 'true' }}
89+ run : exit 1
90+
3191 doc-style :
3292 name : " Documentation style"
3393 runs-on : ubuntu-latest
@@ -60,31 +120,44 @@ jobs:
60120 - name : " Install python dependencies"
61121 run : |
62122 python -m pip install .[doc]
63-
123+ # optional dependency for `run_dyna` to work with docker.
124+ # TODO - consider adding to pyproject.toml under an option
125+ python -m pip install docker
64126 - name : " Login to GitHub container registry"
65127 uses : docker/login-action@v3
66128 with :
67129 registry : ghcr.io
68130 username : ${{ github.actor }}
69131 password : ${{ secrets.GITHUB_TOKEN }}
70132
71- - name : " Install and run DPF server"
133+ - name : Set Licensing
134+ shell : bash
72135 run : |
73- docker pull ghcr.io/ansys/dpf-core:22.2dev
74- docker run -d --name dpfserver -p 50054:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port 50054."
136+ echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV
137+
138+ - name : Install DPF
139+ uses :
ansys/pydpf-actions/[email protected] 140+ with :
141+ dpf-standalone-TOKEN : ${{secrets.PYANSYS_CI_BOT_TOKEN}}
142+ ANSYS_VERSION : " 242"
75143
76144 - name : LS-DYNA Keyword server activation
77145 run : |
78146 docker pull ghcr.io/ansys/ls-pre:latest
79147 docker run -d --name kw_server -p 50051:50051 ghcr.io/ansys/ls-pre:latest && echo "Keyword server active on port 50051."
80148
81- - name : " Build the html documentation "
149+ - name : Pull PyDyna-run image
82150 run : |
83- xvfb-run make -C doc html
151+ docker pull ghcr.io/ansys/pydyna-run:latest
84152
85- - name : " Build the pdf documentation"
153+ - name : " Build the html documentation"
154+ env :
155+ ANSYSLI_SERVERS : 2325@${{secrets.LICENSE_SERVER}}
156+ ANSYSLMD_LICENSE_FILE : 1055@${{secrets.LICENSE_SERVER}}
157+ LSTC_LICENSE : ansys
158+ PYDYNA_RUN_CONTAINER : ${{ env.PYDYNA_RUN_CONTAINER }}
86159 run : |
87- make -C doc pdf
160+ xvfb-run make -C doc html
88161
89162 - name : " Upload html documentation"
90163 uses : actions/upload-artifact@v4
@@ -93,6 +166,17 @@ jobs:
93166 path : doc/_build/html
94167 retention-days : 7
95168
169+ - name : " Build the pdf documentation"
170+ env :
171+ ANSYSLI_SERVERS : 2325@${{secrets.LICENSE_SERVER}}
172+ ANSYSLMD_LICENSE_FILE : 1055@${{secrets.LICENSE_SERVER}}
173+ LSTC_LICENSE : ansys
174+ PYDYNA_RUN_CONTAINER : ${{ env.PYDYNA_RUN_CONTAINER }}
175+ PYDYNA_RUN_STREAM : " 0"
176+ run : |
177+ xvfb-run make -C doc pdf
178+
179+
96180 - name : " Upload pdf documentation"
97181 uses : actions/upload-artifact@v4
98182 with :
@@ -112,12 +196,6 @@ jobs:
112196 name : server_output_docs.txt
113197 path : server_output.txt
114198
115- - name : DPF Logs (on screen)
116- if : always()
117- run : |
118- docker logs dpfserver
119- docker stop dpfserver
120-
121199 smoke-tests :
122200 name : " Build wheelhouse for ${{ matrix.os }} and Python ${{ matrix.python-version }}"
123201 runs-on : ${{ matrix.os }}
@@ -126,7 +204,7 @@ jobs:
126204 fail-fast : false
127205 matrix :
128206 os : [windows-latest, ubuntu-latest]
129- python-version : ['3.9', '3. 10', '3.11', '3.12']
207+ python-version : ['3.10', '3.11', '3.12']
130208 steps :
131209 - uses : ansys/actions/build-wheelhouse@v8
132210 with :
@@ -192,37 +270,33 @@ jobs:
192270 name : Test the "run" subpackage
193271 runs-on : ubuntu-latest
194272 needs : [code-style]
195- container :
196- image : ghcr.io/ansys/mechanical:24.1.0
197- options : --entrypoint /bin/bash
198273
199274 steps :
200275 - uses : actions/checkout@v4
201276
202- - name : Install dependencies
277+ - name : " Set up Python ${{ env.MAIN_PYTHON_VERSION }}"
278+ uses : actions/setup-python@v5
279+ with :
280+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
281+ cache : ' pip'
282+ cache-dependency-path : ' pyproject.toml'
283+
284+ - name : " Install python dependencies"
203285 run : |
204- apt update
205- apt install --reinstall ca-certificates
206- apt install software-properties-common git -y
207- add-apt-repository ppa:deadsnakes/ppa -y
208- apt install python3.11 python3.11-venv -y
209- python3.11 -m ensurepip --default-pip
210- python3.11 -m pip install --upgrade pip
211- python3.11 -m venv /env
286+ python -m pip install docker # todo make this an option?
287+ python -m pip install .[tests]
212288
213- - name : Install library
289+ - name : Pull PyDyna-run image
214290 run : |
215- . /env/bin/activate
216- pip install .[tests]
291+ docker pull ${{ env.PYDYNA_RUN_CONTAINER }}
217292
218293 - name : Unit testing
219294 env :
295+ PYDYNA_RUN_CONTAINER : ${{ env.PYDYNA_RUN_CONTAINER }}
220296 ANSYSLI_SERVERS : 2325@${{secrets.LICENSE_SERVER}}
221297 ANSYSLMD_LICENSE_FILE : 1055@${{secrets.LICENSE_SERVER}}
222298 LSTC_LICENSE : ansys
223299 run : |
224- . /env/bin/activate
225- save-ansys-path --name dyna /install/ansys_inc/v241/ansys/bin/linx64/lsdyna_dp.e
226300 pytest -m run
227301
228302 build-library :
@@ -238,7 +312,7 @@ jobs:
238312 release :
239313 name : Release project
240314 if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
241- needs : [build-library]
315+ needs : [update-changelog, build-library]
242316 runs-on : ubuntu-latest
243317 steps :
244318 - name : " Release to the public PyPI repository"
0 commit comments