Skip to content

Commit

Permalink
feat: init mdbooks for specs site with place holder files (cosmos#1199)
Browse files Browse the repository at this point in the history
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 
-->

This PR adds
[mdbook](https://rust-lang.github.io/mdBook/guide/installation.html) for
hosting the specs site. A workflow was added to deploy the specs site to
github pages.

## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [ ] New and updated code has appropriate documentation
- [ ] New and updated code has new and/or updated testing
- [ ] Required CI checks are passing
- [ ] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords

---------

Co-authored-by: nashqueue <99758629+nashqueue@users.noreply.github.com>
  • Loading branch information
MSevey and nashqueue committed Sep 20, 2023
1 parent 92d41e5 commit 667cec7
Show file tree
Hide file tree
Showing 23 changed files with 170 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/specs-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Specs Deploy

on:
push:
branches:
- main
paths:
- specs/**
pull_request:
paths:
- specs/**
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "0.4.21"

- name: Build book
run: mdbook build specs

- name: Deploy main
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./specs/book
# keep_files is to prevent PR preview files from being overwritten.
# If we need to overwrite such files, trigger this workflow manually.
keep_files: ${{ github.event_name != 'workflow_dispatch' }}

- name: Deploy PR preview
# Only run this job if the PR was created from a branch on
# rollkit/rollkit because this job will fail for branches from forks.
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./specs/book
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ proto/pb
proto/tendermint
types/pb/tendermint
.vscode/launch.json
*/**.html
1 change: 1 addition & 0 deletions block/block.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Block
1 change: 1 addition & 0 deletions da/da.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# DA
1 change: 1 addition & 0 deletions mempool/mempool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Mempool
1 change: 1 addition & 0 deletions node/node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Node
1 change: 1 addition & 0 deletions p2p/p2p.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# P2P
1 change: 1 addition & 0 deletions specs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
38 changes: 38 additions & 0 deletions specs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Rollkit Specifications

## Building From Source

Install [mdbook](https://rust-lang.github.io/mdBook/guide/installation.html) and [mdbook-toc](https://github.com/badboy/mdbook-toc):

```sh
cargo install mdbook
cargo install mdbook-toc
```

To build book:

```sh
mdbook build
```

To serve locally:

```sh
mdbook serve
```

## Contributing

Specifications are written and stored in the same directory with the implementation code. Since `mdbook` does not support referencing files outside of the book directory, we use a symlink to the `src/specs` directory. This allows us to reference the specifications from the `README.md` and `SUMMARY.md` files in the `src` directory.

To create a symlink:

```sh
cd src/specs
ln -s path/to/spec.md
```

Markdown files must conform to [GitHub Flavored Markdown](https://github.github.com/gfm/). Markdown must be formatted with:

- [markdownlint](https://github.com/DavidAnson/markdownlint)
- [Markdown Table Prettifier](https://github.com/darkriszty/MarkdownTablePrettify-VSCodeExt)
16 changes: 16 additions & 0 deletions specs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[book]
authors = ["Rollkit"]
language = "en"
multilingual = false
src = "src"
title = "Rollkit Specifications"

[output.html]
git-repository-url = "https://github.com/rollkit/rollkit"

[rust]
edition = "2021"

[preprocessor.toc]
command = "mdbook-toc"
renderer = ["html"]
3 changes: 3 additions & 0 deletions specs/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Welcome

Welcome to the Rollkit Specifications.
12 changes: 12 additions & 0 deletions specs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Summary

[Introduction](README.md)

- [Template](./specs/template.md)
- [Block](./specs/block.md)
- [DA](./specs/da.md)
- [Mempool](./specs/mempool.md)
- [Node](./specs/node.md)
- [P2P](./specs/p2p.md)
- [State](./specs/state.md)
- [Store](./specs/store.md)
1 change: 1 addition & 0 deletions specs/src/specs/block.md
1 change: 1 addition & 0 deletions specs/src/specs/da.md
1 change: 1 addition & 0 deletions specs/src/specs/mempool.md
1 change: 1 addition & 0 deletions specs/src/specs/node.md
1 change: 1 addition & 0 deletions specs/src/specs/p2p.md
1 change: 1 addition & 0 deletions specs/src/specs/state.md
1 change: 1 addition & 0 deletions specs/src/specs/store.md
1 change: 1 addition & 0 deletions specs/src/specs/template.md
37 changes: 37 additions & 0 deletions specs/template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Protocol/Component Name

## Abstract

Provide a concise description of the purpose of the component for which the
specification is written, along with its contribution to the rollkit or
other relevant parts of the system. Make sure to include proper references to
the relevant sections.

## Protocol/Component Description

Offer a comprehensive explanation of the protocol, covering aspects such as data
flow, communication mechanisms, and any other details necessary for
understanding the inner workings of this component.

## Message Structure/Communication Format

If this particular component is expected to communicate over the network,
outline the structure of the message protocol, including details such as field
interpretation, message format, and any other relevant information.

## Assumptions and Considerations

If there are any assumptions required for the component's correct operation,
performance, security, or other expected features, outline them here.
Additionally, provide any relevant considerations related to security or other
concerns.

## Implementation

Include a link to the location where the implementation of this protocol can be
found. Note that specific implementation details should be documented in the
rollkit repository rather than in the specification document.

## References

List any references used or cited in the document.
1 change: 1 addition & 0 deletions state/state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# State
1 change: 1 addition & 0 deletions store/store.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Store

0 comments on commit 667cec7

Please sign in to comment.