Skip to content

PyDPF-Post testing

PyDPF-Post testing #19

Workflow file for this run

name: PyDPF-Post testing
on:
# Can be called by the CI
workflow_call:
inputs:
post_branch:
default: ''
type: string
ANSYS_VERSION:
required: false
type: string
default: "251"
standalone_suffix:
description: "Suffix of the branch on standalone"
required: false
type: string
default: ''
test_docstrings:
description: "whether to run doctest"
required: false
type: string
default: "false"
# Can be called manually
workflow_dispatch:
inputs:
post_branch:
description: 'PyDPF-Post branch or tag to test. Leave empty to get latest tagged version'
default: ''
type: string
ANSYS_VERSION:
description: "ANSYS version"
required: true
type: string
default: "251"
standalone_suffix:
description: "Suffix of the branch on standalone"
required: false
type: string
default: ''
test_docstrings:
description: "whether to run doctest"
required: false
type: string
default: "false"
env:
PACKAGE_NAME: ansys-dpf-core
MODULE: core
jobs:
Clone_and_Test:
name: Clone and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-latest", "ubuntu-latest"]
python-version: ["3.9"]
steps:
- uses: actions/checkout@v4
- name: "Set licensing if necessary"
if: inputs.ANSYS_VERSION > 231
shell: bash
run: |
echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV
echo "ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}" >> $GITHUB_ENV
- name: "Setup Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: "Install ansys-dpf-core build requirements"
run: pip install -r requirements/requirements_build.txt
- name: "Build ansys-dpf-core wheel"
shell: bash
run: |
if [ ${{ matrix.os }} == "ubuntu-latest" ]; then
export platform="manylinux_2_17"
else
export platform="win"
fi
python .ci/build_wheel.py -p $platform -w
- name: "Expose ansys-dpf-core wheel"
shell: bash
id: wheel
working-directory: dist
run: |
export name=`ls ansys_dpf_core*.whl`
echo ${name}
echo "wheel_name=${name[0]}" >> $GITHUB_OUTPUT
- name: "Install ansys-dpf-core wheel"
shell: bash
run: |
pip install dist/${{ steps.wheel.outputs.wheel_name }}[plotting]
- name: "Install DPF"
id: set-server-path
uses: ansys/pydpf-actions/[email protected]
with:
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
standalone_suffix: ${{ inputs.standalone_suffix }}
ANSYS_VERSION : ${{inputs.ANSYS_VERSION}}
- name: "Check licences of packages"
uses: ansys/pydpf-actions/[email protected]
- name: "Test import"
shell: bash
working-directory: tests
run: python -c "from ansys.dpf import core"
- name: "Clone PyDPF-Post"
shell: bash
run: |
REPO="https://github.com/ansys/pydpf-post.git"
BranchName=${{ inputs.post_branch }}
echo branch="$BranchName"
if [ "$BranchName" = '' ];
then
BranchName=$(git ls-remote --tags --refs $REPO | tail -n1 | cut -d/ -f3)
fi
echo branch=$BranchName
git clone --single-branch --branch "$BranchName" $REPO
- name: "Install PyDPF-Post"
shell: bash
run: |
cd pydpf-post
pip install .
ls
- name: "Prepare Testing Environment"
uses: ansys/pydpf-actions/[email protected]
with:
DEBUG: true
working-directory: pydpf-post
- name: "List installed packages"
shell: bash
run: pip list
- name: "Test Docstrings"
uses: ansys/pydpf-actions/[email protected]
with:
MODULE: post
PACKAGE_NAME: ansys-dpf-post
working-directory: pydpf-post/src
if: inputs.test_docstrings == 'true'
timeout-minutes: 10
- name: "Test API"
shell: bash
working-directory: pydpf-post/tests
run: |
pytest $DEBUG --reruns 2 .
if: always()
timeout-minutes: 20
- name: "Kill all servers"
uses: ansys/pydpf-actions/[email protected]