[mod] misc #124
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: Documentation | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
draw-schematics: | |
name: Create PNG images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dimension: [2, 3] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
repository: "NaokiHori/SimpleDecomp" | |
ref: ${{ github.ref_name }} | |
- name: Check available font | |
run: | | |
sudo fc-list | |
- name: Setup PyVista | |
uses: pyvista/setup-headless-display-action@main | |
- name: Install python libraries | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyvista matplotlib Pillow | |
- name: Process images | |
run: | | |
python docs/source/images/render.py ${{ matrix.dimension }} | |
python docs/source/images/merge.py ${{ matrix.dimension }} | |
mkdir images | |
mv *.png images/ | |
- name: Upload images | |
uses: actions/upload-artifact@main | |
with: | |
name: images_${{ matrix.dimension }}D | |
path: images | |
build-doc: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
needs: [draw-schematics] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
repository: "NaokiHori/SimpleDecomp" | |
ref: ${{ github.ref_name }} | |
- name: Download 2D images | |
uses: actions/download-artifact@main | |
with: | |
name: images_2D | |
path: images | |
- name: Download 3D images | |
uses: actions/download-artifact@main | |
with: | |
name: images_3D | |
path: images | |
- name: Move images to desired place | |
run: | | |
mv images/*.png docs/source/images/ | |
- name: Check dead links | |
run: | | |
docker run \ | |
--rm \ | |
--volume ${PWD}:/project \ | |
--workdir /project \ | |
sphinxdoc/sphinx:latest \ | |
sphinx-build -M linkcheck "docs/source" "docs/build" | |
if [ -e docs/build/linkcheck/output.txt ]; then | |
wc -l docs/build/linkcheck/output.txt | |
cat docs/build/linkcheck/output.txt | |
fi | |
- name: Build documentation using Sphinx | |
run: | | |
docker run \ | |
--rm \ | |
--volume ${PWD}:/project \ | |
--workdir /project \ | |
sphinxdoc/sphinx:latest \ | |
sphinx-build -M html "docs/source" "docs/build" | |
- name: Upload HTML artifacts | |
uses: actions/upload-artifact@main | |
with: | |
name: DocHTML | |
path: docs/build/html | |
deploy-doc: | |
name: Deploy documentation | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: [build-doc] | |
steps: | |
- name: Download HTML artifacts | |
uses: actions/download-artifact@main | |
with: | |
name: DocHTML | |
path: docs/build/html | |
- name: Setup GitHub Pages | |
uses: actions/configure-pages@main | |
- name: Upload HTML | |
uses: actions/upload-pages-artifact@main | |
with: | |
path: docs/build/html | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@main | |