Skip to content

Commit

Permalink
first pass implementing github workflow to publish docs
Browse files Browse the repository at this point in the history
  • Loading branch information
stat committed Nov 4, 2024
1 parent fa07c34 commit d6263bb
Show file tree
Hide file tree
Showing 23 changed files with 1,792 additions and 2 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Publish Docs to Github Pages

on:
release:
types: [published]

jobs:
docs-agentkit:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cdp-agentkit-core
strategy:
matrix:
python: ['3.10', '3.11', '3.12']

steps:
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ./cdp-agentkit-core/.venv
key: venv-agentkit-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('cdp-agentkit-core/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --with dev

- name: Build Sphinx Documentation
run: |
make docs
cd docs
make html
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: cdp-agentkit-core
publish_dir: ./docs/_build/html
keep_files: false

docs-langchain:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cdp-langchain
strategy:
matrix:
python: ['3.10', '3.11', '3.12']

steps:
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ./cdp-langchain/.venv
key: venv-langchain-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('cdp-langchain/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --with dev

- name: Build Sphinx Documentation
run: |
make docs
cd docs
make html
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: cdp-langchain
publish_dir: ./docs/_build/html
keep_files: false
4 changes: 4 additions & 0 deletions cdp-agentkit-core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ lint:
lint-fix:
ruff check . --fix

.PHONY: docs
docs:
sphinx-apidoc -f -o ./docs ./cdp_agentkit_core

.PHONY: test
test:
pytest
19 changes: 19 additions & 0 deletions cdp-agentkit-core/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
.PHONY: help
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
.PHONY: Makefile
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
85 changes: 85 additions & 0 deletions cdp-agentkit-core/docs/cdp_agentkit_core.actions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
cdp\_agentkit\_core.actions package
===================================

Submodules
----------

cdp\_agentkit\_core.actions.deploy\_nft module
----------------------------------------------

.. automodule:: cdp_agentkit_core.actions.deploy_nft
:members:
:undoc-members:
:show-inheritance:

cdp\_agentkit\_core.actions.deploy\_token module
------------------------------------------------

.. automodule:: cdp_agentkit_core.actions.deploy_token
:members:
:undoc-members:
:show-inheritance:

cdp\_agentkit\_core.actions.get\_balance module
-----------------------------------------------

.. automodule:: cdp_agentkit_core.actions.get_balance
:members:
:undoc-members:
:show-inheritance:

cdp\_agentkit\_core.actions.get\_wallet\_details module
-------------------------------------------------------

.. automodule:: cdp_agentkit_core.actions.get_wallet_details
:members:
:undoc-members:
:show-inheritance:

cdp\_agentkit\_core.actions.mint\_nft module
--------------------------------------------

.. automodule:: cdp_agentkit_core.actions.mint_nft
:members:
:undoc-members:
:show-inheritance:

cdp\_agentkit\_core.actions.register\_basename module
-----------------------------------------------------

.. automodule:: cdp_agentkit_core.actions.register_basename
:members:
:undoc-members:
:show-inheritance:

cdp\_agentkit\_core.actions.request\_faucet\_funds module
---------------------------------------------------------

.. automodule:: cdp_agentkit_core.actions.request_faucet_funds
:members:
:undoc-members:
:show-inheritance:

cdp\_agentkit\_core.actions.trade module
----------------------------------------

.. automodule:: cdp_agentkit_core.actions.trade
:members:
:undoc-members:
:show-inheritance:

cdp\_agentkit\_core.actions.transfer module
-------------------------------------------

.. automodule:: cdp_agentkit_core.actions.transfer
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: cdp_agentkit_core.actions
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions cdp-agentkit-core/docs/cdp_agentkit_core.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cdp\_agentkit\_core package
===========================

Subpackages
-----------

.. toctree::
:maxdepth: 4

cdp_agentkit_core.actions

Module contents
---------------

.. automodule:: cdp_agentkit_core
:members:
:undoc-members:
:show-inheritance:
34 changes: 34 additions & 0 deletions cdp-agentkit-core/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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

import sys
import os

sys.path.insert(0, os.path.abspath(".."))

project = 'CDP SDK'
author = 'Coinbase Developer Platform'
release = '0.10.1'

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

extensions = [
'myst_parser', # Parsing Markdown
'sphinx.ext.autodoc', # Automatically generate documentation from docstrings
'sphinx.ext.napoleon', # Google-style docstring support
'sphinx_autodoc_typehints' # Type hints in function signatures
]

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'
12 changes: 12 additions & 0 deletions cdp-agentkit-core/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CDP Agentkit - Core documentation
==========================

.. include:: README.md
:parser: myst_parser.sphinx_

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

modules
35 changes: 35 additions & 0 deletions cdp-agentkit-core/docs/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
7 changes: 7 additions & 0 deletions cdp-agentkit-core/docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cdp_agentkit_core
=================

.. toctree::
:maxdepth: 4

cdp_agentkit_core
Loading

0 comments on commit d6263bb

Please sign in to comment.