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(docs): Add documentation/gh-pages using Catalyst-CI docs builders and actions. #104

Merged
merged 56 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d6affe2
refactor(gateway): Rename catalyst-voices-backend to the catalyst-gat…
stevenj Oct 18, 2023
d1736b9
docs(gateway): Update readme
stevenj Oct 18, 2023
d966461
refactor(gateway): Move the code into the new directory trees, cleanu…
stevenj Oct 18, 2023
dd7594a
refactor(gateway): Basic refactor of the event-db config/data and the…
stevenj Oct 18, 2023
e00cc4e
docs(gateway): Initial docs for the crates directory inside catalyst …
stevenj Oct 18, 2023
ffc2514
refactor(gateway): Move code out of cat-data-service and put it direc…
stevenj Oct 18, 2023
fc63b2f
feat(gateway): first build seems to work, but fails due to WIP refactor
stevenj Oct 19, 2023
85f369d
refactor(gateway): Refactor builds properly to a static executable.
stevenj Oct 19, 2023
0a0ce4f
refactor(gateway): autofixed lints
stevenj Oct 19, 2023
4163ad4
refactor(gateway): WIP remove lint errors
stevenj Oct 19, 2023
ff9ed9d
refactor(gateway): WIP refactoring work to remove lint errors
stevenj Oct 20, 2023
117d1ae
refactor(gateway): Don't panic, return the error, and generalize the …
stevenj Oct 20, 2023
f07a4d5
refactor(gateway): generalize error response
stevenj Oct 20, 2023
8e398ab
docs(gateway): indexing ok here, slice already checked to have values
stevenj Oct 20, 2023
ab19189
refactor(gateway): Indexing is safe here, so note it.
stevenj Oct 20, 2023
90020db
refactor(gateway): don't panic, return an error. reduce size of func…
stevenj Oct 20, 2023
deff8a1
refactor(gateway): Purge metrics from legacy service. Unused and can…
stevenj Oct 20, 2023
d783069
refactor(gateway): remove unused rust files from EventDB directory
stevenj Oct 20, 2023
1d11b40
refactor(gateway): remove unused dependencies
stevenj Oct 20, 2023
6b0ec08
docs(gateway): Allow intentional panic for test code
stevenj Oct 20, 2023
8807d41
refactor(gateway): eliminate or notate why unwraps/expect are safe
stevenj Oct 20, 2023
df7b034
refactor(gateway): All lints are clean and restrictively applied
stevenj Oct 20, 2023
b2059af
refactor(gateway): remove unused dependencies from workspace cargo file
stevenj Oct 20, 2023
3026cda
refactor(gateway): restrict visibility of event_db to pub(crate) as i…
stevenj Oct 20, 2023
4bd314b
docs(gateway): root level fully documented
stevenj Oct 20, 2023
d044759
docs(gateway): state fully documented
stevenj Oct 20, 2023
d460fc6
docs(gateway): Don't worry about full docs for legacy service.
stevenj Oct 20, 2023
32403db
docs(gateway): Service top level fully documented
stevenj Oct 20, 2023
21652a4
docs(gateway): middleware docs complete
stevenj Oct 20, 2023
399dca9
docs(gateway): Fully documented the docs part of the service
stevenj Oct 20, 2023
34ad5a9
docs(gateway): common responses and module root fully documented
stevenj Oct 20, 2023
d195417
docs(gateway): Common objects now fully documented
stevenj Oct 20, 2023
e7c7571
docs(gateway): Api endpoint docs are complete
stevenj Oct 20, 2023
bb9a680
docs(gateway): DB Types fully documented
stevenj Oct 20, 2023
1dd5df6
docs(gateway): Queries partially documented
stevenj Oct 20, 2023
791dc90
docs(gateway): Everything that needs docs is documented
stevenj Oct 20, 2023
eb2d73f
feat(gateway): Initial CI and Cat-Gateway build ready for PR
stevenj Oct 20, 2023
1a982e9
feat(rust): Add recommended rust extensions for vscode, and rust sett…
stevenj Oct 20, 2023
2554ca3
docs(gateway): Fix spelling
stevenj Oct 20, 2023
906d5eb
ci(gateway): Use the proper versioned CI tooling from catalyst-ci
stevenj Oct 24, 2023
34750c3
Merge branch 'main' into feat/catalyst-gateway
stevenj Oct 24, 2023
98f2e4a
feat(docs): Docs WIP setup
stevenj Oct 26, 2023
b1eb247
docs(docs): Fix the docs so they use the latests docs-ci and are able…
stevenj Nov 2, 2023
f43fe65
docs(docs): fix spelling and markdown lint issues
stevenj Nov 2, 2023
08cc557
docs(docs): Update to use latest Cat-CI Docs and reduce replication
stevenj Nov 3, 2023
752571b
docs(docs): Fix the top level parts of the docs and remove test values
stevenj Nov 3, 2023
53d5e29
Merge branch 'main' into feat/voices-docs
stevenj Nov 3, 2023
65fdbf1
docs(docs): try and build and deploy docs to gh-pages
stevenj Nov 4, 2023
6c82887
docs(docs): fix spelling issue
stevenj Nov 4, 2023
a495586
docs(docs): Use proper docs action, and also add branch cleanup for b…
stevenj Nov 4, 2023
46f3418
Merge branch 'main' into feat/voices-docs
stevenj Nov 6, 2023
3e87a84
docs(docs): Use the published versions from Catalyst-CI
stevenj Nov 8, 2023
4ec5afa
docs(docs): Ensure we do not try and clean docs while building them.
stevenj Nov 8, 2023
ac80bd1
docs(docs): Ensure we don't try and build docs simultaneously, Don't …
stevenj Nov 8, 2023
b456f33
ci(mdlint): Use tagged CI versions for stability
stevenj Nov 8, 2023
086b7ab
ci(spelling): Use tagged CI versions for stability
stevenj Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
addrr
adminer
asyncio
auditability
BROTLI
cardano
Expand All @@ -24,6 +25,8 @@ Intellij
jetbrains
jorm
jormungandr
Jörmungandr
kroki
lcov
Leshiy
localizable
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,9 @@ $RECYCLE.BIN/
!/.vscode/launch.recommended.json
!/.vscode/settings.recommended.json
!/.vscode/tasks.recommended.json

