Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starship integration #420

Merged
merged 9 commits into from
Aug 23, 2023
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
26 changes: 20 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ jobs:
- name: Lint regular markdown files
uses: avto-dev/markdown-lint@v1.5.0
with:
args: '**/*.md'
ignore: 'CHANGELOG.md docs/**/*.md'
args: "**/*.md"
ignore: "CHANGELOG.md docs/**/*.md"

- name: Lint generated markdown files
uses: avto-dev/markdown-lint@v1.5.0
with:
args: 'docs/**/*.md'
config: 'docs/.markdownlint.yaml'
args: "docs/**/*.md"
config: "docs/.markdownlint.yaml"

lint-yaml:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
uses: actions/setup-go@v4.0.1
if: steps.changed-go-files.outputs.any_changed == 'true'
with:
go-version: '1.20'
go-version: "1.20"
cache: false

- name: Lint go code (golangci-lint)
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v4.0.1
with:
go-version: '1.20'
go-version: "1.20"

- name: Generate command documentation
run: |
Expand All @@ -176,3 +176,17 @@ jobs:
>&2 git status
exit 1
fi

lint-shell:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Lint shell scripts
uses: ludeeus/action-shellcheck@2.0.0
with:
scandir: .
version: "v0.9.0"
env:
SHELLCHECK_OPTS: -e SC2034
52 changes: 52 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test E2E

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: e2e-test-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e-test:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Go environment
uses: actions/setup-go@v4.0.1
with:
go-version: "1.20"

- name: Setup Test infra
id: starship-action
uses: cosmology-tech/starship-action@0.2.12
with:
values: starship/configs/ci.yaml
port-forward: true
version: 0.1.38

- name: Run Tests
run: |
cd starship/
go mod tidy

make test

