diff --git a/.circleci/config.yml b/.circleci/config.yml index b778653ead25..3be6151e96dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -165,6 +165,29 @@ jobs: name: upload command: bash <(curl -s https://codecov.io/bash) -f coverage.txt + localnet: + working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/cosmos-sdk + machine: + image: circleci/classic:latest + environment: + GOBIN: /home/circleci/.go_workspace/bin + GOPATH: /home/circleci/.go_workspace/ + GOOS: linux + GOARCH: amd64 + parallelism: 1 + steps: + - checkout + - run: + name: run localnet and exit on failure + command: | + set -x + make get_tools + make get_vendor_deps + make build-linux + make localnet-start + ./scripts/localnet-blocks-test.sh 40 5 10 localhost + + workflows: version: 2 test-suite: @@ -185,6 +208,9 @@ workflows: - test_cover: requires: - setup_dependencies + - localnet: + requires: + - setup_dependencies - upload_coverage: requires: - test_cover diff --git a/CHANGELOG.md b/CHANGELOG.md index b4de50494b0d..55104830b18a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ IMPROVEMENTS - [x/gov] Initial governance parameters can now be set in the genesis file - [x/stake] \#1815 Sped up the processing of `EditValidator` txs. - [config] \#1930 Transactions indexer indexes all tags by default. + - [ci] [#2057](https://github.com/cosmos/cosmos-sdk/pull/2057) Run `make localnet-start` on every commit and ensure network reaches at least 10 blocks * SDK - [baseapp] \#1587 Allow any alphanumeric character in route diff --git a/Makefile b/Makefile index d06d4eb4c8a4..655d8574e628 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ci: get_tools get_vendor_deps install test_cover test_lint test ######################################## ### Build/Install -check-ledger: +check-ledger: ifeq ($(LEDGER_ENABLED),true) ifndef GCC $(error "gcc not installed for ledger support, please install") @@ -193,7 +193,7 @@ build-docker-gaiadnode: # Run a 4-node testnet locally localnet-start: localnet-stop @if ! [ -f build/node0/gaiad/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/gaiad:Z tendermint/gaiadnode testnet --v 4 --o . --starting-ip-address 192.168.10.2 ; fi - docker-compose up + docker-compose up -d # Stop testnet localnet-stop: diff --git a/PENDING.md b/PENDING.md index 9f0b86a994eb..9ade31c8b3fc 100644 --- a/PENDING.md +++ b/PENDING.md @@ -8,10 +8,10 @@ BREAKING CHANGES * Gaia * Make the transient store key use a distinct store key. [#2013](https://github.com/cosmos/cosmos-sdk/pull/2013) - -* SDK -* Tendermint +* SDK + +* Tendermint FEATURES @@ -22,9 +22,9 @@ FEATURES * Gaia -* SDK +* SDK -* Tendermint +* Tendermint IMPROVEMENTS @@ -35,9 +35,9 @@ IMPROVEMENTS * Gaia -* SDK +* SDK -* Tendermint +* Tendermint BUG FIXES @@ -48,7 +48,6 @@ BUG FIXES * Gaia -* SDK - -* Tendermint +* SDK +* Tendermint diff --git a/scripts/localnet-blocks-test.sh b/scripts/localnet-blocks-test.sh new file mode 100755 index 000000000000..53df090ff749 --- /dev/null +++ b/scripts/localnet-blocks-test.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +CNT=0 +ITER=$1 +SLEEP=$2 +NUMBLOCKS=$3 +NODEADDR=$4 + +if [ -z "$1" ]; then + echo "Need to input number of iterations to run..." + exit 1 +fi + +if [ -z "$2" ]; then + echo "Need to input number of seconds to sleep between iterations" + exit 1 +fi + +if [ -z "$3" ]; then + echo "Need to input block height to declare completion..." + exit 1 +fi + +if [ -z "$4" ]; then + echo "Need to input node address to poll..." + exit 1 +fi + +while [ ${CNT} -lt $ITER ]; do + var=$(curl -s $NODEADDR:26657/status | jq -r '.result.sync_info.latest_block_height') + echo "Number of Blocks: ${var}" + if [ ! -z ${var} ] && [ ${var} -gt ${NUMBLOCKS} ]; then + echo "Number of blocks reached, exiting success..." + exit 0 + fi + let CNT=CNT+1 + sleep $SLEEP +done + +echo "Timeout reached, exiting failure..." +exit 1