diff --git a/.travis.yml b/.travis.yml index 5b26c35..6459d01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ script: - export ETH_PORT=18545; npm run test:cover - npm run build - npm run doc - - ./scripts/wait_for_migration_and_extract_keeper_artifacts.sh + - ./scripts/keeper.sh - npm run integration:cover - npm run report-coverage diff --git a/README.md b/README.md index ac8c858..dfdce9c 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,17 @@ --- -- [Get started](#Get-started) - - [Examples](#Examples) -- [Documentation](#Documentation) -- [Development](#Development) -- [Testing](#Testing) - - [Unit Tests](#Unit-Tests) - - [Integration Tests](#Integration-Tests) -- [Code Style](#Code-Style) -- [Production build](#Production-build) -- [Releases](#Releases) -- [License](#License) +- [Get started](#get-started) + - [Examples](#examples) +- [Documentation](#documentation) +- [Development](#development) +- [Testing](#testing) + - [Unit Tests](#unit-tests) + - [Integration Tests](#integration-tests) +- [Code Style](#code-style) +- [Production build](#production-build) +- [Releases](#releases) +- [License](#license) --- @@ -142,7 +142,7 @@ In another terminal window, run this script and export the seed phrase: ```bash # copies the contract artifacts once the local Ocean network is up and running -./scripts/wait_for_migration_and_extract_keeper_artifacts.sh +./scripts/keeper.sh # export Spree accounts seed phrase export SEED_WORDS="taxi music thumb unique chat sand crew more leg another off lamp" @@ -215,3 +215,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +``` diff --git a/scripts/keeper.sh b/scripts/keeper.sh new file mode 100755 index 0000000..779af73 --- /dev/null +++ b/scripts/keeper.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Wait for contracts migration and extract Keeper artifacts + +RETRY_COUNT=0 +COMMAND_STATUS=1 + +printf '\n\e[33m◯ Waiting for contracts to be generated...\e[0m\n' + +mkdir -p artifacts + +until [ $COMMAND_STATUS -eq 0 ] || [ $RETRY_COUNT -eq 120 ]; do + keeper_contracts_docker_id=$(docker container ls | grep keeper-contracts | awk '{print $1}') + docker cp "${keeper_contracts_docker_id}":/keeper-contracts/artifacts/ready ./artifacts/ > /dev/null 2>&1 + COMMAND_STATUS=$? + sleep 5 + (( RETRY_COUNT=RETRY_COUNT+1 )) +done + +printf '\e[32m✔ Found new contract artifacts.\e[0m\n' + +rm -rf ./artifacts/ + +if [ $COMMAND_STATUS -ne 0 ]; then + echo "Waited for more than two minutes, but keeper contracts have not been migrated yet. Did you run an Ethereum RPC client and the migration script?" + exit 1 +fi + +docker cp "${keeper_contracts_docker_id}":/keeper-contracts/artifacts/. ./node_modules/@oceanprotocol/keeper-contracts/artifacts/ + +printf '\e[32m✔ Copied new contract artifacts.\e[0m\n' diff --git a/scripts/wait_for_migration_and_extract_keeper_artifacts.sh b/scripts/wait_for_migration_and_extract_keeper_artifacts.sh deleted file mode 100755 index 7afaec9..0000000 --- a/scripts/wait_for_migration_and_extract_keeper_artifacts.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -RETRY_COUNT=0 -COMMAND_STATUS=1 - -mkdir -p artifacts - -until [ $COMMAND_STATUS -eq 0 ] || [ $RETRY_COUNT -eq 120 ]; do - keeper_contracts_docker_id=$(docker container ls | grep keeper-contracts | awk '{print $1}') - docker cp ${keeper_contracts_docker_id}:/keeper-contracts/artifacts/ready ./artifacts/ - COMMAND_STATUS=$? - sleep 5 - let RETRY_COUNT=RETRY_COUNT+1 -done - -rm -rf ./artifacts/ - -if [ $COMMAND_STATUS -ne 0 ]; then - echo "Waited for more than two minutes, but keeper contracts have not been migrated yet. Did you run an Ethereum RPC client and the migration script?" - exit 1 -fi - -docker cp ${keeper_contracts_docker_id}:/keeper-contracts/artifacts/. ./node_modules/@oceanprotocol/keeper-contracts/artifacts/