From 7ef8dcc7a0907be72f1129a1b318dac03a4ac276 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Fri, 7 Jun 2024 20:41:05 +0100 Subject: [PATCH] (docs): blind attempt at readthedocs for solidity --- .readthedocs.yaml | 34 ++++++++++++++++++++++++++++++++++ docs/generate_solidity_docs.sh | 7 +++++++ docs/requirements.txt | 5 +++++ docs/source/conf.py | 27 +++++++++++++++++++++++++++ docs/source/index.rst | 15 +++++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 .readthedocs.yaml create mode 100755 docs/generate_solidity_docs.sh create mode 100644 docs/requirements.txt create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..c5e7076 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,34 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.12" + nodejs: "19" + rust: "1.64" + apt_packages: + - solc + + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/source/conf.py + +# Declare the Python requirements required to build your documentation +python: + install: + - requirements: docs/requirements.txt + +# Additional commands to set up the environment for Foundry +commands: + - curl -L https://foundry.paradigm.xyz | bash # Install Foundry + - foundryup # Update Foundry + - forge install # Install dependencies for Foundry project + - ./generate_solidity_docs.sh # Generate Solidity documentation + - sphinx-build -b html docs/source docs/build/html # Build Sphinx documentation diff --git a/docs/generate_solidity_docs.sh b/docs/generate_solidity_docs.sh new file mode 100755 index 0000000..2fca8f1 --- /dev/null +++ b/docs/generate_solidity_docs.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Run solidity-docgen +npx solidity-docgen --output docs/source/solidity --solc-module solc + +# Ensure the output directory exists +mkdir -p docs/source/solidity diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..4112426 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,5 @@ +# Defining the exact version will make sure things don't break +sphinx==5.3.0 +sphinx_rtd_theme==1.1.1 +sphinx-autobuild==2024.4.16 +readthedocs-sphinx-search==0.1.1 \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..6b6e98b --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,27 @@ +# conf.py + +import os +import sys +sys.path.insert(0, os.path.abspath('.')) + +# Project information +project = 'Circles' +author = 'AboutCircles' +release = '0.3.4' + +# General configuration +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode', +] + +templates_path = ['_templates'] +exclude_patterns = [] + +# Options for HTML output +html_theme = 'alabaster' +html_static_path = ['_static'] + +# Add Solidity docgen output path +solidity_docgen_output = os.path.abspath('solidity') diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..a6c7cf6 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,15 @@ +Welcome to Circles documentation! +================================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + solidity/index + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search`