Skip to content
Merged

Pages #103

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
78 changes: 78 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build and deploy documentation

on:
push:
branches: [main, develop, pages]
pull_request:
branches: [main, develop]
workflow_dispatch:

permissions:
contents: read

Check warning on line 11 in .github/workflows/docs.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this read permission from workflow level to job level.

See more on https://sonarcloud.io/project/issues?id=ai4mde_studio&issues=AZ8nqCWeQ0KIAJmT7mYB&open=AZ8nqCWeQ0KIAJmT7mYB&pullRequest=103
pages: write

Check warning on line 12 in .github/workflows/docs.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this write permission from workflow level to job level.

See more on https://sonarcloud.io/project/issues?id=ai4mde_studio&issues=AZ8nqCWeQ0KIAJmT7mYC&open=AZ8nqCWeQ0KIAJmT7mYC&pullRequest=103
id-token: write

Check warning on line 13 in .github/workflows/docs.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this write permission from workflow level to job level.

See more on https://sonarcloud.io/project/issues?id=ai4mde_studio&issues=AZ8nqCWeQ0KIAJmT7mYD&open=AZ8nqCWeQ0KIAJmT7mYD&pullRequest=103

concurrency:
group: github-pages-docs
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install Poetry
run: pip install poetry

- name: Install backend and docs dependencies
working-directory: api
run: poetry install --with docs --no-root

- name: Debug docs tools
run: |
export PATH="$(poetry -C api env info --path)/bin:$PATH"
which sphinx-build
which sphinx-apidoc
sphinx-build --version

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install frontend dependencies
working-directory: frontend
run: npm ci

- name: Build documentation
run: |
export PATH="$(poetry -C api env info --path)/bin:$PATH"
bash ci/build_docs.sh

- name: Upload GitHub Pages artifact
if: github.event_name == 'push'
uses: actions/upload-pages-artifact@v3
with:
path: site

deploy:
if: github.event_name == 'push'
needs: build
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
site/
docs/backend/build/
docs/guides/build/
docs/backend/source/api/
2,491 changes: 1,528 additions & 963 deletions api/poetry.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ plugins = ["mypy_django_plugin.main"]

[tool.django-stubs]
django_settings_module = "model.settings"

[tool.poetry.group.docs.dependencies]
sphinx = "^8.1.3"
myst-parser = "^4.0.0"
sphinx-autodoc-typehints = "^3.0.0"
furo = "^2024.8.6"
63 changes: 63 additions & 0 deletions ci/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -e

SITE_DIR=site

rm -rf "$SITE_DIR"
mkdir -p "$SITE_DIR/backend" "$SITE_DIR/guides" "$SITE_DIR/frontend"

# -------------------------
# Backend (Sphinx)
# -------------------------

sphinx-apidoc -f \
-o docs/backend/source/api \
api/model \
*/migrations */__pycache__ \
--templatedir=docs/backend/templates

sphinx-build -b html \
docs/backend/source \
"$SITE_DIR/backend" \
-E -a -v

# -------------------------
# Guides (Sphinx)
# -------------------------

sphinx-build -b html \
docs/guides/source \
"$SITE_DIR/guides" \
-E -a -v

# -------------------------
# Frontend (TypeDoc)
# -------------------------

cd frontend
npx typedoc --out ../"$SITE_DIR/frontend"
cd ..

# -------------------------
# Landing page
# -------------------------

cat > "$SITE_DIR/index.html" <<EOF
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Project Documentation</title>
</head>
<body>
<h1>Project Documentation</h1>
<ul>
<li><a href="./backend/">Backend documentation</a></li>
<li><a href="./guides/">Guides</a></li>
<li><a href="./frontend/">Frontend documentation</a></li>
</ul>
</body>
</html>
EOF

touch "$SITE_DIR/.nojekyll"
56 changes: 56 additions & 0 deletions docs/backend/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import os
import sys

sys.path.insert(0, os.path.abspath('../../../api/model'))

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "model.settings")

import django
django.setup()

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'AI4MDE'
copyright = '2026, J.J. Goedhart'
author = 'J.J. Goedhart'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'sphinx.ext.intersphinx',
'sphinx_autodoc_typehints'
]

myst_enable_extensions = [
"colon_fence",
"deflist",
]

source_suffix = {
".rst": "restructuredtext",
}

autosummary_generate = True
autodoc_typehints = "description"

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'furo'
html_static_path = ['_static']
19 changes: 19 additions & 0 deletions docs/backend/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. AI4MDE documentation master file, created by
sphinx-quickstart on Tue Apr 7 13:50:49 2026.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

AI4MDE documentation
====================

Welcome to the manual.

.. toctree::
:maxdepth: 2
:caption: Contents:

api/modules

.. automodule:: model
:members:
:undoc-members:
File renamed without changes.
45 changes: 45 additions & 0 deletions docs/guides/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'AI4MDE Guides'
copyright = '2026, J.J. Goedhart'
author = 'J.J. Goedhart'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
]

myst_enable_extensions = [
"colon_fence",
"deflist",
]

source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}

autosummary_generate = True
autodoc_typehints = "description"

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'furo'
html_static_path = ['_static']
File renamed without changes.
14 changes: 14 additions & 0 deletions docs/guides/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Guides
======

Welcome to the project guides.

.. toctree::
:maxdepth: 2
:caption: Contents

architecture
developers-guide
metadata
setup
users-guide
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading