Skip to content

Commit 2172161

Browse files
committed
docci integration attempt 1
1 parent 9f55df6 commit 2172161

File tree

11 files changed

+133
-21
lines changed

11 files changed

+133
-21
lines changed

.github/workflows/docci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Docci E2E (docs)
2+
3+
on:
4+
# push:
5+
# branches:
6+
# - main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
# Ensures that only a single workflow per PR will run at a time. Cancels in-progress jobs if new commit is pushed.
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
GO_VERSION: 1.23.0
17+
18+
jobs:
19+
run:
20+
runs-on: ubuntu-latest
21+
env:
22+
DEBUGGING: true
23+
RUST_BACKTRACE: 1
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Install Ubuntu packages
30+
run: sudo apt-get update && sudo apt-get install bash make jq
31+
32+
- uses: actions/setup-node@v4
33+
name: Install Node.js
34+
with:
35+
node-version: 21
36+
37+
- name: Setup go
38+
uses: actions/setup-go@v4
39+
with:
40+
go-version: ${{ env.GO_VERSION }}
41+
42+
- name: Install Docci Readme Runner
43+
run: |
44+
VERSION=v0.9.2-alpha.1
45+
wget -O docci.tar.gz "https://github.com/Reecepbcups/docci/releases/download/${VERSION}/docci_Linux_x86_64.tar.gz"
46+
tar -xzf docci.tar.gz
47+
sudo mv docci /usr/local/bin/docci
48+
sudo chmod +x /usr/local/bin/docci
49+
rm docci.tar.gz
50+
51+
52+
- name: setup & install spawn
53+
run: docci run docs/versioned_docs/version-v0.50.x/01-setup/docci_config.json
54+
55+
- name: builds chain
56+
run: docci run docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md
57+
58+
- name: run application
59+
run: |
60+
docci run docs/versioned_docs/version-v0.50.x/02-build-your-application/docci_config.json \
61+
--hide-background-logs --working-dir rollchain \
62+
--cleanup-commands="killall rolld" --cleanup-commands="rm -rf rollchain"

cmd.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
```bash
3+
# docci run docs/versioned_docs/version-v0.50.x/01-setup/02-install-spawn.md,docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md --hide-background-logs
4+
5+
# TODO: we have to support JSON files to have an array of relative file paths in the area
6+
7+
# generate chain (outside of the rollchain dir since it is not generated yet)
8+
docci run docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md --hide-background-logs
9+
10+
# interaction (02 - 05)
11+
docci run docs/versioned_docs/version-v0.50.x/02-build-your-application/docci_config.json --hide-background-logs --working-dir rollchain
12+
13+
# cleanup
14+
rm -rf rollchain
15+
```

