Skip to content

Commit dcb94c2

Browse files
authored
feat(ci): docci integration (#321)
* docci integration attempt 1 * nit: rm cmd file, add docci-os=windows * comment out gh auth login * go cache * install binary standalone * comment * stop old e2e solution due to being broken * fix: steps for docci
1 parent 9f55df6 commit dcb94c2

File tree

11 files changed

+256
-137
lines changed

11 files changed

+256
-137
lines changed

.github/workflows/docci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
- id: go-cache-paths
27+
run: |
28+
echo "::set-output name=go-build::$(go env GOCACHE)"
29+
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
30+
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Install Ubuntu packages
35+
run: sudo apt-get update && sudo apt-get install bash make jq
36+
37+
- name: Setup go
38+
uses: actions/setup-go@v4
39+
with:
40+
go-version: ${{ env.GO_VERSION }}
41+
42+
# Cache go mod cache, used to speedup builds
43+
- name: Go Mod Cache
44+
uses: actions/cache@v4
45+
with:
46+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
47+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
48+
49+
# Cache go build cache, used to speedup go test
50+
- name: Go Build Cache
51+
uses: actions/cache@v4
52+
with:
53+
path: ${{ steps.go-cache-paths.outputs.go-build }}
54+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
55+
56+
57+
- name: Install Docci Readme Runner
58+
run: |
59+
VERSION=v0.9.2-alpha.1
60+
wget -O docci.tar.gz "https://github.com/Reecepbcups/docci/releases/download/${VERSION}/docci_Linux_x86_64.tar.gz"
61+
tar -xzf docci.tar.gz
62+
sudo mv docci /usr/local/bin/docci
63+
sudo chmod +x /usr/local/bin/docci
64+
rm docci.tar.gz
65+
66+
- name: setup & install spawn
67+
run: docci run docs/versioned_docs/version-v0.50.x/01-setup/docci_config.json
68+
69+
# since this is not run within the 'rollchain' directory, it runs standalone before (this generates the rollchain dir)
70+
- name: builds chain
71+
run: docci run docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md
72+
73+
- name: run application
74+
run: |
75+
docci run docs/versioned_docs/version-v0.50.x/02-build-your-application/docci_config.json \
76+
--hide-background-logs --working-dir rollchain \
77+
--cleanup-commands="killall rolld" --cleanup-commands="rm -rf rollchain"
Lines changed: 116 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,116 @@
1-
name: Run Spawn E2E
2-
3-
# Chain name MUST be `mychain` using binary name `appd`
4-
5-
on:
6-
workflow_call:
7-
inputs:
8-
id:
9-
type: string
10-
required: true
11-
description: 'ID / description of the whole thing'
12-
spawn-create-cmd:
13-
type: string
14-
required: true
15-
description: 'The spawn command to create the chain'
16-
start-chain-cmd:
17-
type: string
18-
required: true
19-
description: 'The command which runs the chain via the shell'
20-
spawn-extra-cmd:
21-
type: string
22-
required: false
23-
description: 'Extra command to run after the chain is created'
24-
25-
env:
26-
GO_VERSION: 1.22.3
27-
JQ_VERSION: '1.7'
28-
JQ_FORCE: false
29-
30-
31-
jobs:
32-
run:
33-
runs-on: ubuntu-latest
34-
steps:
35-
# === BASE SETUP ===
36-
- id: go-cache-paths
37-
run: |
38-
echo "::set-output name=go-build::$(go env GOCACHE)"
39-
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
40-
41-
- name: 'Setup jq'
42-
uses: dcarbone/install-jq-action@v2
43-
with:
44-
version: '${{ env.JQ_VERSION }}'
45-
force: '${{ env.JQ_FORCE }}'
46-
47-
- name: Set up Go ${{ env.GO_VERSION }}
48-
uses: actions/setup-go@v4
49-
with:
50-
go-version: ${{ env.GO_VERSION }}
51-
52-
- name: Go Build Cache
53-
uses: actions/cache@v4
54-
with:
55-
path: ${{ steps.go-cache-paths.outputs.go-build }}
56-
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
57-
58-
- name: Go Mod Cache
59-
uses: actions/cache@v4
60-
with:
61-
path: ${{ steps.go-cache-paths.outputs.go-mod }}
62-
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
63-
64-
# === SETUP SPAWN ===
65-
- name: Download Spawn Bin
66-
uses: actions/download-artifact@master
67-
with:
68-
name: spawn
69-
path: /home/runner/go/bin
70-
71-
- name: Spawn Permission # put into path
72-
run: chmod +x /home/runner/go/bin/spawn && ls -l
73-
74-
# === Chain Creation & Validation ===
75-
- name: Spawn Gen - '${{inputs.id}}'
76-
run: |
77-
git config --global --add url."[email protected]:".insteadOf "https://github.com/"
78-
git config --global user.email "[email protected]"
79-
git config --global user.name "Your Name"
80-
${{ inputs.spawn-create-cmd }}
81-
pwd
82-
83-
- name: Spawn Extra Generation
84-
if : ${{ inputs.spawn-extra-cmd }}
85-
run: ${{ inputs.spawn-extra-cmd }}
86-
87-
- name: Build and Run '${{inputs.id}}'
88-
run: |
89-
cd mychain
90-
${{ inputs.start-chain-cmd }}
91-
92-
# Runs the unit test after the chain is started in the background
93-
# This way the work is parallelized
94-
- name: Unit Test - '${{inputs.id}}'
95-
run: |
96-
cd mychain
97-
go test ./...
98-
99-
- name: Validate '${{inputs.id}}' is Running
100-
run: |
101-
for ((i = 1; i <= 10; i++)); do
102-
res=`appd status --output=json | jq -r 'has("sync_info")'`
103-
if [ "$res" == "true" ]; then
104-
echo "Chain is running"
105-
exit 0
106-
else
107-
echo "Chain is not running"
108-
# exit 1
109-
sleep 5
110-
fi
111-
done
112-
113-
lsof -i tcp:26657 | awk 'NR!=1 {print $2}' | xargs kill || true
114-
exit 1
1+
# TODO: github broke in the past which causes these to fail now (the app does not stat on localhost for some reason within re-usable workflows or something)
2+
3+
# name: Run Spawn E2E
4+
5+
# # Chain name MUST be `mychain` using binary name `appd`
6+
7+
# on:
8+
# workflow_call:
9+
# inputs:
10+
# id:
11+
# type: string
12+
# required: true
13+
# description: 'ID / description of the whole thing'
14+
# spawn-create-cmd:
15+
# type: string
16+
# required: true
17+
# description: 'The spawn command to create the chain'
18+
# start-chain-cmd:
19+
# type: string
20+
# required: true
21+
# description: 'The command which runs the chain via the shell'
22+
# spawn-extra-cmd:
23+
# type: string
24+
# required: false
25+
# description: 'Extra command to run after the chain is created'
26+
27+
# env:
28+
# GO_VERSION: 1.22.3
29+
# JQ_VERSION: '1.7'
30+
# JQ_FORCE: false
31+
32+
33+
# jobs:
34+
# run:
35+
# runs-on: ubuntu-latest
36+
# steps:
37+
# # === BASE SETUP ===
38+
# - id: go-cache-paths
39+
# run: |
40+
# echo "::set-output name=go-build::$(go env GOCACHE)"
41+
# echo "::set-output name=go-mod::$(go env GOMODCACHE)"
42+
43+
# - name: 'Setup jq'
44+
# uses: dcarbone/install-jq-action@v2
45+
# with:
46+
# version: '${{ env.JQ_VERSION }}'
47+
# force: '${{ env.JQ_FORCE }}'
48+
49+
# - name: Set up Go ${{ env.GO_VERSION }}
50+
# uses: actions/setup-go@v4
51+
# with:
52+
# go-version: ${{ env.GO_VERSION }}
53+
54+
# - name: Go Build Cache
55+
# uses: actions/cache@v4
56+
# with:
57+
# path: ${{ steps.go-cache-paths.outputs.go-build }}
58+
# key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
59+
60+
# - name: Go Mod Cache
61+
# uses: actions/cache@v4
62+
# with:
63+
# path: ${{ steps.go-cache-paths.outputs.go-mod }}
64+
# key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
65+
66+
# # === SETUP SPAWN ===
67+
# - name: Download Spawn Bin
68+
# uses: actions/download-artifact@master
69+
# with:
70+
# name: spawn
71+
# path: /home/runner/go/bin
72+
73+
# - name: Spawn Permission # put into path
74+
# run: chmod +x /home/runner/go/bin/spawn && ls -l
75+
76+
# # === Chain Creation & Validation ===
77+
# - name: Spawn Gen - '${{inputs.id}}'
78+
# run: |
79+
# git config --global --add url."[email protected]:".insteadOf "https://github.com/"
80+
# git config --global user.email "[email protected]"
81+
# git config --global user.name "Your Name"
82+
# ${{ inputs.spawn-create-cmd }}
83+
# pwd
84+
85+
# - name: Spawn Extra Generation
86+
# if : ${{ inputs.spawn-extra-cmd }}
87+
# run: ${{ inputs.spawn-extra-cmd }}
88+
89+
# - name: Build and Run '${{inputs.id}}'
90+
# run: |
91+
# cd mychain
92+
# ${{ inputs.start-chain-cmd }}
93+
94+
# # Runs the unit test after the chain is started in the background
95+
# # This way the work is parallelized
96+
# - name: Unit Test - '${{inputs.id}}'
97+
# run: |
98+
# cd mychain
99+
# go test ./...
100+
101+
# - name: Validate '${{inputs.id}}' is Running
102+
# run: |
103+
# for ((i = 1; i <= 10; i++)); do
104+
# res=`appd status --output=json | jq -r 'has("sync_info")'`
105+
# if [ "$res" == "true" ]; then
106+
# echo "Chain is running"
107+
# exit 0
108+
# else
109+
# echo "Chain is not running"
110+
# # exit 1
111+
# sleep 5
112+
# fi
113+
# done
114+
115+
# lsof -i tcp:26657 | awk 'NR!=1 {print $2}' | xargs kill || true
116+
# exit 1

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

Lines changed: 6 additions & 6 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
@@ -61,7 +61,7 @@ Install [VSCode](https://code.visualstudio.com/download) if you do not already h
6161

6262
<TabItem value="windows" label="Windows (WSL)" default>
6363

64-
```bash
64+
```bash docci-os="windows"
6565
# Install WSL in powershell
6666
wsl --install
6767

@@ -104,16 +104,16 @@ 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

111111
# (optional) Github CLI - https://github.com/cli/cli
112112
curl -sS https://webi.sh/gh | sh
113-
gh auth login
113+
# gh auth login
114114

115115
# Golang
116-
GO_VERSION=1.23.0
116+
GO_VERSION=1.23.9
117117
wget https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz
118118
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz
119119

@@ -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+
}

0 commit comments

Comments
 (0)