Enable test in ci, move pull into start.sh

This commit is contained in:
Ethan Frey 2020-02-03 09:11:13 +01:00
parent 690a93ae59
commit 94a49ed899
2 changed files with 11 additions and 7 deletions

View File

@ -6,6 +6,7 @@ workflows:
- build - build
- lint - lint
- faucet_docker - faucet_docker
- test
jobs: jobs:
build: build:
@ -38,6 +39,9 @@ jobs:
- run: - run:
name: Version information name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)" command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- run: # start early for less wait time below
command: ./projects/scripts/cosm/start.sh
background: true
- restore_cache: - restore_cache:
name: Restore Yarn Package Cache name: Restore Yarn Package Cache
keys: keys:
@ -50,13 +54,8 @@ jobs:
key: yarn-packages-{{ checksum "yarn.lock" }} key: yarn-packages-{{ checksum "yarn.lock" }}
paths: paths:
- ~/.cache/yarn - ~/.cache/yarn
- run: - run: # wait until cosm scripts have fully started
command: docker pull cosmwasm/wasmd:latest command: timeout 15 bash -c "until curl -s http://localhost:1317/node_info > /dev/null; do sleep 1; done
- run:
command: ./projects/scripts/cosm/start.sh
background: true
- run:
command: sleep 15
- run: - run:
environment: COSMOS_ENABLED=1 environment: COSMOS_ENABLED=1
command: yarn test command: yarn test

View File

@ -15,6 +15,10 @@ echo "Using temporary dir $TMP_DIR"
WASMD_LOGFILE="$TMP_DIR/wasmd.log" WASMD_LOGFILE="$TMP_DIR/wasmd.log"
REST_SERVER_LOGFILE="$TMP_DIR/rest-server.log" REST_SERVER_LOGFILE="$TMP_DIR/rest-server.log"
# pull the newest copy of the docker image
# this is important as the sleep timeout below will fail on first run (downloading entire docker stack usually > 10s)
docker pull "$REPOSITORY:$VERSION"
# This starts up wasmd # This starts up wasmd
docker volume rm -f wasmd_data docker volume rm -f wasmd_data
docker run --rm \ docker run --rm \
@ -36,6 +40,7 @@ if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME")" != "true" ];
echo "Container named '$CONTAINER_NAME' not running. We cannot continue." \ echo "Container named '$CONTAINER_NAME' not running. We cannot continue." \
"This can happen when 'docker run' needs too long to download and start." \ "This can happen when 'docker run' needs too long to download and start." \
"It might be worth retrying this step once the image is in the local docker cache." "It might be worth retrying this step once the image is in the local docker cache."
docker kill "$CONTAINER_NAME"
exit 1 exit 1
fi fi