Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Build and deploy documentation using Sphinx
#
# On pull requests: builds docs to verify they compile without errors.
# On pushes to main: builds and deploys to GitHub Pages.
#
# This workflow is documentation-tooling agnostic — it runs whichever
# Sphinx build is configured in docs/conf.py. If the project switches
# to Jupyter Book or another Sphinx-based tool, only the install step
# and build command need updating.
name: Documentation

on:
push:
branches: [main]
paths:
- "docs/**"
- "neural_lam/**"
- ".github/workflows/docs.yml"
pull_request:
branches: [main]
paths:
- "docs/**"
- "neural_lam/**"
- ".github/workflows/docs.yml"

# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y graphviz

- name: Install neural-lam and doc dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install -r docs/requirements.txt

- name: Build documentation
working-directory: docs
run: |
sphinx-build -b html . _build/html -W --keep-going -n
env:
MPLBACKEND: Agg

- name: Check for broken links
working-directory: docs
continue-on-error: true
run: |
sphinx-build -b linkcheck . _build/linkcheck

- name: Upload documentation artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html

deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
7 changes: 7 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Documentation build dependencies
# Install with: pip install -r docs/requirements.txt
sphinx>=7.0
pydata-sphinx-theme>=0.15
sphinx-autoapi>=3.0
numpydoc>=1.6
sphinx-copybutton>=0.5
Loading