# Local only development artefacts can get installed here.
/local

# We only want the actual document source from this directory.
/docs/site/
21 changes: 19 additions & 2 deletions .vscode/settings.recommended.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.sortMembers": true,
"source.fixAll": true
"source.fixAll": true,
"source.fixAll.markdownlint": true
},
"files.autoSave": "afterDelay",
"editor.formatOnType": true,
Expand Down Expand Up @@ -54,5 +55,21 @@
"bash",
"-c",
"cargo lint-vscode"
]
],
"yaml.schemas": {
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
},
"yaml.customTags": [
"!ENV scalar",
"!ENV sequence",
"tag:yaml.org,2002:python/name:materialx.emoji.to_svg",
"tag:yaml.org,2002:python/name:materialx.emoji.twemoji",
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format"
],
"[markdown]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"files.trimTrailingWhitespace": true,
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
}
}
10 changes: 10 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ global-cargo-config:
FROM scratch
COPY --dir .cargo .cargo
SAVE ARTIFACT .cargo .cargo


repo-docs:
# Create artifacts of extra files we embed inside the documentation when its built.
FROM scratch

WORKDIR /repo
COPY --dir *.md LICENSE-APACHE LICENSE-MIT .

SAVE ARTIFACT /repo repo
4 changes: 2 additions & 2 deletions catalyst-gateway/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ COPY_SRC:

builder:
# The builder with all necessary tools and the correct rust versions.
FROM github.com/input-output-hk/catalyst-ci/earthly/rust:t1+rustup
FROM github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.1+rustup

DO github.com/input-output-hk/catalyst-ci/earthly/rust:t1+RUST_SETUP
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.1+RUST_SETUP

WORKDIR /build

Expand Down
31 changes: 31 additions & 0 deletions docs/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Set the Earthly version to 0.7
VERSION 0.7

# cspell: words mkdocs runable

# Copy all the source we need to build the docs
src:
FROM github.com/input-output-hk/catalyst-ci/earthly/docs:feat/docs3+mkdocs-material
stevenj marked this conversation as resolved.
Show resolved Hide resolved

