Skip to content

Commit

Permalink
Merge branch 'main' into pr_metalforming
Browse files Browse the repository at this point in the history
  • Loading branch information
RobPasMue authored Nov 26, 2024
2 parents 685f4f2 + 0551ae1 commit f5fe6d0
Show file tree
Hide file tree
Showing 3,322 changed files with 1,890,169 additions and 908 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "echo 'Installing dependencies...' && pip3 install -e '.[test,codegen]' && pip3 install pre-commit && pre-commit install --install-hooks",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VSCode.
"vscode": {
"openFiles": [
".devcontainer/welcome.rst"
],
"extensions": [
"ms-python.python"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
}
}
}
5 changes: 5 additions & 0 deletions .devcontainer/welcome.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Welcome to VSCode DevContainer!
===============================

This Devcontainer has been specifically set for developing and/or documenting PyDyna.

140 changes: 107 additions & 33 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: CI
on:
pull_request:
workflow_dispatch:
inputs:
PyDynaRunContainer:
description: 'Run container name'
required: false
default: ghcr.io/ansys/pydyna-run:latest
push:
tags:
- "*"
Expand All @@ -13,13 +18,38 @@ env:
PACKAGE_NAME: 'ansys-dyna-core'
PACKAGE_NAMESPACE: 'ansys.dyna.core'
DOCUMENTATION_CNAME: "dyna.docs.pyansys.com"
PYDYNA_RUN_CONTAINER: ${{ github.event.inputs.PyDynaRunContainer || 'ghcr.io/ansys/pydyna-run:latest'}}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

update-changelog:
name: "Update CHANGELOG (on release)"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: ansys/actions/doc-deploy-changelog@v8
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

pr-name:
if: github.event_name == 'pull_request'
name: Check the name of the PR
runs-on: ubuntu-latest
steps:
- name: Check commit name
uses: ansys/actions/check-pr-title@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}

code-style:
name: "Code style"
runs-on: ubuntu-latest
Expand All @@ -28,6 +58,36 @@ jobs:
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

codegen-testing:
name: Build and Testing for codegen
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install library
run: pip install -e .[codegen]

- name: Generate codegen
run: |
python codegen/generate.py -c
python codegen/generate.py
- name: Run codegen testing
run: |
if git -C src/ansys/dyna/core/keywords/keyword_classes/auto diff --relative --exit-code; then
echo "CHANGES=false" >> "$GITHUB_ENV"
else
echo "CHANGES=true" >> "$GITHUB_ENV"
fi
- name: Exit on changes
if: ${{ env.CHANGES == 'true' }}
run: exit 1

doc-style:
name: "Documentation style"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -60,31 +120,44 @@ jobs:
- name: "Install python dependencies"
run: |
python -m pip install .[doc]
# optional dependency for `run_dyna` to work with docker.
# TODO - consider adding to pyproject.toml under an option
python -m pip install docker
- name: "Login to GitHub container registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Install and run DPF server"
- name: Set Licensing
shell: bash
run: |
docker pull ghcr.io/ansys/dpf-core:22.2dev
docker run -d --name dpfserver -p 50054:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port 50054."
echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV
- name: Install DPF
uses: ansys/pydpf-actions/install-dpf-server@v2.3
with:
dpf-standalone-TOKEN: ${{secrets.PYANSYS_CI_BOT_TOKEN}}
ANSYS_VERSION : "242"

- name: LS-DYNA Keyword server activation
run: |
docker pull ghcr.io/ansys/ls-pre:latest
docker run -d --name kw_server -p 50051:50051 ghcr.io/ansys/ls-pre:latest && echo "Keyword server active on port 50051."
- name: "Build the html documentation"
- name: Pull PyDyna-run image
run: |
xvfb-run make -C doc html
docker pull ghcr.io/ansys/pydyna-run:latest
- name: "Build the pdf documentation"
- name: "Build the html documentation"
env:
ANSYSLI_SERVERS: 2325@${{secrets.LICENSE_SERVER}}
ANSYSLMD_LICENSE_FILE: 1055@${{secrets.LICENSE_SERVER}}
LSTC_LICENSE: ansys
PYDYNA_RUN_CONTAINER: ${{ env.PYDYNA_RUN_CONTAINER }}
run: |
make -C doc pdf
xvfb-run make -C doc html
- name: "Upload html documentation"
uses: actions/upload-artifact@v4
Expand All @@ -93,6 +166,17 @@ jobs:
path: doc/_build/html
retention-days: 7

