From 9358a0e1847bfce5f53730a22fe6c924cd5cc01e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 19 Jul 2022 09:02:38 +0200 Subject: [PATCH] Squashed 'src/c-rbtree/' changes from e56535a5daa5..edec411b3c1c edec411b3c1c build: add RTD link to README.md 431a47467052 build: add RTD integration e406cca122d7 build: import documentation builder 5f41b5d8ff75 ci: convert to new ci-c-util workflow git-subtree-dir: src/c-rbtree git-subtree-split: edec411b3c1c03985adb73e3f5b4c9a402206f5b --- .github/workflows/ci.yml | 40 +++++++++++++++--------------- .readthedocs.yaml | 23 ++++++++++++++++++ README.md | 1 + src/docs/api.rst | 5 ++++ src/docs/conf.py | 51 +++++++++++++++++++++++++++++++++++++++ src/docs/index.rst | 15 ++++++++++++ src/docs/requirements.txt | 5 ++++ 7 files changed, 119 insertions(+), 21 deletions(-) create mode 100644 .readthedocs.yaml create mode 100644 src/docs/api.rst create mode 100644 src/docs/conf.py create mode 100644 src/docs/index.rst create mode 100644 src/docs/requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9db40b619f..489433c281 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,37 +7,35 @@ on: - cron: '0 0 * * *' jobs: - ci: - name: CI with Default Configuration + ci-linux: + name: Linux CI uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1 with: cabuild_ref: "v1" + linux: true m32: true matrixmode: true valgrind: true - ci-ptrace: - name: Reduced CI with PTrace + ci-linux-ptrace: + name: Linux CI with PTrace uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1 with: cabuild_ref: "v1" + linux: true mesonargs: '-Dptrace=true' ci-macos: - name: CI on MacOS - runs-on: macos-latest - steps: - - name: Fetch Sources - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install Python Dependencies - run: pip install meson ninja - - name: Prepare Build - run: meson setup build - - name: Run Build - run: meson compile -v -C build - - name: Run Test Suite - run: meson test -v -C build + name: MacOS CI + uses: bus1/cabuild/.github/workflows/ci-c-util.yml@v1 + with: + cabuild_ref: "v1" + linux: false + macos: true + + ci-docs: + name: Documentation CI + uses: bus1/cabuild/.github/workflows/ci-sphinx.yml@v1 + with: + meson: true + source: "./src/docs" diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000000..fd02d29710 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,23 @@ +# Read the Docs configuration file + +version: 2 + +build: + apt_packages: + - "clang" + jobs: + pre_build: + - meson subprojects download + os: "ubuntu-22.04" + tools: + python: "3" + +formats: "all" + +python: + install: + - requirements: "src/docs/requirements.txt" + system_packages: true + +sphinx: + configuration: "src/docs/conf.py" diff --git a/README.md b/README.md index e3183ac8aa..ff3e1cb70e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ as well as the docbook comments for each function. ### Project * **Website**: + * **Documentation**: * **Bug Tracker**: ### Requirements diff --git a/src/docs/api.rst b/src/docs/api.rst new file mode 100644 index 0000000000..fb41b9e82e --- /dev/null +++ b/src/docs/api.rst @@ -0,0 +1,5 @@ +API +=== + +.. c:autodoc:: c-*.h c-*.c + :transform: kerneldoc diff --git a/src/docs/conf.py b/src/docs/conf.py new file mode 100644 index 0000000000..4bc8f8612a --- /dev/null +++ b/src/docs/conf.py @@ -0,0 +1,51 @@ +# +# Sphinx Documentation Configuration +# + +import re +import os +import sys + +import capidocs.kerneldoc +import hawkmoth + +# Global Setup + +project = 'c-rbtree' + +author = 'C-Util Community' +copyright = '2015-2022, C-Util Community' + +# Hawkmoth C-Audodoc Setup + +capidocs.kerneldoc.hawkmoth_conf() + +# Extensions + +exclude_patterns = [] + +extensions = [ + 'hawkmoth', +] + +# Hawkmoth Options + +import pathlib +def _hawkmoth_glob_includes(path, glob): + entries = [] + for entry in pathlib.Path(path).glob(glob): + entries += ["-I" + os.path.abspath(str(entry))] + return entries + +cautodoc_clang = capidocs.kerneldoc.hawkmoth_include_args() +cautodoc_clang += _hawkmoth_glob_includes("../../subprojects", "libc*/src") + +cautodoc_root = os.path.abspath('..') + +cautodoc_transformations = { + 'kerneldoc': capidocs.kerneldoc.hawkmoth_converter, +} + +# HTML Options + +html_theme = 'sphinx_rtd_theme' diff --git a/src/docs/index.rst b/src/docs/index.rst new file mode 100644 index 0000000000..df281b0bec --- /dev/null +++ b/src/docs/index.rst @@ -0,0 +1,15 @@ +Introduction +============ + +The **c-rbtree** project provides a Red-Black-Tree API, that is fully +implemented in ISO-C11 and has no external dependencies. Furthermore, tree +traversal, memory allocations, and key comparisons are completely controlled by +the API user. The implementation only provides the RB-Tree specific rebalancing +and coloring. + +.. toctree:: + :caption: Library Documentation + :hidden: + + self + api diff --git a/src/docs/requirements.txt b/src/docs/requirements.txt new file mode 100644 index 0000000000..77973ebd67 --- /dev/null +++ b/src/docs/requirements.txt @@ -0,0 +1,5 @@ +c-apidocs>=0.0.3 +clang>=6 +hawkmoth>=0.7 +meson>=0.60 +ninja>=1.10