doc: using pyvista.DynamicScraper() #896
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
# check spelling, codestyle | |
name: GitHub CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
env: | |
MAIN_PYTHON_VERSION: '3.11' | |
PACKAGE_NAME: 'ansys-math-core' | |
PACKAGE_NAMESPACE: 'ansys.math.core' | |
DOCKER_PACKAGE: ghcr.io/ansys/pymapdl/mapdl | |
DOCKER_IMAGE_VERSION_DOCS_BUILD: v22.2.0 | |
DOCUMENTATION_CNAME: 'math.docs.pyansys.com' | |
PYMAPDL_START_INSTANCE: FALSE | |
PYMAPDL_PORT: 21000 # default won't work on GitHub runners | |
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners | |
RESET_AUTOSUMMARY_CACHE: 2 | |
RESET_EXAMPLES_CACHE: 2 | |
RESET_DOC_BUILD_CACHE: 2 | |
RESET_PIP_CACHE: 2 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
code-style: | |
name: "Code style" | |
runs-on: ubuntu-latest | |
steps: | |
- name: PyAnsys code style checks | |
uses: ansys/actions/code-style@v4 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
doc-style: | |
name: "Documentation Style Check" | |
runs-on: ubuntu-latest | |
steps: | |
- name: PyAnsys documentation style checks | |
uses: ansys/actions/doc-style@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
smoke-tests: | |
name: Build and Smoke tests | |
runs-on: ${{ matrix.os }} | |
needs: [code-style] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
# Only perform wheelhouse builds for Windows and macOS when releasing | |
should-release: | |
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} | |
exclude: | |
- should-release: false | |
os: macos-latest | |
- should-release: false | |
os: windows-latest | |
steps: | |
- name: Build wheelhouse and perform smoke test | |
uses: ansys/actions/build-wheelhouse@v4 | |
with: | |
library-name: ${{ env.PACKAGE_NAME }} | |
library-namespace: ${{ env.PACKAGE_NAMESPACE }} | |
operating-system: ${{ matrix.os }} | |
python-version: ${{ matrix.python-version }} | |
build-test: | |
name: "Build and unit testing" | |
runs-on: ubuntu-latest | |
needs: [smoke-tests] | |
strategy: | |
matrix: | |
mapdl-version: ['v21.1.1', 'v21.2.1', 'v22.1.0', 'v22.2.0', 'v22.2-ubuntu'] | |
steps: | |
- name: "Install Git and checkout project" | |
uses: actions/checkout@v4 | |
- name: "Setup Python" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: "Install os packages" | |
run: | | |
sudo apt update | |
sudo apt-get install pandoc | |
- name: "Cache pip" | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.mapdl-version }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.mapdl-version }} | |
- name: Install ansys-mapdl-core | |
run: | | |
python -m pip install ansys-mapdl-core | |
- name: "Login in Github container registry" | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Pull, launch, and validate MAPDL service" | |
run: .ci/start_mapdl.sh | |
if: ${{ !contains( matrix.mapdl-version, 'ubuntu') }} | |
env: | |
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }} | |
- name: "Pull, launch, and validate Ubuntu MAPDL service from private" | |
run: .ci/start_mapdl_ubuntu.sh | |
if: ${{ contains( matrix.mapdl-version, 'ubuntu') }} | |
env: | |
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }} | |
- name: "Unit testing requirements installation" | |
run: | | |
python -m pip install .[tests] | |
- name: "Unit testing" | |
run: | | |
pytest -v --durations=10 --maxfail=10 \ | |
--reruns 7 --reruns-delay 3 --only-rerun MapdlExitedError --only-rerun EmptyRecordError \ | |
--cov=ansys.math.core --cov-report=xml:${{ matrix.mapdl-version }}-remote.xml \ | |
--cov-report=html --cov-report term | |
- name: "Upload coverage to Codecov" | |
uses: codecov/codecov-action@v3 | |
with: | |
name: ${{ matrix.mapdl-version }}-remote.xml | |
flags: remote,${{ matrix.mapdl-version }} | |
- name: Upload coverage artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.mapdl-version }}-remote.xml | |
path: ./${{ matrix.mapdl-version }}-remote.xml | |
- name: "Display files structure" | |
if: always() | |
run: | | |
mkdir logs-${{ matrix.mapdl-version }} && echo "Successfully generated directory ${{ matrix.mapdl-version }}" | |
echo "::group:: Display files structure" && ls -R && echo "::endgroup::" | |
ls -R > ./logs-${{ matrix.mapdl-version }}/files_structure.txt | |
- name: "Display docker files structures" | |
if: always() | |
run: | | |
echo "::group:: Display files structure" && docker exec mapdl /bin/bash -c "ls -R" && echo "::endgroup::" | |
docker exec mapdl /bin/bash -c "ls -R" > ./logs-${{ matrix.mapdl-version }}/docker_files_structure.txt | |
- name: "Collect MAPDL logs on failure" | |
if: ${{ always() && !contains( matrix.mapdl-version, 'ubuntu') }} | |
run: | | |
docker exec mapdl /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.out' > /dev/null ;then cp -f /file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.err' > /dev/null ;then cp -f /file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.log' > /dev/null ;then cp -f /file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '*.crash' > /dev/null ;then cp -f /*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi" | |
docker cp mapdl:/mapdl_logs/. ./logs-${{ matrix.mapdl-version }}/. | |
- name: "Collect MAPDL logs on failure for ubuntu image" | |
if: ${{ always() && contains( matrix.mapdl-version,'ubuntu') }} | |
run: | | |
docker exec mapdl /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'" | |
docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.out' > /dev/null ;then cp -f /jobs/file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.err' > /dev/null ;then cp -f /jobs/file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.log' > /dev/null ;then cp -f /jobs/file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '/jobs/*.crash' > /dev/null ;then cp -f /jobs/*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi" | |
docker cp mapdl:/mapdl_logs/. ./logs-${{ matrix.mapdl-version }}/. | |
- name: "Tar logs" | |
if: always() | |
run: | | |
cp log.txt ./logs-${{ matrix.mapdl-version }}/log.txt | |
tar cvzf ./logs-${{ matrix.mapdl-version }}.tgz ./logs-${{ matrix.mapdl-version }} | |
- name: "Upload logs to GitHub" | |
if: always() | |
uses: actions/upload-artifact@master | |
with: | |
name: logs-${{ matrix.mapdl-version }}.tgz | |
path: ./logs-${{ matrix.mapdl-version }}.tgz | |
- name: "Display MAPDL Logs" | |
if: always() | |
run: cat log.txt | |
- name: "List main files" | |
if: always() | |
run: | | |
if compgen -G './logs-${{ matrix.mapdl-version }}/*.err' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.err; do echo "::group:: Error file $f" && cat $f && echo "::endgroup::" ; done; fi | |
if compgen -G './logs-${{ matrix.mapdl-version }}/*.log' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.log; do echo "::group:: Log file $f" && cat $f && echo "::endgroup::" ; done; fi | |
if compgen -G './logs-${{ matrix.mapdl-version }}/*.out' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.out; do echo "::group:: Output file $f" && cat $f && echo "::endgroup::" ; done; fi | |
doc-build: | |
name: Doc building | |
runs-on: ubuntu-latest | |
needs: [doc-style] | |
env: | |
PYMAPDL_PORT: 21000 # default won't work on GitHub runners | |
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners | |
PYMAPDL_START_INSTANCE: FALSE | |
steps: | |
# This checkout is repeated later at the 'doc-build' action. This could be avoided by copything the sh file here, but introduces some code duplicity. | |
- name: "Install Git and checkout project" | |
uses: actions/checkout@v4 | |
- name: "Setup Python" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: "Install OS packages" | |
run: | | |
sudo apt update | |
sudo apt install pandoc | |
- name: "Cache pip" | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }} | |
- name: "Install ansys-math-core" | |
run: | | |
pip install . | |
- name: "Login in Github container registry" | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Pull, launch, and validate MAPDL service" | |
run: .ci/start_mapdl.sh | |
env: | |
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
MAPDL_IMAGE: '${{ env.DOCKER_PACKAGE }}:${{ env.DOCKER_IMAGE_VERSION_DOCS_BUILD }}' | |
- name: "Retrieve AnsysMath version" | |
run: | | |
echo "ANSYSMATH_VERSION=$(python -c 'from ansys.math.core import __version__; print(__version__)')" >> $GITHUB_ENV | |
echo "AnsysMath version is: $(python -c "from ansys.math.core import __version__; print(__version__)")" | |
- name: "Cache examples" | |
uses: actions/cache@v3 | |
with: | |
path: doc/source/examples | |
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ env.ANSYSMATH_VERSION }}-${{ github.sha }} | |
restore-keys: | | |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ env.ANSYSMATH_VERSION }} | |
- name: "Cache docs build directory" | |
uses: actions/cache@v3 | |
with: | |
path: doc/_build | |
key: doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ env.ANSYSMATH_VERSION }}-${{ github.sha }} | |
restore-keys: | | |
doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ env.ANSYSMATH_VERSION }} | |
- name: "Cache autosummary" | |
uses: actions/cache@v3 | |
with: | |
path: doc/source/**/_autosummary/*.rst | |
key: autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ env.ANSYSMATH_VERSION }}-${{ github.sha }} | |
restore-keys: | | |
autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ env.ANSYSMATH_VERSION }} | |
- name: "Install docs build requirements" | |
run: | | |
pip install .[doc] | |
- name: Install VTK | |
run: | | |
pip uninstall vtk -y | |
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa | |
- name: List | |
run: pip list | |
- name: "Run Ansys documentation building action" | |
uses: ansys/actions/doc-build@v4 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
checkout: false | |
skip-install: true | |
sphinxopts: -j auto | |
requires-xvfb: true | |
package: | |
name: Package library | |
needs: [doc-build, build-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build library source and wheel artifacts | |
uses: ansys/actions/build-library@v4 | |
with: | |
library-name: ${{ env.PACKAGE_NAME }} | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
doc-deploy-dev: | |
name: "Deploy development documentation" | |
# Deploy development only when merging to main | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: [package] | |
steps: | |
- name: "Deploy the latest documentation" | |
uses: ansys/actions/doc-deploy-dev@v4 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: "Release project to public PyPI and GitHub" | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
needs: [package] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Release to the public PyPI repository" | |
uses: ansys/actions/release-pypi-public@v4 | |
with: | |
library-name: ${{ env.PACKAGE_NAME }} | |
twine-username: "__token__" | |
twine-token: ${{ secrets.PYPI_TOKEN }} | |
- name: "Release to GitHub" | |
uses: ansys/actions/release-github@v4 | |
with: | |
library-name: ${{ env.PACKAGE_NAME }} | |
doc-deploy-stable: | |
name: "Deploy stable documentation" | |
# Deploy release documentation when creating a new tag | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
needs: [release] | |
steps: | |
- name: "Deploy the stable documentation" | |
uses: ansys/actions/doc-deploy-stable@v4 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} |