- name: "Build the pdf documentation"
env:
ANSYSLI_SERVERS: 2325@${{secrets.LICENSE_SERVER}}
ANSYSLMD_LICENSE_FILE: 1055@${{secrets.LICENSE_SERVER}}
LSTC_LICENSE: ansys
PYDYNA_RUN_CONTAINER: ${{ env.PYDYNA_RUN_CONTAINER }}
PYDYNA_RUN_STREAM: "0"
run: |
xvfb-run make -C doc pdf
- name: "Upload pdf documentation"
uses: actions/upload-artifact@v4
with:
Expand All @@ -112,12 +196,6 @@ jobs:
name: server_output_docs.txt
path: server_output.txt

- name: DPF Logs (on screen)
if: always()
run: |
docker logs dpfserver
docker stop dpfserver
smoke-tests:
name: "Build wheelhouse for ${{ matrix.os }} and Python ${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}
Expand All @@ -126,7 +204,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: ansys/actions/build-wheelhouse@v8
with:
Expand Down Expand Up @@ -192,37 +270,33 @@ jobs:
name: Test the "run" subpackage
runs-on: ubuntu-latest
needs: [code-style]
container:
image: ghcr.io/ansys/mechanical:24.1.0
options: --entrypoint /bin/bash

steps:
- uses: actions/checkout@v4

- name: Install dependencies
- name: "Set up Python ${{ env.MAIN_PYTHON_VERSION }}"
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'

- name: "Install python dependencies"
run: |
apt update
apt install --reinstall ca-certificates
apt install software-properties-common git -y
add-apt-repository ppa:deadsnakes/ppa -y
apt install python3.11 python3.11-venv -y
python3.11 -m ensurepip --default-pip
python3.11 -m pip install --upgrade pip
python3.11 -m venv /env
python -m pip install docker # todo make this an option?
python -m pip install .[tests]
- name: Install library
- name: Pull PyDyna-run image
run: |
. /env/bin/activate
pip install .[tests]
docker pull ${{ env.PYDYNA_RUN_CONTAINER }}
- name: Unit testing
env:
PYDYNA_RUN_CONTAINER: ${{ env.PYDYNA_RUN_CONTAINER }}
ANSYSLI_SERVERS: 2325@${{secrets.LICENSE_SERVER}}
ANSYSLMD_LICENSE_FILE: 1055@${{secrets.LICENSE_SERVER}}
LSTC_LICENSE: ansys
run: |
. /env/bin/activate
save-ansys-path --name dyna /install/ansys_inc/v241/ansys/bin/linx64/lsdyna_dp.e
pytest -m run
build-library:
Expand All @@ -238,7 +312,7 @@ jobs:
release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build-library]
needs: [update-changelog, build-library]
runs-on: ubuntu-latest
steps:
- name: "Release to the public PyPI repository"
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,18 @@ jobs:
- [maintenance](https://github.com/pyansys/pyDyna/pulls?q=label%3Amaintenance+)
- [release](https://github.com/pyansys/pyDyna/pulls?q=label%3Arelease+)
- [testing](https://github.com/pyansys/pyDyna/pulls?q=label%Atesting+)
changelog-fragment:
name: "Create changelog fragment"
needs: [commenter]
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-changelog@v8
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

50 changes: 50 additions & 0 deletions .github/workflows/publish-run-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Docker images publishing

on:
workflow_dispatch:
inputs:
tagVersion:
description: 'Tag'
required: false
default: latest
push:
tags:
- "*"
branches:
- main

env:
REGISTRY: ghcr.io
REPO_NAME: ${{ github.repository }}
IMAGE_TAG: ${{ github.event.inputs.tagVersion || 'latest'}}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
docker-images:
name: Build the pydyna-run docker image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
context: docker/run
file: docker/run/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/ansys/pydyna-run:${{ env.IMAGE_TAG }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/ansys/pydyna-run:latest
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
.lib/
.lib64/
parts/
sdist/
var/
Expand Down Expand Up @@ -164,4 +164,4 @@ cython_debug/
# Ignore rendered examples
doc/source/examples/
doc/source/API/_autosummary/
doc/source/autoapi
doc/source/autoapi
Loading

0 comments on commit f5fe6d0

Please sign in to comment.