Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
77 changes: 77 additions & 0 deletions .github/workflows/docci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Docci E2E (docs)

on:
# push:
# branches:
# - main
pull_request:
workflow_dispatch:

# Ensures that only a single workflow per PR will run at a time. Cancels in-progress jobs if new commit is pushed.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
GO_VERSION: 1.23.0

jobs:
run:
runs-on: ubuntu-latest
env:
DEBUGGING: true
RUST_BACKTRACE: 1

steps:
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"

- name: Checkout repository
uses: actions/checkout@v4

- name: Install Ubuntu packages
run: sudo apt-get update && sudo apt-get install bash make jq

- name: Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}


- name: Install Docci Readme Runner
run: |
VERSION=v0.9.2-alpha.1
wget -O docci.tar.gz "https://github.com/Reecepbcups/docci/releases/download/${VERSION}/docci_Linux_x86_64.tar.gz"
tar -xzf docci.tar.gz
sudo mv docci /usr/local/bin/docci
sudo chmod +x /usr/local/bin/docci
rm docci.tar.gz

- name: setup & install spawn
run: docci run docs/versioned_docs/version-v0.50.x/01-setup/docci_config.json

# since this is not run within the 'rollchain' directory, it runs standalone before (this generates the rollchain dir)
- name: builds chain
run: docci run docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md

- name: run application
run: |
docci run docs/versioned_docs/version-v0.50.x/02-build-your-application/docci_config.json \
--hide-background-logs --working-dir rollchain \
--cleanup-commands="killall rolld" --cleanup-commands="rm -rf rollchain"
230 changes: 116 additions & 114 deletions .github/workflows/reusable-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,114 +1,116 @@
name: Run Spawn E2E

# Chain name MUST be `mychain` using binary name `appd`

on:
workflow_call:
inputs:
id:
type: string
required: true
description: 'ID / description of the whole thing'
spawn-create-cmd:
type: string
required: true
description: 'The spawn command to create the chain'
start-chain-cmd:
type: string
required: true
description: 'The command which runs the chain via the shell'
spawn-extra-cmd:
type: string
required: false
description: 'Extra command to run after the chain is created'

env:
GO_VERSION: 1.22.3
JQ_VERSION: '1.7'
JQ_FORCE: false


jobs:
run:
runs-on: ubuntu-latest
steps:
# === BASE SETUP ===
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"

- name: 'Setup jq'
uses: dcarbone/install-jq-action@v2
with:
version: '${{ env.JQ_VERSION }}'
force: '${{ env.JQ_FORCE }}'

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Go Build Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

- name: Go Mod Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

# === SETUP SPAWN ===
- name: Download Spawn Bin
uses: actions/download-artifact@master
with:
name: spawn
path: /home/runner/go/bin

- name: Spawn Permission # put into path
run: chmod +x /home/runner/go/bin/spawn && ls -l

# === Chain Creation & Validation ===
- name: Spawn Gen - '${{inputs.id}}'
run: |
git config --global --add url."git@github.com:".insteadOf "https://github.com/"
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
${{ inputs.spawn-create-cmd }}
pwd

- name: Spawn Extra Generation
if : ${{ inputs.spawn-extra-cmd }}
run: ${{ inputs.spawn-extra-cmd }}

- name: Build and Run '${{inputs.id}}'
run: |
cd mychain
${{ inputs.start-chain-cmd }}

# Runs the unit test after the chain is started in the background
# This way the work is parallelized
- name: Unit Test - '${{inputs.id}}'
run: |
cd mychain
go test ./...

- name: Validate '${{inputs.id}}' is Running
run: |
for ((i = 1; i <= 10; i++)); do
res=`appd status --output=json | jq -r 'has("sync_info")'`
if [ "$res" == "true" ]; then
echo "Chain is running"
exit 0
else
echo "Chain is not running"
# exit 1
sleep 5
fi
done

lsof -i tcp:26657 | awk 'NR!=1 {print $2}' | xargs kill || true
exit 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)

# name: Run Spawn E2E

# # Chain name MUST be `mychain` using binary name `appd`

# on:
# workflow_call:
# inputs:
# id:
# type: string
# required: true
# description: 'ID / description of the whole thing'
# spawn-create-cmd:
# type: string
# required: true
# description: 'The spawn command to create the chain'
# start-chain-cmd:
# type: string
# required: true
# description: 'The command which runs the chain via the shell'
# spawn-extra-cmd:
# type: string
# required: false
# description: 'Extra command to run after the chain is created'