docs/versioned_docs/version-v0.50.x/01-setup/01-system-setup.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Install [VSCode](https://code.visualstudio.com/download) if you do not already h
3434
<Tabs defaultValue="macos">
3535
<TabItem value="macos" label="MacOS">
3636

37-
```bash
37+
```bash docci-os=macos
3838
# Setup Homebrew (https://brew.sh/)
3939
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
4040
sudo echo 'export PATH=$PATH:/opt/homebrew/bin' >> ~/.zshrc
@@ -104,7 +104,7 @@ Install [VSCode](https://code.visualstudio.com/download) if you do not already h
104104
<TabItem value="ubuntu-linux" label="Linux (Ubuntu)">
105105

106106
<!-- markdown-link-check-disable -->
107-
```bash
107+
```bash docci-os=linux
108108
# Base
109109
sudo apt install make gcc git jq wget
110110

@@ -131,7 +131,7 @@ Install [VSCode](https://code.visualstudio.com/download) if you do not already h
131131
Some tutorials require CosmWasm (Rust smart contracts) setup. This section is option, unless a tutorial is CosmWasm focused.
132132

133133
CosmWasm requires [Rust](https://www.rust-lang.org/). You must have this installed as the contract will be built locally.
134-
```bash
134+
```bash docci-ignore
135135
# Install rust - https://www.rust-lang.org/tools/install
136136
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
137137

docs/versioned_docs/version-v0.50.x/01-setup/02-install-spawn.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Install Spawn from source.
1919

2020
```bash
2121
# Install from latest source
22-
git clone https://github.com/rollchains/spawn.git --depth 1 --branch v0.50.15
22+
git clone https://github.com/rollchains/spawn.git --depth 1 --branch v0.50.15 spawn_bin
2323

2424
# Change to this directory
25-
cd spawn
25+
cd spawn_bin
2626

2727
# Clear Go modules cache for a fresh install
2828
go clean -modcache
@@ -42,13 +42,15 @@ spawn
4242
local-ic
4343

4444
heighliner
45+
46+
rm -rf spawn_bin
4547
```
4648

4749
## Command not found error
4850

4951
If you get "command 'spawn' not found", run:
5052

51-
```bash
53+
```bash docci-ignore
5254
# Gets your operating system
5355
unameOut="$(uname -s)"
5456
case "${unameOut}" in
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"files": [
3+
"01-system-setup.md",
4+
"02-install-spawn.md"
5+
]
6+
}

docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Let's create a new chain called 'rollchain'. You are going to set defining chara
4444
- Binary executable (bin)
4545

4646
```bash
47-
spawn new rollchain --consensus=pos --disable=cosmwasm --bech32=roll --denom=uroll --bin=rolld
47+
spawn new rollchain --consensus=pos --disable=cosmwasm,explorer --bech32=roll --denom=uroll --bin=rolld
4848
```
4949

5050
🎉 Your new blockchain 'rollchain' is now generated!

docs/versioned_docs/version-v0.50.x/02-build-your-application/02-proto-logic.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Extend the template module and add how to store and interact with data. Specific
1313

1414
Open the `proto/nameservice/v1` directory. Edit `tx.proto` to add the transaction setter message.
1515

16-
```protobuf title="proto/nameservice/v1/tx.proto"
16+
```protobuf title="proto/nameservice/v1/tx.proto" docci-file="proto/nameservice/v1/tx.proto" docci-line-replace=19
1717
1818
// SetServiceName allows a user to set their accounts name.
1919
rpc SetServiceName(MsgSetServiceName) returns (MsgSetServiceNameResponse);
@@ -42,7 +42,8 @@ proto/nameservice/v1/tx.proto file
4242

4343
Find `query.proto` and add the following
4444

45-
```protobuf title="proto/nameservice/v1/query.proto"
45+
<!-- TODO: verify if this should be 15 or 14 (0 or 1 indexed) -->
46+
```protobuf title="proto/nameservice/v1/query.proto" docci-file="proto/nameservice/v1/query.proto" docci-line-replace=15
4647
4748
// ResolveName allows a user to resolve the name of an account.
4849
rpc ResolveName(QueryResolveNameRequest) returns (QueryResolveNameResponse) {

docs/versioned_docs/version-v0.50.x/02-build-your-application/03-application-logic.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,25 @@ func NewKeeper() Keeper {
3535
}
3636
```
3737

38+
<!-- ==================
39+
```bash docci-file=x/nameservice/keeper/keeper.go docci-line-replace=29
40+
NameMapping collections.Map[string, string]
41+
```
42+
43+
```bash docci-file=x/nameservice/keeper/keeper.go docci-line-replace=64
44+
NameMapping: collections.NewMap(sb, collections.NewPrefix(1),
45+
"name_mapping", collections.StringKey, collections.StringValue,
46+
),
47+
```
48+
================== -->
49+
3850
---
3951

4052
## Application Logic
4153

4254
Update the msg_server logic to set the name upon request from a user.
4355

44-
```go title="x/nameservice/keeper/msg_server.go"
56+
```go title="x/nameservice/keeper/msg_server.go" docci-file=x/nameservice/keeper/msg_server.go docci-line-replace=30-38
4557
func (ms msgServer) SetServiceName(ctx context.Context, msg *types.MsgSetServiceName) (*types.MsgSetServiceNameResponse, error) {
4658
// highlight-start
4759
if err := ms.k.NameMapping.Set(ctx, msg.Sender, msg.Name); err != nil {
@@ -55,7 +67,7 @@ func (ms msgServer) SetServiceName(ctx context.Context, msg *types.MsgSetService
5567

5668
and also for the query_server to retrieve the name.
5769

58-
```go title="x/nameservice/keeper/query_server.go"
70+
```go title="x/nameservice/keeper/query_server.go" docci-file=x/nameservice/keeper/query_server.go docci-line-replace=33-37
5971
func (k Querier) ResolveName(goCtx context.Context, req *types.QueryResolveNameRequest) (*types.QueryResolveNameResponse, error) {
6072
// highlight-start
6173
v, err := k.Keeper.NameMapping.Get(goCtx, req.Wallet)

docs/versioned_docs/version-v0.50.x/02-build-your-application/04-cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Using the AutoCLI, you will easily set up the CLI client for transactions and qu
1313

1414
Update the autocli to allow someone to get the name of a wallet account.
1515

16-
```go title="x/nameservice/autocli.go"
16+
```go title="x/nameservice/autocli.go" docci-file="x/nameservice/autocli.go" docci-line-replace=11-20
1717
Query: &autocliv1.ServiceCommandDescriptor{
1818
Service: modulev1.Query_ServiceDesc.ServiceName,
1919
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
@@ -48,7 +48,7 @@ Update the autocli to allow someone to get the name of a wallet account.
4848

4949
Also add interaction in `x/nameservice/autocli.go` to set the name of a wallet account.
5050

51-
```go title="x/nameservice/autocli.go"
51+
```go title="x/nameservice/autocli.go" docci-file="x/nameservice/autocli.go" docci-line-replace=31-39
5252
Tx: &autocliv1.ServiceCommandDescriptor{
5353
Service: modulev1.Msg_ServiceDesc.ServiceName,
5454
RpcCommandOptions: []*autocliv1.RpcCommandOptions{

docs/versioned_docs/version-v0.50.x/02-build-your-application/05-testnet.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Congrats!! You built your first network already. You are ready to run a local te
1919

2020
Use the `sh-testnet` command *(short for shell testnet)* to quickly build your application, generate example wallet accounts, and start the local network on your machine.
2121

22-
```bash
22+
```bash docci-background
2323
# Run a quick shell testnet
2424
make sh-testnet
2525
```
@@ -32,22 +32,22 @@ Using the newly built binary executable *(rolld from the --bin flag when the cha
3232

3333
You can either query or set data in the network using the command executable. If you wish to perform an action you submit a transaction (tx). If you wish to read data you are querying (q). The next sub command specifies which module will receive the action on. In this case, the `nameservice` module since our module is named nameservice. Then the `set` command is called, which was defined in the autocli.go.
3434

35-
```bash
36-
rolld tx nameservice set alice --from=acc1 --yes
35+
```bash docci-wait-for-endpoint=http://localhost:26657/health|300 docci-delay-per-cmd=2 docci-delay-before=5 docci-output-contains="/nameservice.v1.MsgSetServiceName"
36+
# set your name
37+
TX_HASH=`rolld tx nameservice set alice --from=acc1 --yes -o json | jq -r '.txhash'`
3738

3839
# You can verify this transaction was successful
3940
# By querying it's unique ID.
40-
rolld q tx EC3FBF3248E24B5FEB6A5F7F35BBB4634E9C75587119E3FBCF5C1FED05E5A399
41+
rolld q tx $TX_HASH
4142
```
4243

4344
## Interaction Get Name
4445

4546
Now you are going to get the name of a wallet. A nested command `$(rolld keys show acc1 -a)` gets the unique address of the acc1 account added when you started the testnet.
4647

47-
```bash
48-
rolld q nameservice resolve roll1efd63aw40lxf3n4mhf7dzhjkr453axur57cawh --output=json
49-
50-
rolld q nameservice resolve $(rolld keys show acc1 -a) --output=json
48+
```bash docci-output-contains=alice
49+
ADDRESS=$(rolld keys show acc1 -a)
50+
rolld q nameservice resolve ${ADDRESS} --output=json
5151
```
5252

5353
The expected result should be:
@@ -62,5 +62,11 @@ The expected result should be:
6262
When you are ready to stop the testnet, you can use `ctrl + c` or `killall -9 rolld`.
6363
:::
6464

65+
<!--
66+
Kill rolld after use
67+
```bash
68+
killall rolld
69+
```
70+
-->
6571

6672
Your network is now running and you have successfully set and resolved a name! 🎉

0 commit comments

Comments
 (0)