Skip to content

Update generated code #233

Update generated code

Update generated code #233

name: Update generated code
on:
# Can be called manually or remotely
workflow_dispatch:
inputs:
distinct_id:
description: "ID to give the job when run via dpf-standalone repo"
required: false
type: string
default: ""
ANSYS_VERSION:
description: "ANSYS version"
required: false
type: string
default: "251"
standalone_branch_suffix:
description: "Suffix of the branch on standalone"
required: false
type: string
default: ''
env:
PACKAGE_NAME: ansys-dpf-core
MODULE: core
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}
ANSYS_DPF_ACCEPT_LA: Y
jobs:
update_generated:
name: "Update Generated Code"
runs-on: windows-latest
steps:
- name: echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo ${{ github.event.inputs.distinct_id }}
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: "Install DPF"
id: set-server-path
uses: ansys/pydpf-actions/install-dpf-server@v2.3
with:
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
ANSYS_VERSION : ${{ github.event.inputs.ANSYS_VERSION || '251' }}
- name: "Update ansys-grpc-dpf"
shell: bash
run: |
wheel_file=$(find ./dpf-standalone/v${{ github.event.inputs.ANSYS_VERSION }}/dist -name "ansys_grpc_dpf-*" -type f)
echo $wheel_file
rm -r src/ansys/grpc
unzip -o $wheel_file "ansys/**/*" -d src/
chmod -R 777 src/ansys/grpc
git add -f src/ansys/grpc
- name: "Update ansys-dpf-gate"
shell: bash
run: |
wheel_file=$(find ./dpf-standalone/v${{ github.event.inputs.ANSYS_VERSION }}/dist -name "ansys_dpf_gate-*" -type f)
echo $wheel_file
rm -r src/ansys/dpf/gate/generated
unzip -o $wheel_file "ansys/dpf/gate/generated/*" -d src/
unzip -o $wheel_file "ansys/dpf/gate/__init__.py" -d src/
chmod -R 777 src/ansys/dpf/gate
git add -f src/ansys/dpf/gate
- name: "Update ansys-dpf-gatebin lin"
shell: bash
run: |
wheel_file=$(find ./dpf-standalone/v${{ github.event.inputs.ANSYS_VERSION }}/dist -name "ansys_dpf_gatebin-*linux1*" -type f)
echo $wheel_file
rm -r src/ansys/dpf/gatebin
unzip -o $wheel_file "ansys/**/*" -d src/
chmod -R 777 src/ansys/dpf/gatebin
- name: "Update ansys-dpf-gatebin win"
shell: bash
run: |
wheel_file=$(find ./dpf-standalone/v${{ github.event.inputs.ANSYS_VERSION }}/dist -name "ansys_dpf_gatebin-*win*" -type f)
echo $wheel_file
unzip -o $wheel_file "ansys/**/*" -d src/
chmod -R 777 src/ansys/dpf/gatebin
git add -f src/ansys/dpf/gatebin
- name: "Install local package as editable"
shell: bash
run: |
pip install --find-links=.github/ -e .
- name: "Install requirements_build"
run: |
pip install -r requirements/requirements_build.txt
- name: "List installed packages"
shell: bash
run: pip list
- name: "Generate Operators"
shell: bash
working-directory: .ci
run: |
python code_generation.py
timeout-minutes: 5
- name: "Generate Operators Documentation"
shell: bash
working-directory: .ci
run: |
python build_operators_doc.py
timeout-minutes: 5
- name: "Show changes"
shell: bash
run: |
git status
- name: "Create Pull Request"
uses: peter-evans/create-pull-request@v4
with:
delete-branch: true
add-paths: |
src/ansys/dpf/gate/*
src/ansys/dpf/gatebin/*
src/ansys/grpc/*
src/ansys/dpf/core/operators/*
doc/source/_static/dpf_operators.html
commit-message: update generated code
title: Update generated code for DPF ${{ github.event.inputs.ANSYS_VERSION || '251' }}${{ github.event.inputs.standalone_branch_suffix || '' }} on ${{ github.ref_name }}
body: An update of generated code has been triggered either manually or by an update in the dpf-standalone repository.
branch: maint/update_code_for_${{ github.event.inputs.ANSYS_VERSION || '251' }}${{ github.event.inputs.standalone_branch_suffix || '' }}_on_${{ github.ref_name }}
labels: server-sync
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
reviewers: ansys/dpf_integration_proxies
assignees: ansys/dpf_integration_proxies
- name: "Kill all servers"
uses: ansys/pydpf-actions/kill-dpf-servers@v2.3
if: always()