Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: github workflow for documentation generation and publishing to pages #4

Merged
merged 12 commits into from
Nov 5, 2024
Merged
100 changes: 100 additions & 0 deletions .github/workflows/publish_docs.yml
stat marked this conversation as resolved.
Show resolved Hide resolved
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']

steps:
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
stat marked this conversation as resolved.
Show resolved Hide resolved

- 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']

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
8 changes: 8 additions & 0 deletions cdp-agentkit-core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ lint:
lint-fix:
ruff check . --fix

.PHONY: docs
stat marked this conversation as resolved.
Show resolved Hide resolved
docs:
sphinx-apidoc -f -o ./docs ./cdp_agentkit_core

.PHONY: local-docs
local-docs: docs
cd docs && make html && open ./_build/html/index.html

.PHONY: test
test:
pytest
3 changes: 3 additions & 0 deletions cdp-agentkit-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Core primitives and framework agnostic tools that are meant to be composable and
- [Poetry Installation Instructions](https://python-poetry.org/docs/#installation)
- Run `poetry install` to install `cdp-agentkit-core` dependencies
- Run `poetry shell` to activate the virtual environment

## Documentation
- [Agentkit-Core](https://coinbase.github.io/cdp-agentkit-core)

### Formatting
`make format`
Expand Down
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)
1 change: 1 addition & 0 deletions cdp-agentkit-core/docs/README.md
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 Agentkit - Core'
author = 'Coinbase Developer Platform'
release = '0.0.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
Loading