# Just copy the actual doc src here.
COPY --dir src includes macros overrides mkdocs.yml /docs

# Now copy into that any artifacts we pull from the builds.
COPY --dir ../+repo-docs/repo /docs/includes

# Build the docs here.
docs:
FROM +src

DO github.com/input-output-hk/catalyst-ci/earthly/docs:feat/docs3+BUILD
stevenj marked this conversation as resolved.
Show resolved Hide resolved

# Make a locally runable container that can serve the docs.
local:
# Build a self contained service to show built docs locally.
DO github.com/input-output-hk/catalyst-ci/earthly/docs:feat/docs3+PACKAGE
stevenj marked this conversation as resolved.
Show resolved Hide resolved

# Copy the static pages into the container
COPY +docs/ /usr/share/nginx/html

# This is a local only image, we do not publish it.
SAVE IMAGE cat-voices-docs:latest
3 changes: 3 additions & 0 deletions docs/includes/abbreviations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- markdownlint-disable MD041 MD043-->
*[HTML]: Hyper Text Markup Language
*[W3C]: World Wide Web Consortium
1 change: 1 addition & 0 deletions docs/includes/repo/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# File replaced during documentation build
1 change: 1 addition & 0 deletions docs/includes/repo/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# File replaced during documentation build
1 change: 1 addition & 0 deletions docs/includes/repo/LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# File replaced during documentation build
1 change: 1 addition & 0 deletions docs/includes/repo/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# File replaced during documentation build
10 changes: 10 additions & 0 deletions docs/includes/repo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Repo Documents

These files are replaced during the build with documentation files maintained
globally to the repo.

Such documents are importantly used not just inside the documentation, but also
for people browsing the source repository.

All files in this directory are just placeholders, until the documentation build
replaces them with the appropriate files.
1 change: 1 addition & 0 deletions docs/includes/repo/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# File replaced during documentation build
11 changes: 11 additions & 0 deletions docs/macros/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from .include import inc_file


def define_env(env):
"""
This is the hook for defining variables, macros and filters
"""

@env.macro
def include_file(filename, start_line=0, end_line=None, indent=None):
return inc_file(env, filename, start_line, end_line, indent)
25 changes: 25 additions & 0 deletions docs/macros/include.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import textwrap

def inc_file(env, filename, start_line=0, end_line=None, indent=None):
"""
Include a file, optionally indicating start_line and end_line
(start counting from 0)
The path is relative to the top directory of the documentation
project.
"""

try:
full_filename = os.path.join(env.project_dir, filename)

with open(full_filename, "r") as f:
lines = f.readlines()
line_range = lines[start_line:end_line]
text = "".join(line_range)
if indent is None:
indent = ""
else:
indent = " " * indent
return textwrap.indent(text, indent)
except Exception as exc:
return f"{filename} error: {exc}"
152 changes: 152 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Project Information
site_name: Project Catalyst - Catalyst Voices
site_url: https://input-output-hk.github.io/catalyst-docs
site_author: The Project Catalyst Team
copyright: (c) 2023 Input Output Global

# cspell: words Diagramsnet, pymdownx, linenums, inlinehilite, superfences,
# cspell: words tasklist, betterem, materialx, twemoji, smartsymbols,
# cspell: words kroki, excalidraw, glightbox, cips, pygments, arithmatex

# Repository
repo_name: input-output-hk/catalyst-voices
repo_url: https://github.com/input-output-hk/catalyst-voices

# The Documentation src to build.
docs_dir: src

theme:
name: material
custom_dir: overrides
palette:
# Palette toggle for light mode
- scheme: default
media: "(prefers-color-scheme: light)"
toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- scheme: slate
media: "(prefers-color-scheme: dark)"
toggle:
icon: material/brightness-4
name: Switch to light mode

features:
- navigation.instant
- navigation.instant.progress
- navigation.tracking
#- navigation.tabs
#- navigation.tabs.sticky
- navigation.sections
- navigation.expand
- navigation.path
- navigation.indexes
- toc.follow
- toc.integrate
- search.suggest
- search.highlight

