.github/workflows/docs.yml #30
Workflow file for this run
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: docs | |
on: | |
# Can be called by the CI | |
workflow_call: | |
inputs: | |
python_version: | |
required: false | |
type: string | |
default: "3.9" | |
ANSYS_VERSION: | |
required: false | |
type: string | |
default: "242" | |
standalone_suffix: | |
description: "Suffix of the branch on standalone" | |
required: false | |
type: string | |
default: '' | |
event_name: | |
description: "Name of event calling" | |
required: true | |
type: string | |
default: '' | |
# Can be called manually | |
workflow_dispatch: | |
inputs: | |
python_version: | |
description: "Python interpreter" | |
required: true | |
type: string | |
default: "3.9" | |
ANSYS_VERSION: | |
description: "ANSYS version" | |
required: true | |
type: string | |
default: "242" | |
standalone_suffix: | |
description: "Suffix of the branch on standalone" | |
required: false | |
type: string | |
default: '' | |
env: | |
PACKAGE_NAME: ansys-dpf-core | |
MODULE: core | |
jobs: | |
doc-style: | |
name: "Check doc style" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Running documentation style checks" | |
uses: ansys/actions/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
docs: | |
name: "Documentation" | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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/[email protected] | |
with: | |
python-version: ${{ inputs.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: "Setup headless display" | |
uses: pyvista/setup-headless-display-action@v1 | |
- name: "Setup Graphviz" | |
uses: ts-graphviz/setup-graphviz@v1 | |
- name: "Install OS packages" | |
run: | | |
choco install pandoc | |
- name: "Install documentation packages for Python" | |
run: | | |
pip install -r requirements/requirements_docs.txt | |
- name: "Kill all servers" | |
uses: ansys/pydpf-actions/[email protected] | |
- name: "List installed packages" | |
shell: bash | |
run: pip list | |
- name: "Build HTML Documentation" | |
shell: cmd | |
working-directory: .ci | |
run: | | |
build_doc.bat > ..\doc\log.txt && type ..\doc\log.txt 2>&1 | |
timeout-minutes: 60 | |
env: | |
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }} | |
- name: "Check for success" | |
shell: bash | |
working-directory: doc | |
run: | | |
case `grep -F "build succeeded" log.txt >/dev/null; echo $?` in | |
0) | |
echo "Build succeeded!" | |
exit 0;; | |
1) | |
echo "Documentation generation failed, please check previous step!" | |
exit 1;; | |
*) | |
echo "An error occurred while checking success of the previous step!" | |
exit 1;; | |
esac | |
- name: "Kill all servers" | |
uses: ansys/pydpf-actions/[email protected] | |
if: always() | |
- name: "Retrieve package version" | |
shell: bash | |
run: | | |
echo "VERSION=$(python -c "from ansys.dpf.${{env.MODULE}} import __version__; print(__version__)")" >> GITHUB_OUTPUT | |
echo "${{env.PACKAGE_NAME}} version is: $(python -c "from ansys.dpf.${{env.MODULE}} import __version__; print(__version__)")" | |
id: version | |
if: always() | |
- name: "Upload Documentation Build log" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: doc-${{env.PACKAGE_NAME}}-log | |
path: doc/*.txt | |
if: always() | |
- name: "Zip HTML Documentation" | |
shell: pwsh | |
run: | | |
Compress-Archive -Path doc/build/html/* -Destination HTML-doc-${{env.PACKAGE_NAME}}.zip | |
if: always() | |
- name: "Upload HTML Documentation" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: HTML-doc-${{env.PACKAGE_NAME}}.zip | |
path: HTML-doc-${{env.PACKAGE_NAME}}.zip | |
if: always() |