# env:
# GO_VERSION: 1.22.3
# JQ_VERSION: '1.7'
# JQ_FORCE: false


# jobs:
# run:
# runs-on: ubuntu-latest
# steps:
# # === BASE SETUP ===
# - id: go-cache-paths
# run: |
# echo "::set-output name=go-build::$(go env GOCACHE)"
# echo "::set-output name=go-mod::$(go env GOMODCACHE)"

# - name: 'Setup jq'
# uses: dcarbone/install-jq-action@v2
# with:
# version: '${{ env.JQ_VERSION }}'
# force: '${{ env.JQ_FORCE }}'

# - name: Set up Go ${{ env.GO_VERSION }}
# uses: actions/setup-go@v4
# with:
# go-version: ${{ env.GO_VERSION }}

# - name: Go Build Cache
# uses: actions/cache@v4
# with:
# path: ${{ steps.go-cache-paths.outputs.go-build }}
# key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# - name: Go Mod Cache
# uses: actions/cache@v4
# with:
# path: ${{ steps.go-cache-paths.outputs.go-mod }}
# key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

# # === SETUP SPAWN ===
# - name: Download Spawn Bin
# uses: actions/download-artifact@master
# with:
# name: spawn
# path: /home/runner/go/bin

# - name: Spawn Permission # put into path
# run: chmod +x /home/runner/go/bin/spawn && ls -l

# # === Chain Creation & Validation ===
# - name: Spawn Gen - '${{inputs.id}}'
# run: |
# git config --global --add url."git@github.com:".insteadOf "https://github.com/"
# git config --global user.email "you@example.com"
# git config --global user.name "Your Name"
# ${{ inputs.spawn-create-cmd }}
# pwd

# - name: Spawn Extra Generation
# if : ${{ inputs.spawn-extra-cmd }}
# run: ${{ inputs.spawn-extra-cmd }}

# - name: Build and Run '${{inputs.id}}'
# run: |
# cd mychain
# ${{ inputs.start-chain-cmd }}

# # Runs the unit test after the chain is started in the background
# # This way the work is parallelized
# - name: Unit Test - '${{inputs.id}}'
# run: |
# cd mychain
# go test ./...

# - name: Validate '${{inputs.id}}' is Running
# run: |
# for ((i = 1; i <= 10; i++)); do
# res=`appd status --output=json | jq -r 'has("sync_info")'`
# if [ "$res" == "true" ]; then
# echo "Chain is running"
# exit 0
# else
# echo "Chain is not running"
# # exit 1
# sleep 5
# fi
# done

# lsof -i tcp:26657 | awk 'NR!=1 {print $2}' | xargs kill || true
# exit 1
12 changes: 6 additions & 6 deletions docs/versioned_docs/version-v0.50.x/01-setup/01-system-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Install [VSCode](https://code.visualstudio.com/download) if you do not already h
<Tabs defaultValue="macos">
<TabItem value="macos" label="MacOS">

```bash
```bash docci-os="macos"
# Setup Homebrew (https://brew.sh/)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
sudo echo 'export PATH=$PATH:/opt/homebrew/bin' >> ~/.zshrc
Expand All @@ -61,7 +61,7 @@ Install [VSCode](https://code.visualstudio.com/download) if you do not already h

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

```bash
```bash docci-os="windows"
# Install WSL in powershell
wsl --install

Expand Down Expand Up @@ -104,16 +104,16 @@ Install [VSCode](https://code.visualstudio.com/download) if you do not already h
<TabItem value="ubuntu-linux" label="Linux (Ubuntu)">

<!-- markdown-link-check-disable -->
```bash
```bash docci-os="linux"
# Base
sudo apt install make gcc git jq wget

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Install Spawn from source.

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

# Change to this directory
cd spawn
cd spawn_bin

# Clear Go modules cache for a fresh install
go clean -modcache
Expand All @@ -42,13 +42,15 @@ spawn
local-ic

heighliner

rm -rf spawn_bin
```

## Command not found error

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

```bash
```bash docci-ignore
# Gets your operating system
unameOut="$(uname -s)"
case "${unameOut}" in
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files": [
"01-system-setup.md",
"02-install-spawn.md"
]
}
Loading
Loading