diff --git a/.circleci/config.yml b/.circleci/config.yml index 98d5fa80..164a818e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,7 @@ workflows: - build - lint - faucet_docker + - test jobs: build: @@ -38,6 +39,9 @@ jobs: - run: name: Version information 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: name: Restore Yarn Package Cache keys: @@ -50,13 +54,8 @@ jobs: key: yarn-packages-{{ checksum "yarn.lock" }} paths: - ~/.cache/yarn - - run: - command: docker pull cosmwasm/wasmd:latest - - run: - command: ./projects/scripts/cosm/start.sh - background: true - - run: - command: sleep 15 + - run: # wait until cosm scripts have fully started + command: timeout 15 bash -c "until curl -s http://localhost:1317/node_info > /dev/null; do sleep 1; done - run: environment: COSMOS_ENABLED=1 command: yarn test diff --git a/scripts/cosm/start.sh b/scripts/cosm/start.sh index 98f04ff8..c9224905 100755 --- a/scripts/cosm/start.sh +++ b/scripts/cosm/start.sh @@ -15,6 +15,10 @@ echo "Using temporary dir $TMP_DIR" WASMD_LOGFILE="$TMP_DIR/wasmd.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 docker volume rm -f wasmd_data 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." \ "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." + docker kill "$CONTAINER_NAME" exit 1 fi