Skip to content

Commit

Permalink
feat: improve rosetta-ci test (#71)
Browse files Browse the repository at this point in the history
* added makefile step for test-rosetta-ci

* downsized github workflow

* Update Makefile

Co-authored-by: Ezequiel Raynaudo <[email protected]>

* fixed makefile message

* debugging workflow

* debug

* debug

* debug

* merge with main

* removed merge typo

* added checkout to cosmos-sdk versioning

* fix makefile typo

---------

Co-authored-by: Ezequiel Raynaudo <[email protected]>
  • Loading branch information
bizk and raynaudoe authored Jan 18, 2024
1 parent f514fd1 commit 47afcef
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 106 deletions.
2 changes: 0 additions & 2 deletions .github/issue_labeler.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/pr_labeler.yml

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ jobs:
**/go.sum
**/Makefile
Makefile
###################
#### Build App ####
###################
- name: Build
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} make build
Expand All @@ -48,4 +45,4 @@ jobs:
###################
- name: Build Rosetta
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} make rosetta
run: GOARCH=${{ matrix.go-arch }} make build
18 changes: 0 additions & 18 deletions .github/workflows/pr_labeler.yml

This file was deleted.

39 changes: 3 additions & 36 deletions .github/workflows/rosetta-cli-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,8 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '^1.21.1'
- name: Get cosmos-sdk repo
uses: actions/checkout@v4
with:
repository: cosmos/cosmos-sdk
ref: main
path: './cosmos-sdk'
- name: set up simapp
run:
cd cosmos-sdk &&
make build &&
export SIMD_BIN=./build/simd &&
make init-simapp
- name: Run simapp
run: ./cosmos-sdk/build/simd start &
- name: Wait for simd to boot up for 2 mins and produce blocks
run: sleep 120s
shell: bash
- name: Check blockchain status
run: curl localhost:26657/status
- name: Build Rosetta
run: go mod tidy && make rosetta && make plugin
- name: Run Rosetta service
run: ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" &
- name: Wait for rosetta boot up for 30 secs
run: sleep 30s
shell: bash
- name: Check rosetta status
run: curl localhost:8080/block
- name: Generate wallets and transactions
run:
export SIMD_BIN=./cosmos-sdk/build/simd &&
chmod +x ./tests/rosetta-cli/data.sh &&
./tests/rosetta-cli/data.sh
shell: bash
- name: Test rosetta through Rosetta-cli
- name: Run make test-rosetta-ci
run:
make rosetta-cli
COSMOS_SDK_VERSION=v0.50.3
make test-rosetta-ci
shell: bash
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ jobs:
- name: tests
if: env.GIT_DIFF
run: |
make plugin && make test
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic ./...
make plugin && make test
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
#!/usr/bin/make -f

all: build
all: build plugin

build:
cd plugins/cosmos-hub && make plugin
go build -mod=readonly ./cmd/rosetta

rosetta:
go build -mod=readonly ./cmd/rosetta

plugin:
cd plugins/cosmos-hub && make plugin

docker:
docker build . --tag rosetta

test:
go test -mod=readonly ./...
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic ./...

test-rosetta-ci:
sh ./scripts/simapp-start-node.sh
make build && make plugin
./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" &
sleep 30
export SIMD_BIN=./cosmos-sdk/build/simd && sh ./tests/rosetta-cli/rosetta-cli-test.sh

###############################################################################
### Linting ###
Expand All @@ -31,9 +37,3 @@ lint-fix:
@./scripts/go-lint-all.bash --fix

.PHONY: all build rosetta test lint lint-fix

docker:
docker build . --tag rosetta

rosetta-cli:
./tests/rosetta-cli/rosetta-cli-test.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Install Rosetta standalone server with the following command:
go install github.com/cosmos/rosetta
```

Alternatively, for building from source, simply run `make rosetta`. The binary will be located in the root folder.
Alternatively, for building from source, simply run `make build`. The binary will be located in the root folder.

### Native - As a node command

Expand Down
12 changes: 12 additions & 0 deletions scripts/simapp-start-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
git clone https://github.com/cosmos/cosmos-sdk.git
# shellcheck disable=SC2164
cd cosmos-sdk
git checkout "$COSMOS_SDK_VERSION"
make build
export SIMD_BIN=./build/simd
chmod 777 ./scripts/init-simapp.sh
sh ./scripts/init-simapp.sh --just-print
$SIMD_BIN start &
until curl --output /dev/null --silent --head --fail http://localhost:26657/health; do
sleep 1
done
29 changes: 0 additions & 29 deletions tests/rosetta-cli/data.sh

This file was deleted.

0 comments on commit 47afcef

Please sign in to comment.