Skip to content

Commit

Permalink
Merge branch 'master' into chore/gnokey-add-update
Browse files Browse the repository at this point in the history
  • Loading branch information
jefft0 authored Aug 28, 2024
2 parents 02333e3 + 651f5aa commit dfa7bbe
Show file tree
Hide file tree
Showing 141 changed files with 5,551 additions and 791 deletions.
60 changes: 59 additions & 1 deletion .github/workflows/portal-loop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: portal-loop

on:
pull_request:
branches:
- master
push:
paths:
- "misc/loop/**"
- ".github/workflows/portal-loop.yml"
branches:
- "master"
- "ops/portal-loop"
# NOTE(albttx): branch name to simplify tests for this workflow
- "ci/portal-loop"
tags:
- "v*"

Expand Down Expand Up @@ -46,3 +50,57 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

test-portal-loop-docker-compose:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Setup the images"
run: |
cd misc/loop
docker compose build
docker compose pull
docker compose up -d
- name: "Test1 - Portal loop start gnoland"
run: |
while
block_height=$(curl -s localhost:26657/status | jq -r '.result.sync_info.latest_block_height')
echo "Current block height: $block_height"
[[ "$block_height" -lt 10 ]]
do
sleep 1
done
curl -s localhost:26657/status | jq
- name: "Buid new gnolang/gno image"
run: |
docker build -t ghcr.io/gnolang/gno/gnoland:master -f Dockerfile --target gnoland .
- name: "Wait for new docker image"
run: |
ip_addr=$(cat misc/loop/traefik/gno.yml | grep -o "http://.*:26657")
while
new_ip_addr=$(cat misc/loop/traefik/gno.yml | grep -o "http://.*:26657")
echo "${ip_addr} -> ${new_ip_addr}"
[[ "${ip_addr}" == ${new_ip_addr} ]]
do
sleep 5
done
- name: "Test2 - Wait portal-loop start new image"
run: |
while
block_height=$(curl -s localhost:26657/status | jq -r '.result.sync_info.latest_block_height')
echo "Current block height: $block_height"
[[ "$block_height" -lt 10 ]]
do
sleep 5
done
docker ps -a
curl -s localhost:26657/status | jq
58 changes: 58 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# build gno
FROM golang:1.22-alpine AS build-gno
RUN go env -w GOMODCACHE=/root/.cache/go-build
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
COPY . ./
RUN --mount=type=cache,target=/root/.cache/go-build go mod download
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gnoland ./gno.land/cmd/gnoland
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gnokey ./gno.land/cmd/gnokey
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gnoweb ./gno.land/cmd/gnoweb
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gno ./gnovm/cmd/gno

# Base image
FROM alpine:3.17 AS base
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
RUN apk add ca-certificates
CMD [ "" ]

# alpine images
# gnoland
FROM base AS gnoland
COPY --from=build-gno /gnoroot/build/gnoland /usr/bin/gnoland
COPY --from=build-gno /gnoroot/examples /gnoroot/examples
COPY --from=build-gno /gnoroot/gnovm/stdlibs /gnoroot/gnovm/stdlibs
COPY --from=build-gno /gnoroot/gno.land/genesis/genesis_txs.jsonl /gnoroot/gno.land/genesis/genesis_txs.jsonl
COPY --from=build-gno /gnoroot/gno.land/genesis/genesis_balances.txt /gnoroot/gno.land/genesis/genesis_balances.txt
EXPOSE 26656 26657
ENTRYPOINT ["/usr/bin/gnoland"]

# gnokey
FROM base AS gnokey
COPY --from=build-gno /gnoroot/build/gnokey /usr/bin/gnokey
# gofmt is required by `gnokey maketx addpkg`
COPY --from=build-gno /usr/local/go/bin/gofmt /usr/bin/gofmt
ENTRYPOINT ["/usr/bin/gnokey"]

# gno
FROM base AS gno
COPY --from=build-gno /gnoroot/build/gno /usr/bin/gno
ENTRYPOINT ["/usr/bin/gno"]

