Add taplo
pre-commit hook to format and sort toml
files (#392)
#1481
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: Build Documentation | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PYVISTA_OFF_SCREEN: "True" | |
ALLOW_PLOTTING: true | |
SHELLOPTS: "errexit:pipefail" | |
DISPLAY: ":99.0" | |
jobs: | |
build-doc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- uses: syphar/restore-virtualenv@v1 | |
id: cache-virtualenv | |
with: | |
requirement_files: requirements_docs.txt | |
- name: Install OS Packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -yqq libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libopengl0 libegl1 | |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset | |
sudo apt-get update | |
sudo apt-get install libosmesa6-dev libgl1-mesa-dev python3-tk pandoc git-restore-mtime | |
sudo apt-get install python3-tk xcb | |
- name: Install Dependencies | |
run: | | |
sudo apt -y install libgeos-dev | |
pip install -r requirements_docs.txt | |
- name: PyVista Report | |
run: | | |
python -c "import pyvista;print(pyvista.Report())" | |
echo PYVISTA_EXAMPLE_DATA_PATH=$(python -c "from pyvista import examples; print(examples.USER_DATA_PATH)") >> $GITHUB_ENV | |
- name: Build Documentation | |
run: make -C doc html SPHINXOPTS="-W --keep-going" | |
- name: Tar build | |
run: tar -zcvf doc-build.tar.gz doc/build/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: doc-build | |
path: doc-build.tar.gz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: tutorial | |
path: doc/source/tutorial | |
- name: Get Notebooks | |
run: | | |
mkdir _notebooks | |
find doc/source/tutorial -type f -name '*.ipynb' | cpio -p -d -v _notebooks/ | |
find doc/source/tutorial/09_trame -type f -name '*.py' | cpio -p -d -v _notebooks/ | |
rm _notebooks/doc/source/tutorial/09_trame/*.ipynb | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: tutorial-notebooks | |
path: _notebooks | |
deploy: | |
name: Publish Documentation | |
runs-on: ubuntu-latest | |
needs: build-doc | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: doc-build | |
path: . | |
- name: UnTar build | |
run: tar -xzvf doc-build.tar.gz | |
- name: Zip Notebooks | |
run: | | |
cp -r doc/build/html/notebooks/tutorial/ notebooks | |
zip -r notebooks.zip notebooks/ | |
mv notebooks.zip doc/build/html/ | |
- name: Deploy to GH Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: doc/build/html | |
cname: tutorial.pyvista.org | |
- name: Copy Tutorial Content | |
run: | | |
mkdir tutorial-content | |
cp -r notebooks tutorial-content/notebooks | |
cp README.md tutorial-content/ | |
cp LICENSE tutorial-content/ | |
cp requirements.txt tutorial-content/ | |
cp requirements_docs.txt tutorial-content/ | |
cp start tutorial-content/ | |
cp Dockerfile tutorial-content/ | |
- name: Deploy to Tutorial branch | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: tutorial-content/ | |
publish_branch: tutorial | |
preview: | |
name: Preview Documentation | |
runs-on: ubuntu-latest | |
needs: build-doc | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: doc-build | |
path: . | |
- name: UnTar build | |
run: tar -xzvf doc-build.tar.gz | |
- name: Zip Notebooks | |
run: | | |
cp -r doc/build/html/notebooks/tutorial/ notebooks | |
zip -r notebooks.zip notebooks/ | |
mv notebooks.zip doc/build/html/ | |
- uses: nwtgck/[email protected] | |
with: | |
publish-dir: doc/build/html | |
production-branch: main | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: "Deploy from GitHub Actions" | |
enable-pull-request-comment: true | |
enable-commit-comment: false | |
overwrites-pull-request-comment: true | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 1 |