Skip to content

Commit

Permalink
ci: changing documentation.yml
Browse files Browse the repository at this point in the history
Adapt the pyvista documentation workflow to loopstructural as the previous docker based build wasn't working with pyvista.
  • Loading branch information
lachlangrose authored Jan 20, 2025
1 parent 88eec7a commit e98998b
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 16 deletions.
99 changes: 83 additions & 16 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,92 @@
name: "📚 Build documentation and deploy "

on:
workflow_dispatch:
workflow_dispatch: # Able to not use cache by user demand
inputs:
cache:
description: "Use build cache"
required: false
default: "true"


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
USE_CACHE: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.cache == 'true') }}
PYDEVD_DISABLE_FILE_VALIDATION: "1"
PYTEST_ADDOPTS: "--color=yes"
FORCE_COLOR: "True"

jobs:
documentation:
runs-on: ubuntu-latest
doc:
name: Build Documentation
runs-on: ubuntu-20.04
env:
PYVISTA_OFF_SCREEN: "True"
ALLOW_PLOTTING: true
SHELLOPTS: "errexit:pipefail"
steps:
- uses: actions/checkout@v4
- run: |
cp CHANGELOG.md docs/source/getting_started/CHANGELOG.md
docker build . -t=lsdocs -f docs/Dockerfile
docker run -v $(pwd):/LoopStructural lsdocs bash LoopStructural/docs/build_docs.sh
- name: upload artifacts
uses: actions/upload-artifact@v3

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- uses: awalsh128/[email protected]
with:
packages: libosmesa6-dev libgl1-mesa-dev python3-tk pandoc git-restore-mtime
version: 3.0

- name: Install PyVista and dependencies
run: |
pip install -e .[docs]
- name: Install custom OSMesa VTK variant
run: |
pip uninstall vtk -y
pip install vtk-osmesa==9.3.0 --index-url https://gitlab.kitware.com/api/v4/projects/13/packages/pypi/simple

- name: Build Documentation
run: make -C docs html

- name: Dump Sphinx Warnings and Errors
if: always()
run: if [ -e doc/sphinx_warnings.txt ]; then cat doc/sphinx_warnings.txt; fi

- name: Dump VTK Warnings and Errors
if: always()
run: if [ -e doc/errors.txt ]; then cat doc/errors.txt; fi





- name: Upload HTML documentation
if: always()
uses: actions/upload-artifact@v4
with:
path: docs/build/html
- name: Deploy 🚀
uses: JamesIves/[email protected]
name: docs-build
path: docs/build/html/

- uses: actions/upload-artifact@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy.
name: examples
path: docs/source/_auto_examples/

- name: Get Notebooks
run: |
mkdir _notebooks
find docs/source/_auto_examples -type f -name '*.ipynb' | cpio -p -d -v _notebooks/
- uses: actions/upload-artifact@v4
with:
name: loopstructural-notebooks
path: _notebooks

# folder: docs/build/html # The folder the action should deploy.



1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jupyter = [
]
inequalities = [
"loopsolver"]
docs = ["pyvista[all]", "pydata-sphinx-theme","meshio","loopstructuralvisualisation[all]","networkx","scikit-learn","scikit-image","sphinx","sphinx-gallery","geoh5py","geopandas","sphinxcontrib-bibtex","myst-parser"]
[project.urls]
Documentation = 'https://Loop3d.org/LoopStructural/'
"Bug Tracker" = 'https://github.com/loop3d/loopstructural/issues'
Expand Down

0 comments on commit e98998b

Please sign in to comment.