Skip to content

Commit f5fe6d0

Browse files
authored
Merge branch 'main' into pr_metalforming
2 parents 685f4f2 + 0551ae1 commit f5fe6d0

File tree

3,322 files changed

+1890169
-908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,322 files changed

+1890169
-908
lines changed

.devcontainer/devcontainer.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "Python 3",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
7+
8+
// Features to add to the dev container. More info: https://containers.dev/features.
9+
// "features": {},
10+
11+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
12+
// "forwardPorts": [],
13+
14+
// Use 'postCreateCommand' to run commands after the container is created.
15+
"postCreateCommand": "echo 'Installing dependencies...' && pip3 install -e '.[test,codegen]' && pip3 install pre-commit && pre-commit install --install-hooks",
16+
17+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
18+
// "remoteUser": "root"
19+
20+
// Configure tool-specific properties.
21+
"customizations": {
22+
// Configure properties specific to VSCode.
23+
"vscode": {
24+
"openFiles": [
25+
".devcontainer/welcome.rst"
26+
],
27+
"extensions": [
28+
"ms-python.python"
29+
],
30+
"settings": {
31+
"terminal.integrated.defaultProfile.linux": "bash",
32+
"python.testing.pytestArgs": [
33+
"tests"
34+
],
35+
"python.testing.unittestEnabled": false,
36+
"python.testing.pytestEnabled": true
37+
}
38+
}
39+
}
40+
}

.devcontainer/welcome.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Welcome to VSCode DevContainer!
2+
===============================
3+
4+
This Devcontainer has been specifically set for developing and/or documenting PyDyna.
5+

.github/workflows/ci_cd.yml

Lines changed: 107 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: CI
22
on:
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
- "*"
@@ -13,13 +18,38 @@ env:
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

1723
concurrency:
1824
group: ${{ github.workflow }}-${{ github.ref }}
1925
cancel-in-progress: true
2026

2127
jobs:
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
@@ -28,6 +58,36 @@ jobs:
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"

.github/workflows/label.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,18 @@ jobs:
8989
- [maintenance](https://github.com/pyansys/pyDyna/pulls?q=label%3Amaintenance+)
9090
- [release](https://github.com/pyansys/pyDyna/pulls?q=label%3Arelease+)
9191
- [testing](https://github.com/pyansys/pyDyna/pulls?q=label%Atesting+)
92+
93+
changelog-fragment:
94+
name: "Create changelog fragment"
95+
needs: [commenter]
96+
permissions:
97+
contents: write
98+
pull-requests: write
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: ansys/actions/doc-changelog@v8
102+
with:
103+
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
104+
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
105+
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
106+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Docker images publishing
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tagVersion:
7+
description: 'Tag'
8+
required: false
9+
default: latest
10+
push:
11+
tags:
12+
- "*"
13+
branches:
14+
- main
15+
16+
env:
17+
REGISTRY: ghcr.io
18+
REPO_NAME: ${{ github.repository }}
19+
IMAGE_TAG: ${{ github.event.inputs.tagVersion || 'latest'}}
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
docker-images:
27+
name: Build the pydyna-run docker image
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Setup Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Login to ghcr.io
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Build and export to Docker
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: docker/run
47+
file: docker/run/Dockerfile
48+
push: true
49+
tags: ${{ env.REGISTRY }}/ansys/pydyna-run:${{ env.IMAGE_TAG }}
50+
cache-from: type=registry,ref=${{ env.REGISTRY }}/ansys/pydyna-run:latest

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ dist/
1818
downloads/
1919
eggs/
2020
.eggs/
21-
lib/
22-
lib64/
21+
.lib/
22+
.lib64/
2323
parts/
2424
sdist/
2525
var/
@@ -164,4 +164,4 @@ cython_debug/
164164
# Ignore rendered examples
165165
doc/source/examples/
166166
doc/source/API/_autosummary/
167-
doc/source/autoapi
167+
doc/source/autoapi

0 commit comments

Comments
 (0)