# todo(@anmol1696): change this to be post step of the action
- name: Clean cluster
if: always()
run: |
helm delete $DEVNET_NAME --debug --namespace $DEVNET_NAMESPACE --wait || true
kubectl delete namespace $DEVNET_NAMESPACE --wait=true || true
env:
DEVNET_NAME: ${{ steps.starship-action.outputs.name }}
DEVNET_NAMESPACE: ${{ steps.starship-action.outputs.namespace }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v4.0.1
with:
go-version: '1.20'
go-version: "1.20"

- name: Test go project
run: |
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v4.0.1
with:
go-version: '1.20'
go-version: "1.20"

- name: Install OKP4 blockchain
run: |
Expand Down
34 changes: 34 additions & 0 deletions starship/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#--- Build stage
FROM golang:1.20-alpine3.16 AS go-builder

WORKDIR /src

# CosmWasm: see https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.2.4/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.2.4/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a

# hadolint ignore=DL4006
RUN set -eux \
&& apk add --no-cache ca-certificates=20220614-r0 build-base=0.5-r3 git=2.36.6-r0 linux-headers=5.16.7-r1 \
&& sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 682a54082e131eaff9beec80ba3e5908113916fcb8ddf7c668cb2d97cb94c13c \
&& sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ce3d892377d2523cf563e01120cb1436f9343f80be952c93f66aa94f5737b661 \
&& cp "/lib/libwasmvm_muslc.$(uname -m).a" /lib/libwasmvm_muslc.a

COPY . /src/

RUN BUILD_TAGS=muslc LINK_STATICALLY=true make build

#--- Image stage
FROM alpine:3.17.3

COPY --from=go-builder /src/target/dist/okp4d /usr/bin/okp4d

# Set up dependencies
ENV PACKAGES curl make bash jq sed

# Install minimum necessary dependencies
RUN apk add --no-cache $PACKAGES

WORKDIR /opt

ENTRYPOINT ["okp4d"]
114 changes: 114 additions & 0 deletions starship/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
NAME = okp4-starship
FILE = configs/local.yaml

HELM_REPO = starship
HELM_CHART = devnet
HELM_VERSION = v0.1.38

###############################################################################
### Run tests ###
###############################################################################

.PHONY: test
test:
cd tests/ && go test -v ./...

###############################################################################
### All commands ###
###############################################################################

.PHONY: setup
setup: setup-deps setup-helm

.PHONY: stop
stop: stop-forward delete

.PHONY: clean
clean: stop clean-kind

###############################################################################
### Dependency check ###
###############################################################################

.PHONY: check
setup-deps:
bash $(CURDIR)/scripts/dev-setup.sh


###############################################################################
### Docker build cmds ###
###############################################################################

DOCKER_BUILDX_NAME := okp4

.PHONY: docker-setup
docker-setup:
-@docker buildx create --use --name $(DOCKER_BUILDX_NAME)

.PHONY: docker-build
docker-build: docker-setup
cd $(CURDIR)/.. && docker buildx build --platform linux/arm64,linux/amd64 -t anmol1696/okp4d:latest . --push -f starship/Dockerfile

###############################################################################
### Helm Charts ###
###############################################################################

setup-helm:
helm repo add $(HELM_REPO) https://cosmology-tech.github.io/starship/
helm repo update
helm search repo $(HELM_REPO)/$(HELM_CHART) --version $(HELM_VERSION)

install:
helm install -f $(FILE) $(NAME) $(HELM_REPO)/$(HELM_CHART) --version $(HELM_VERSION)
@echo "Please run \`$ kubectl get pods\` and wait till all pods are in running state"
@echo "Then run \`$ make port-forward\` to forward all the ports locally"

install-dev:
$(MAKE) install FILE=configs/devnet.yaml

install-local:
$(MAKE) install FILE=configs/local.yaml

install-ci:
$(MAKE) install FILE=configs/ci.yaml

delete:
-helm delete $(NAME)

###############################################################################
### Port forward ###
###############################################################################

.PHONY: port-forward
port-forward:
bash $(CURDIR)/scripts/port-forward.sh --config=$(FILE)

.PHONY: port-forward-dev
port-forward-dev:
$(MAKE) port-forward FILE=configs/devnet.yaml

.PHONY: port-forward-local
port-forward-local:
$(MAKE) port-forward FILE=configs/local.yaml

.PHONY: port-forward-ci
port-forward-ci:
$(MAKE) port-forward FILE=configs/ci.yaml


.PHONY: stop-forward
stop-forward:
-pkill -f "port-forward"

###############################################################################
### Local Kind Setup ###
###############################################################################
KIND_CLUSTER=starship

.PHONY: setup-kind
setup-kind:
kind create cluster --name $(KIND_CLUSTER)

.PHONY: clean-kind
clean-kind:
kind delete cluster --name $(KIND_CLUSTER)
Empty file added starship/README.md
Empty file.
59 changes: 59 additions & 0 deletions starship/configs/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
chains:
- name: okp4-1
type: custom
numValidators: 1
image: anmol1696/okp4d:latest
home: /root/.okp4d
binary: okp4d
prefix: okp4
denom: uknow
coins: 100000000000000uknow
hdPath: m/44'/118'/0'/0/0
coinType: 118
repo: https://github.com/okp4/okp4d
ports:
rest: 1317
rpc: 26657
faucet: 8007
resources:
cpu: "0.2"
memory: "200M"
- name: gaia-1
type: cosmos
numValidators: 1
ports:
rest: 1313
rpc: 26653
faucet: 8003
resources:
cpu: "0.2"
memory: "200M"

relayers:
- name: okp4-gaia
type: hermes
replicas: 1
chains:
- okp4-1
- gaia-1
resources:
cpu: "0.1"
memory: "100M"

registry:
enabled: true
ports:
rest: 8081
resources:
cpu: "0.1"
memory: "100M"

exposer:
resources:
cpu: "0.1"
memory: "100M"

faucet:
resources:
cpu: "0.1"
memory: "100M"
51 changes: 51 additions & 0 deletions starship/configs/devnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
chains:
- name: okp4-1
type: custom
numValidators: 4
image: anmol1696/okp4d:latest
home: /root/.okp4d
binary: okp4d
prefix: okp4
denom: uknow
coins: 100000000000000uknow
hdPath: m/44'/118'/0'/0/0
coinType: 118
repo: https://github.com/okp4/okp4d
ports:
rest: 1317
rpc: 26657
faucet: 8007
resources:
cpu: 1
memory: 2Gi
- name: gaia-1
type: cosmos
numValidators: 4
ports:
rest: 1313
rpc: 26653
faucet: 8003
resources:
cpu: 1
memory: 2Gi

relayers:
- name: okp4-gaia
type: hermes
replicas: 1
chains:
- okp4-1
- gaia-1
resources:
cpu: 1
memory: 2Gi

registry:
enabled: true
ports:
rest: 8081

explorers:
enabled: true
ports:
rest: 8080
Loading
Loading