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

feat: improve rosetta-ci test #71

Merged
merged 15 commits into from
Jan 18, 2024
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
bizk marked this conversation as resolved.
Show resolved Hide resolved
bizk marked this conversation as resolved.
Show resolved Hide resolved
# 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.

Loading