examples #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: examples | |
on: | |
# Can be called by the CI | |
workflow_call: | |
inputs: | |
python_versions: | |
required: false | |
type: string | |
default: '["3.9"]' | |
ANSYS_VERSION: | |
required: false | |
type: string | |
default: "251" | |
standalone_suffix: | |
description: "Suffix of the branch on standalone" | |
required: false | |
type: string | |
default: '' | |
# Can be called manually | |
workflow_dispatch: | |
inputs: | |
python_versions: | |
description: "Python interpreters to test." | |
required: true | |
type: string | |
default: '["3.9"]' | |
ANSYS_VERSION: | |
description: "ANSYS version to run." | |
required: true | |
type: string | |
default: "251" | |
standalone_suffix: | |
description: "Suffix of the branch on standalone" | |
required: false | |
type: string | |
default: '' | |
env: | |
PACKAGE_NAME: ansys-dpf-core | |
MODULE: core | |
jobs: | |
setup: | |
name: "Setup" | |
runs-on: ubuntu-latest | |
outputs: | |
python_versions: ${{ steps.set_array.outputs.python_versions }} | |
steps: | |
- id: set_array | |
run: | | |
echo "python_versions=${{ toJSON(inputs.python_versions) }}" >> $GITHUB_OUTPUT | |
examples: | |
name: "Run Examples" | |
needs: setup | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ${{ fromJSON(needs.setup.outputs.python_versions) }} | |
os: ["windows-latest", "ubuntu-latest"] | |
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 requirements" | |
run: pip install -r requirements/requirements_build.txt | |
- name: "Build the 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 the 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 package 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: "Prepare Testing Environment" | |
uses: ansys/pydpf-actions/[email protected] | |
with: | |
DEBUG: true | |
- name: "List installed packages" | |
shell: bash | |
run: pip list | |
- name: "Run examples" | |
shell: bash | |
working-directory: .ci | |
run: | | |
echo on | |
python run_examples.py | |
- name: "Kill all servers" | |
uses: ansys/pydpf-actions/[email protected] | |
if: always() |