Skip to content

Commit

Permalink
Introduce Sphinx for documentation
Browse files Browse the repository at this point in the history
The basic infrastructure for writing documentation using Sphinx is
added.
  • Loading branch information
LukasWoodtli committed Jul 29, 2024
1 parent ec4609e commit 83521b3
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/sphinx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Documentation

on: [push, pull_request]

jobs:
sphinx:
runs-on: ubuntu-22.04

steps:
- name: Checkout code including full history and submodules
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Install dependencies from APT repository
run: |
sudo apt-get update
sudo apt-get install cmake ninja-build
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r doc/sphinx/requirements.txt
- name: Build Sphinx documentation
run: |
sphinx-build -M html sphinx sphinx_output
working-directory: doc/

- name: Upload HTML documentation
uses: actions/upload-artifact@v1
with:
name: Documentation (HTML)
path: doc/sphinx_output/html
30 changes: 30 additions & 0 deletions doc/sphinx/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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 = 'Wakaama'
copyright = '2024, Lukas Woodtli'
author = 'Lukas Woodtli'

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

extensions = ['literate_sphinx']

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']



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

html_theme = 'alabaster'

# -- Options for literate_sphinx ----------------------------------------------


17 changes: 17 additions & 0 deletions doc/sphinx/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Welcome to Wakaama
==================

Wakaama is a C library for the LwM2M protocol.

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



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
2 changes: 2 additions & 0 deletions doc/sphinx/logging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Logging
-------
35 changes: 35 additions & 0 deletions doc/sphinx/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
2 changes: 2 additions & 0 deletions doc/sphinx/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
literate-sphinx==0.1.3
Sphinx==7.2.6

0 comments on commit 83521b3

Please sign in to comment.