plugins:
- search
- meta-manager
- macros:
module_name: macros
# - diagrams - Plugin is installed, but produces corrupted output
- kroki:
ServerURL: https://kroki.io
EnableDiagramsnet: true
HttpMethod: POST
- glightbox

markdown_extensions:
# Python Markdown
- abbr
- admonition
- attr_list
- def_list
- footnotes
- md_in_html
- tables
- toc:
permalink: true

# Python Markdown Extensions
- pymdownx.arithmatex:
generic: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.keys
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.snippets:
auto_append:
- includes/abbreviations.md
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.tabbed:
alternate_style: true
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde

extra:
consent:
title: Cookie consent
description: >-

We use cookies to recognize your repeated visits and preferences, as well
as to measure the effectiveness of our documentation and whether users
find what they're searching for. With your consent, you're helping us to
make our documentation better.

# Page tree
nav:
- Home:
- Home: index.md
- Getting Started:
- Getting Started: getting-started/index.md
- Quick Start: getting-started/quick-start.md
- Advanced: getting-started/advanced.md
- Development: getting-started/development.md
- Monorepo Architecture:
- Monorepo Architecture: monorepo-architecture/index.md
- Catalyst Standards:
- Catalyst Standards: catalyst-standards/index.md
- Draft CIPs:
- Draft CIPs: catalyst-standards/draft-cips/index.md
- Role Registration: catalyst-standards/draft-cips/role-registration/cip-xxxx.md
- RBAC CIP30 Extension: catalyst-standards/draft-cips/rbac-cip30-extension/cip-xxxx.md
- Catalyst Voting CIP30 Extension: catalyst-standards/draft-cips/catalyst-vote-signing-cip30-extension/cip-xxxx.md
- Catalyst Ballot Formats:
- Catalyst Ballot Formats: catalyst-standards/ballot/index.md
- Catalyst V1 Ballot: catalyst-standards/ballot/catalyst-v1.md
- Catalyst V2 Ballot: catalyst-standards/ballot/catalyst-v2.md
- Appendix:
- Documentation Examples:
- Examples: appendix/examples/index.md
- Abbreviations: appendix/examples/abbreviations.md
- Admonitions: appendix/examples/admonitions.md
- Code Formatting: appendix/examples/code-formatting.md
- Mermaid Diagrams: appendix/examples/mermaid-diagrams.md
- Kroki Diagrams: appendix/examples/kroki-diagrams.md
- Important Information:
- Important Information: appendix/important/index.md
- Contributing: appendix/important/contributing.md
- Code of Conduct: appendix/important/coc.md
- Security: appendix/important/security.md
- License: appendix/important/license.md
43 changes: 43 additions & 0 deletions docs/overrides/cip.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% extends "base.html" %}

<!-- Page content -->
{% block container %}
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
{% if page.meta %}
{% if page.meta.CIP %}
CIP: {{ page.meta.CIP }} <br/>
{% if page.meta.Title %}
Title: {{ page.meta.Title }} <br/>
{% endif %}
{% if page.meta.Category %}
Category: {{ page.meta.Category }} <br/>
{% endif %}
{% if page.meta.Status %}
Status: {{ page.meta.Status }} <br/>
{% endif %}
{% if page.meta.Authors %}
Authors: {{ page.meta.Authors }} <br/>
{% endif %}
{% if page.meta.Implementors %}
Status: {{ page.meta.Implementors }} <br/>
{% endif %}
{% if page.meta.Discussions %}
Status: {{ page.meta.Discussions }} <br/>
{% endif %}
{% if page.meta.Created %}
Status: {{ page.meta.Created }} <br/>
{% endif %}
{% if page.meta.License %}
Status: {{ page.meta.License }} <br/>
{% endif %}
<br/>
{% endif %}
{% endif %}

{% block content %}
{% include "partials/content.html" %}
{% endblock %}
</article>
</div>
{% endblock %}
13 changes: 13 additions & 0 deletions docs/src/appendix/examples/abbreviations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
icon: material/text-short
---

# Consistent Abbreviations

The HTML Specification is maintained by the W3C.

<!-- markdownlint-disable max-one-sentence-per-line -->

!!! note

Abbreviations go in the `docs/includes/abbreviations.md` file.
Loading