# gnoweb
FROM base AS gnoweb
COPY --from=build-gno /gnoroot/build/gnoweb /usr/bin/gnoweb
COPY --from=build-gno /opt/gno/src/gno.land/cmd/gnoweb /opt/gno/src/gnoweb
EXPOSE 8888
ENTRYPOINT ["/usr/bin/gnoweb"]

# all, contains everything.
FROM base AS all
COPY --from=build-gno /gnoroot/build/* /usr/bin/
COPY --from=build-gno /gnoroot/examples /gnoroot/examples
COPY --from=build-gno /gnoroot/gnovm/stdlibs /gnoroot/gnovm/stdlibs
COPY --from=build-gno /gnoroot/gno.land/genesis/genesis_txs.jsonl /gnoroot/gno.land/genesis/genesis_txs.jsonl
COPY --from=build-gno /gnoroot/gno.land/genesis/genesis_balances.txt /gnoroot/gno.land/genesis/genesis_balances.txt
# gofmt is required by `gnokey maketx addpkg`
COPY --from=build-gno /usr/local/go/bin/gofmt /usr/bin
8 changes: 5 additions & 3 deletions contribs/gnodev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ GOTEST_FLAGS ?= $(GOBUILD_FLAGS) -v -p 1 -timeout=5m
rundep := go run -modfile ../../misc/devdeps/go.mod
golangci_lint := $(rundep) github.com/golangci/golangci-lint/cmd/golangci-lint

install:
install: install.gnodev
install.gnodev:
go install $(GOBUILD_FLAGS) ./cmd/gnodev

build:
go build $(GOBUILD_FLAGS) -o build/gnodev ./cmd/gnodev
# keep gnobro out the default install for now
install.gnobro:
go install $(GOBUILD_FLAGS) ./cmd/gnobro

lint:
$(golangci_lint) --config ../../.github/golangci.yml run ./...
Expand Down
73 changes: 55 additions & 18 deletions contribs/gnodev/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,67 @@
## `gnodev`: Your Gno Companion Tool
## `gnodev`: Your Gno Development Companion

`gnodev` is designed to be a robust and user-friendly tool in your realm package development journey, streamlining your workflow and enhancing productivity.
`gnodev` is a robust tool designed to streamline your Gno package development process, enhancing productivity
by providing immediate feedback on code changes.

We will only give a quick overview below. You may find the official documentation at [docs/gno-tooling/gnodev.md](../../docs/gno-tooling/cli/gnodev.md).
Please note that this is a quick overview. For a more detailed guide, refer to the official documentation at
[docs/gno-tooling/gnodev.md](../../docs/gno-tooling/cli/gnodev.md).

### Synopsis
**gnodev** [**-minimal**] [**-no-watch**] [**PKG_PATH ...**]
**gnodev** [**options**] [**PKG_PATH ...**]

### Features
- **In-Memory Node**: Gnodev starts an in-memory node, and automatically loads
the **examples** folder and any user-specified paths.
- **Web Interface Server**: Starts a `gnoweb` server on `localhost:8888`.
- **Hot Reload**: Monitors the example packages folder and specified directories for file changes,
reloading the package and automatically restarting the node as needed.
- **State Maintenance**: Ensures the current state is preserved by replaying all transactions.
- **In-Memory Node**: Gnodev starts an in-memory node, automatically loading the **examples** folder and any
user-specified paths.
- **Web Interface Server**: Gnodev starts a `gnoweb` server on [`localhost:8888`](https://localhost:8888).
- **Balances and Keybase Customization**: Set account balances, load them from a file, or add new accounts via a flag.
- **Hot Reload**: Monitors the **examples** folder and specified directories for file changes, reloading the
package and automatically restarting the node as needed.
- **State Maintenance**: Ensures the previous node state is preserved by replaying all transactions.
- **Transaction Manipulation**: Allows for interactive cancellation and redoing of transactions.
- **State Export**: Export the current state at any time in a genesis doc format.

### Commands
While `gnodev` is running, the user can trigger specific actions by pressing
the following combinations:
- **H**: Display help information.
- **R**: Reload the node, without resetting the state.
- **Ctrl+R**: Reset the current node state.
- **Ctrl+C**: Exit `gnodev`.
While `gnodev` is running, trigger specific actions by pressing the following combinations:
- **H**: Display help information.
- **A**: Display account balances.
- **R**: Reload the node manually.
- **P**: Cancel the last action.
- **N**: Redo the last cancelled action.
- **Ctrl+S**: Save the current state.
- **Ctrl+R**: Restore the saved state.
- **E**: Export the current state to a genesis file.
- **Cmd+R**: Reset the current node state.
- **Cmd+C**: Exit `gnodev`.

### Usage
Run `gnodev` followed by any specific options and/or package paths. The **examples** directory is loaded
automatically. Use `--minimal` to prevent this.

Example:
```
gnodev --add-account <bech32/name1>[:<amount1>] ./myrealm
```

### `gnobro`: realm interface
`gnobro` is a terminal user interface (TUI) that allows you to browse realms within your terminal. It
automatically connects to `gnodev` for real-time development. In addition to hot reload, it also has the
ability to execute commands and interact with your realm.


#### Usage
**gnobro** [**options**] [**PKG_PATH **]

Run gnobro followed by any specific options and/or a target pacakge path.

Use `gnobro -h` for a detailed list of options.

Example:
```
gnobro gno.land/r/demo/home
```

### Loading 'examples'
The **examples** directory is loaded automatically. If working within this folder, you don't have to specify any additional paths to `gnodev`. Use `--minimal` to prevent this.

### Installation
Run `make install` to install `gnodev`.

Run `make install.gnobro` to install `gnobro`.
19 changes: 19 additions & 0 deletions contribs/gnodev/cmd/gnobro/assets/banner_land_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
. +
+ . Hello %s, Welcome to
.
+ .,-:::::/ :::. :::. ... .
. ,;;-'````' `;;;;, `;;; .;;;;;;;.
[[[ [[[[[[/ [[[[[. '[[ ,[[ \[[,
"$$c. "$$ + $$$ "Y$c$$ $$$, $$$
`Y8bo,,,o88o 888 Y88 "888,_ _,88P
. `'YMUP"YMM MMM . YM "YMMMMMP" +
. .
::: + :::. :::. :::. :::::::-.
;;; ;;`;; `;;;;, `;;; ;;, `';,
+ [[[ ,[[ '[[, + [[[[[. '[[ `[[ [[
$$' c$$$cc$$$c $$$ "Y$c$$ $$, $$
o88oo,.__ 888 888, 888 Y88 888_,o8P'
""""YUMMM YMM ""` MMM + YM MMMMP"` +
.
+
press <enter> to continue
25 changes: 25 additions & 0 deletions contribs/gnodev/cmd/gnobro/assets/gn_hc1.utf8ans
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
 · . · ·
. * . . * . ·
· · · · . . .
· . . . . · *
. · . . ·
░░ ░░ ░ ░░ ░ ░░ ░ ░░ ░░░ ░░░░░░ ░░░ ░░░░ ░ ░░
░░▒▒░░░▒▒░░░░░▒░░░░░░▒▒░░▒░░▒▒░▒░░░░░░░ ░░░░░░▒▒░▒▒▒░▒▒▒▒▒▒░░▒▒▒░░░▒▒▒▒░▒░░▒▒░░
▒▒▓▓▒▒▒▓▓▒▒▒▒▒▓▒▒▒▒▒▒▓▓▒▒▓▒▒▓▓▒▓▒▒▒▒▒▒▒░▒▒▒▒▒▒▓▓▒▓▓▓▒▓▓▓▓▓▓▒▒▓▓▓▒▒▒▓▓▓▓▒▓▒▒▓▓▒▒
▓▓██▓▓▓██▓▓▓▓▓█▓▓▓▓▓▓██▓▓█▓▓██▓█▓▓▓▓▓▓▓▒▓▓▓▓▓▓██▓███▓██████▓▓███▓▓▓████▓█▓▓██▓▓
▀██▒███ █████ ██████▌▐██▒██▌██▒███████▓███▓██▌▐██▒██▌██▒█████▒████ ███▒███ ██
 ▐▒▒▒█ █▒█▌ ▐▒███▌ ▐▒▒▒▌ ▐▒▒███▌█▒███▌███▌ ▐▒▒▒▌ ▐▒▒███▌█▒███ █▒▒▒█▌ ▐▒
 ▒▒▒▒▄ ▄▒█ ▒█▒█▄ ▒▒▒░ ▀▒▒█▌ ▐▒██▐ █▒█▄ ▒▒▒░ ▀▒▒█▌ ▐▒ █▄ ▄▒▒ ▒ ▒
 ░ ░ ▄ ▄▄▒▌ ▒█▒▀ ▀▒▒ ▒▒▒▀▄ ▄▒▄▀▀▄▐▒▀ ▀▒▒ ▒▒▒▀▄ ▄▒ █ ▄ ▄▄▄▀▀▄ ▒
 ▀░ ▒░▒▄░ ▀▄▒▀▒▒ ▀█▒▄▄ ▄■▄▒▒▀ ▒▌░░▐░▀ ▒ ▀ ▄ ■▒░▀ ▒ ▀░ ▒░▌░░▐░ ▀▄
▌░░▐ ▌░░▐
▄▄▀▀▀▀▀▀▀▄▄▀▀▄▀▀▀▀▀▄ ▄▀▀▀▀▀▄ ▌▒▒▐ ▄▄▀▀▀▀▀▄ ▄▀▄▄▀▀▀▀▀▄ ▄▄▄▄▄▌▒▒▐
▌▄▓▓▓▓▓▓▓▄ ▓▓▄▓▓▓▓▓▄▀▀▄▓▓▓▓▓▄▀▄ ▌▓▓▐ ▌▄▓▓▓▓▓▄▀▌▓▌▄▓▓▓▓▓▄▀▀▄▄▄▄▄▄▓▓▐
▌█▌ ██ ███▀▄▄▀██ ▐██▀▀▀██▌▐ ▌██▐ ▐▐██▀▀▀██▌ ███▀▄▄▀██ ▐██▀▀▀███▐
▌▀░░░░░░░░ ░░▌▌ ▌░░ ░░ ░░▐ ▌░░▐ ▌░░ ░░ ░░▌█ ▌░░ ░░▌ ▐░░▐
▐ ▒▒ ▒▒▌▌ ▌▒▒ ▒▒▌ ▐▒▒▐▄▀▄▌▒▒▐ ▌▒▒▌ ▐▒▒ ▒▒▌▌ ▌▒▒ ▒▒▌ ▐▒▒▐
▌▄▄ ▓▓ ▓▓▌▌ ▌▓▓ ▓▓▓ ▓▓▓ ▄▓▄ ▓▓ ▀▀ ▓▓▓ ▐▓▓ ▓▓▌▌ ▌▓▓ ▓▓▓ ▐▓▓▐
░ ▌▀███████▀ ███▐ ▐▐██ ▄▀█████▀▄▄▀█▀▄▀████ ▄▀████▀██ ███▐ ▐▐██ ▄▀████▀██▐ ░
▒ ▓▓▄▄▄▄▄▄▄▄▀▄▄▄▀ ▀▄▄▀ ▀▄▄▄▄▄▀ ▀▄▀ ▀▄▄▄▄▀ ▀▄▄▄▄▀▄▄▀▄▄▄▀ ▀▄▄▀ ▀▄▄▄▄▀▄▄▓ ▒
▓ ▓
█▓▒░ ░▒▓█
Loading

0 comments on commit dfa7bbe

Please sign in to comment.