From 57edf160bc650006cfe603be5c29a2d4fa686902 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Thu, 1 Feb 2024 11:44:23 +0000 Subject: [PATCH] ticket-44 Added support for geth unavailable situations testing --- .github/workflows/comprehensive.yml | 322 ++++++-------------- .github/workflows/container-test.yml | 330 ++++++++------------- .github/workflows/main.yml | 232 ++------------- .github/workflows/network-browser-test.yml | 2 +- .github/workflows/publish.yml | 34 +-- Dockerfile | 1 + src/package.json | 2 +- 7 files changed, 249 insertions(+), 674 deletions(-) diff --git a/.github/workflows/comprehensive.yml b/.github/workflows/comprehensive.yml index 04fb5259..c8573d90 100644 --- a/.github/workflows/comprehensive.yml +++ b/.github/workflows/comprehensive.yml @@ -5,98 +5,23 @@ on: push: branches-ignore: - 'docs-v*' - pull_request: - branches-ignore: - - 'docs-v*' jobs: - cancel-runs: - name: Cancel Previous Runs - runs-on: ubuntu-latest - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} test-comprehensive: - runs-on: ubuntu-latest - steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v2 with: submodules: recursive - uses: oven-sh/setup-bun@v1 - - name: INFO - github environment variable checks - run: | - echo ------------ GIT_CURRENT_BRANCH - export GIT_CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - echo $GIT_CURRENT_BRANCH - echo ------------ GIT_SYMBOLIC_BRANCH - export GIT_SYMBOLIC_BRANCH=$(git symbolic-ref --short HEAD) - echo $GIT_SYMBOLIC_BRANCH - echo ------------ GITHUB_WORKFLOW - echo $GITHUB_WORKFLOW - echo ------------ GITHUB_RUN_ID - echo $GITHUB_RUN_ID - echo ------------ GITHUB_RUN_NUMBER - echo $GITHUB_RUN_NUMBER - echo ------------ GITHUB_ACTION - echo $GITHUB_ACTION - echo ------------ GITHUB_ACTIONS - echo $GITHUB_ACTIONS - echo ------------ GITHUB_ACTOR - echo $GITHUB_ACTOR - echo ------------ GITHUB_REPOSITORY - echo $GITHUB_REPOSITORY - echo ------------ GITHUB_EVENT_NAME - echo $GITHUB_EVENT_NAME - echo ------------ GITHUB_EVENT_PATH - echo $GITHUB_EVENT_PATH - echo ------------ GITHUB_WORKSPACE - echo $GITHUB_WORKSPACE - echo ------------ GITHUB_SHA - echo $GITHUB_SHA - echo ------------ GITHUB_REF - echo $GITHUB_REF - echo ------------ GITHUB_HEAD_REF - echo $GITHUB_HEAD_REF - echo ------------ GITHUB_BASE_REF - echo $GITHUB_BASE_REF - - - name: INFO - user information checks - run: | - echo ------------ user - echo $USER - echo ------------ home - echo $HOME - echo ------------ path - echo $PATH - - - name: INFO - system information checks - run: | - echo ------------ pwd - pwd - echo ------------ unix name - a - uname -a || true - echo ------------ unix name - r - uname -r || true - echo ------------ lsb_release - cat - cat /etc/lsb-release - echo ------------ lsb_release - a - lsb_release -a || true - echo ------------ hostnamectl - hostnamectl || true - echo ------------ /etc/os-release - cat /etc/os-release || true - echo ------------ /proc/version - cat /proc/version || true - echo ------------ lscpu - lscpu || true - - name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps, curl run: | sudo apt-get update @@ -142,35 +67,15 @@ jobs: sudo rm -rf /usr/local/bin/node* || true &> /dev/null - name: INIT - install Node JS - run: | - curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - - sudo apt-get install -y nodejs - sudo ln -s /usr/bin/node /usr/local/bin/node || true - - - name: INIT - install Node utilities - run: | - sudo npm install --global npm - sudo npm install --global color-support - sudo npm install --global yarn - sudo npm install --global node-gyp + uses: actions/setup-node@v4 + with: + node-version: 18 - - name: INIT - version checks of Node JS and its utilities - run: | - which node - node --version - which npx - npx --version - which npm - npm --version - which yarn - yarn --version - which node-gyp - node-gyp --version - - - name: INIT - version checks of Bun SH + - name: INIT - install Node utilities run: | - which bun - bun --version + npm install --global npx || true + npm install --global yarn + npm install --global node-gyp - name: INIT - Download comprehensive-test working-directory: ${{env.working-directory}} @@ -185,17 +90,16 @@ jobs: cd comprehensive-test pwd cd cli-hh - ./clean.sh + export PATH=$PATH:$(dirname $(which npx)) + yarn install + ./clean.sh || true ./init.sh - cd ../.. - name: INIT - startup Ethereum Main Net emulation working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd cli-hh + cd comprehensive-test/cli-hh ./run.sh &> ../local_mainnet_output_log.txt & - cd ../.. - name: INIT - Install PYTHON uses: actions/setup-python@v2 @@ -217,25 +121,12 @@ jobs: run: | cd comprehensive-test/test_tokens yarn install - cd ../.. - name: INIT - initialize S-Chain configuration creator working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd s_chain_gen + cd comprehensive-test/s_chain_gen yarn install - cd .. - cd .. - - - name: INIT - initialize S-Chain configuration creator - working-directory: ${{env.working-directory}} - run: | - cd comprehensive-test - cd s_chain_gen - yarn install - cd .. - cd .. - name: INIT - check skaled can run working-directory: ${{env.working-directory}} @@ -245,58 +136,31 @@ jobs: export TRYING_SKALED_AT_PATH=./app_cache/bin_$DETECTED_UBUNTU_VERSION/skaled $TRYING_SKALED_AT_PATH --colors --version $TRYING_SKALED_AT_PATH --help - cd .. - name: INIT - generate configuration files for S-Chain nodes working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd s_chain_gen + export PATH=$PATH:$(dirname $(which npx)) + cd comprehensive-test/s_chain_gen ./init.sh - cd ../.. - name: INIT - download Skale Manager working-directory: ${{env.working-directory}} run: | cd comprehensive-test git clone https://github.com/skalenetwork/skale-manager.git --recursive - cd .. - name: INIT - install Skale Manager dependencies working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd skale-manager + cd comprehensive-test/skale-manager yarn install - cd ../.. - name: INIT - install comprehensive engine dependencies working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd engine + cd comprehensive-test/engine yarn install - cd ../.. - - - name: SELF-TEST A - use IMA to browse S-Chain via node 00-00 and test last is alive - working-directory: ${{env.working-directory}} - run: | - node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.1:2164 || true - - - name: SELF-TEST B - use IMA to browse S-Chain via node 00-01 and test last is alive - working-directory: ${{env.working-directory}} - run: | - node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.2:2264 || true - - - name: SELF-TEST C - use IMA to browse S-Chain via node 01-00 and test last is alive - working-directory: ${{env.working-directory}} - run: | - node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.3:2364 || true - - - name: SELF-TEST D - use IMA to browse S-Chain via node 01-01 and test last is alive - working-directory: ${{env.working-directory}} - run: | - node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.4:2464 || true - name: INIT - download SGX Wallet working-directory: ${{env.working-directory}} @@ -309,54 +173,21 @@ jobs: git pull git branch git status - cd .. - cd .. - name: INIT - update docker image SGX Wallet in the emulation mode working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd sgxwallet/run_sgx_sim + cd comprehensive-test/sgxwallet/run_sgx_sim rm -rf ../../local_sgxwallet_output_log.txt &> /dev/null - echo " --------------------------- stopping sgx wallet ------------------------------------------------------------------------------------------------------ " docker-compose down - echo " --------------------------- fixing sgx wallets docker config ----------------------------------------------------------------------------------------- " - mv docker-compose.yml docker-compose.yml.old-previous || true - echo "version: '3'" > docker-compose.yml - echo 'services:' >> docker-compose.yml - echo ' sgxwallet:' >> docker-compose.yml - echo ' image: skalenetwork/sgxwallet_sim:1.83.0-develop.19' >> docker-compose.yml - echo ' restart: unless-stopped' >> docker-compose.yml - echo ' ports:' >> docker-compose.yml - echo ' - "1026:1026"' >> docker-compose.yml - echo ' - "1027:1027"' >> docker-compose.yml - echo ' - "1028:1028"' >> docker-compose.yml - echo ' - "1029:1029"' >> docker-compose.yml - echo ' - "1030:1030"' >> docker-compose.yml - echo ' - "1031:1031"' >> docker-compose.yml - echo ' volumes:' >> docker-compose.yml - echo ' - ./sgx_data:/usr/src/sdk/sgx_data' >> docker-compose.yml - echo ' - /dev/urandom:/dev/random' >> docker-compose.yml - echo ' logging:' >> docker-compose.yml - echo ' driver: json-file' >> docker-compose.yml - echo ' options:' >> docker-compose.yml - echo ' max-size: "10m"' >> docker-compose.yml - echo ' max-file: "4"' >> docker-compose.yml - echo ' command: -s -y -V -d' >> docker-compose.yml - echo " --------------------------- pulling sgx wallet ------------------------------------------------------------------------------------------------------- " docker-compose pull - cd ../.. - cd .. - name: INIT - start SGX Wallet working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd sgxwallet/run_sgx_sim + cd comprehensive-test/sgxwallet/run_sgx_sim docker-compose up &> ../../local_sgxwallet_output_log.txt & sleep 90 - cd ../.. - cd .. - name: INIT - check SGX Wallet has listening ports working-directory: ${{env.working-directory}} @@ -370,74 +201,93 @@ jobs: sudo netstat -tulpn | grep 1027 echo "...Done" - - name: INIT - download transaction manager + - name: INIT - prepare ulimit working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - rm -rf transaction-manager || true - git clone https://github.com/skalenetwork/transaction-manager --recursive - cd .. + ulimit -n 65535 > /dev/null + echo "ulimit is now set to" $(ulimit -n) - - name: INIT - start transaction manager and redis + - name: RUN - create certificates working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd transaction-manager - export SGX_SERVER_URL=http://127.0.0.1:1027 - export ENDPOINT=http://127.0.0.1:8545 - export ETH_PRIVATE_KEY=23ABDBD3C61B5330AF61EBE8BEF582F4E5CC08E554053A718BDCE7813B9DC1FC - ./scripts/run-test-containers.sh - cd .. - echo "------------------------------------------------------------------------------------" - docker ps - echo "------------------------------------------------------------------------------------" - export TM_CONTAINER_ID=$(docker ps | grep transaction-manager | awk '{print $1;}') - echo "Transaction manager docker container ID:" $TM_CONTAINER_ID - docker logs $TM_CONTAINER_ID -f &> engine/tm.log & - echo "------------------------------------------------------------------------------------" - export REDIS_CONTAINER_ID=$(docker ps | grep redis | awk '{print $1;}') - echo "Redis container ID:" $REDIS_CONTAINER_ID - docker logs $REDIS_CONTAINER_ID -f &> engine/redis.log & - cd .. + cd comprehensive-test/engine/create_pems + ./create_pems.sh - - name: INIT - prepare ulimit + - name: RUN - full test - everything up and running working-directory: ${{env.working-directory}} run: | - ulimit -n 65535 > /dev/null - echo "ulimit is now set to" $(ulimit -n) + export IMA_AGENT_ROOT_DIR=$(pwd) + echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR + cd comprehensive-test/engine + export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=0 + export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=0 + export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=0 + node ./index.js - - name: RUN - create certificates + - name: RUN - full test - one SKALED is down working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd engine/create_pems - ./create_pems.sh - cd ../.. - cd .. + export IMA_AGENT_ROOT_DIR=$(pwd) + echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR + cd comprehensive-test/engine + export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=0 + export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=1 + export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=0 + node ./index.js - - name: RUN - main engine steps + - name: RUN - full test - one IMA Agent is down working-directory: ${{env.working-directory}} run: | export IMA_AGENT_ROOT_DIR=$(pwd) echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR cd comprehensive-test/engine export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=0 export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=0 + export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=1 node ./index.js - cd ../.. - - name: SHUTDOWN - stop SGX Wallet + - name: RUN - full test - one SKALED and one IMA Agent are down + working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd sgxwallet/run_sgx_sim - docker-compose down - cd ../.. - cd .. + export IMA_AGENT_ROOT_DIR=$(pwd) + echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR + cd comprehensive-test/engine + export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=0 + export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=1 + export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=1 + node ./index.js - - name: SHUTDOWN - stop transaction manager and redis + - name: RUN - full test - Main Net connectivity problems testing + working-directory: ${{env.working-directory}} run: | - docker stop $TM_CONTAINER_ID $REDIS_CONTAINER_ID || true - docker rm $TM_CONTAINER_ID $REDIS_CONTAINER_ID || true + export IMA_AGENT_ROOT_DIR=$(pwd) + echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR + cd comprehensive-test/engine + export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=0 + export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export ENABLED_IMA_MAIN_NET_TUNNELLING=true + export ENABLED_IMA_MAIN_NET_CONNECTION_PROBLEMS=true + node ./index.js + + - name: SHUTDOWN - stop SGX Wallet + working-directory: ${{env.working-directory}} + run: | + cd comprehensive-test/sgxwallet/run_sgx_sim + docker-compose down - name: SHUTDOWN - zombie cleanup, if any run: | diff --git a/.github/workflows/container-test.yml b/.github/workflows/container-test.yml index 9d94445b..d6adae28 100644 --- a/.github/workflows/container-test.yml +++ b/.github/workflows/container-test.yml @@ -5,25 +5,17 @@ on: push: branches-ignore: - 'docs-v*' - pull_request: - branches-ignore: - - 'docs-v*' jobs: - cancel-runs: - name: Cancel Previous Runs - runs-on: ubuntu-latest - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} test-comprehensive: - runs-on: self-hosted - steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + - uses: oven-sh/setup-bun@v1 - name: INIT - force pre-clean @@ -47,73 +39,6 @@ jobs: - uses: oven-sh/setup-bun@v1 - - name: INFO - github environment variable checks - run: | - echo ------------ GIT_CURRENT_BRANCH - export GIT_CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - echo $GIT_CURRENT_BRANCH - echo ------------ GIT_SYMBOLIC_BRANCH - export GIT_SYMBOLIC_BRANCH=$(git symbolic-ref --short HEAD) - echo $GIT_SYMBOLIC_BRANCH - echo ------------ GITHUB_WORKFLOW - echo $GITHUB_WORKFLOW - echo ------------ GITHUB_RUN_ID - echo $GITHUB_RUN_ID - echo ------------ GITHUB_RUN_NUMBER - echo $GITHUB_RUN_NUMBER - echo ------------ GITHUB_ACTION - echo $GITHUB_ACTION - echo ------------ GITHUB_ACTIONS - echo $GITHUB_ACTIONS - echo ------------ GITHUB_ACTOR - echo $GITHUB_ACTOR - echo ------------ GITHUB_REPOSITORY - echo $GITHUB_REPOSITORY - echo ------------ GITHUB_EVENT_NAME - echo $GITHUB_EVENT_NAME - echo ------------ GITHUB_EVENT_PATH - echo $GITHUB_EVENT_PATH - echo ------------ GITHUB_WORKSPACE - echo $GITHUB_WORKSPACE - echo ------------ GITHUB_SHA - echo $GITHUB_SHA - echo ------------ GITHUB_REF - echo $GITHUB_REF - echo ------------ GITHUB_HEAD_REF - echo $GITHUB_HEAD_REF - echo ------------ GITHUB_BASE_REF - echo $GITHUB_BASE_REF - - - name: INFO - user information checks - run: | - echo ------------ user - echo $USER - echo ------------ home - echo $HOME - echo ------------ path - echo $PATH - - - name: INFO - system information checks - run: | - echo ------------ pwd - pwd - echo ------------ unix name - a - uname -a || true - echo ------------ unix name - r - uname -r || true - echo ------------ lsb_release - cat - cat /etc/lsb-release - echo ------------ lsb_release - a - lsb_release -a || true - echo ------------ hostnamectl - hostnamectl || true - echo ------------ /etc/os-release - cat /etc/os-release || true - echo ------------ /proc/version - cat /proc/version || true - echo ------------ lscpu - lscpu || true - - name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps, curl, jq run: | sudo apt-get update @@ -145,35 +70,15 @@ jobs: sudo rm -rf /usr/local/bin/node* || true &> /dev/null - name: INIT - install Node JS - run: | - curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - - sudo apt-get install -y nodejs - sudo ln -s /usr/bin/node /usr/local/bin/node || true - - - name: INIT - install Node utilities - run: | - sudo npm install --global npm - sudo npm install --global color-support - sudo npm install --global yarn - sudo npm install --global node-gyp - - - name: INIT - version checks of Node JS and its utilities - run: | - which node - node --version - which npx - npx --version - which npm - npm --version - which yarn - yarn --version - which node-gyp - node-gyp --version + uses: actions/setup-node@v4 + with: + node-version: 18 - - name: INIT - version checks of Bun SH + - name: INIT - install Node utilities run: | - which bun - bun --version + npm install --global npx || true + npm install --global yarn + npm install --global node-gyp - name: INIT - Download comprehensive-test working-directory: ${{env.working-directory}} @@ -188,18 +93,16 @@ jobs: run: | cd comprehensive-test pwd + export PATH=$PATH:$(dirname $(which npx)) cd cli-hh ./clean.sh ./init.sh - cd ../.. - name: INIT - startup Ethereum Main Net emulation working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd cli-hh + cd comprehensive-test/cli-hh ./run.sh &> ../local_mainnet_output_log.txt & - cd ../.. - name: INIT - Install PYTHON uses: actions/setup-python@v2 @@ -226,25 +129,18 @@ jobs: run: | cd comprehensive-test/test_tokens yarn install - cd ../.. - name: INIT - initialize S-Chain configuration creator working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd s_chain_gen + cd comprehensive-test/s_chain_gen yarn install - cd .. - cd .. - name: INIT - initialize S-Chain configuration creator working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd s_chain_gen + cd comprehensive-test/s_chain_gen yarn install - cd .. - cd .. - name: INIT - check skaled can run working-directory: ${{env.working-directory}} @@ -254,15 +150,15 @@ jobs: export TRYING_SKALED_AT_PATH=./app_cache/bin_$DETECTED_UBUNTU_VERSION/skaled $TRYING_SKALED_AT_PATH --colors --version $TRYING_SKALED_AT_PATH --help - cd .. - name: INIT - generate configuration files for S-Chain nodes working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd s_chain_gen + export PATH=$PATH:$(dirname $(which npx)) + cd comprehensive-test/s_chain_gen + yarn install + ./clean.sh || true ./init.sh - cd ../.. - name: INIT - download Skale Manager working-directory: ${{env.working-directory}} @@ -270,43 +166,18 @@ jobs: cd comprehensive-test sudo rm -rf ./skale-manager || true git clone https://github.com/skalenetwork/skale-manager.git --recursive - cd .. - name: INIT - install Skale Manager dependencies working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd skale-manager + cd comprehensive-test/skale-manager yarn install - cd ../.. - name: INIT - install comprehensive engine dependencies working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd engine + cd comprehensive-test/engine yarn install - cd ../.. - - - name: SELF-TEST A - use IMA to browse S-Chain via node 00-00 and test last is alive - working-directory: ${{env.working-directory}} - run: | - node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.1:2164 || true - - - name: SELF-TEST B - use IMA to browse S-Chain via node 00-01 and test last is alive - working-directory: ${{env.working-directory}} - run: | - node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.2:2264 || true - - - name: SELF-TEST C - use IMA to browse S-Chain via node 01-00 and test last is alive - working-directory: ${{env.working-directory}} - run: | - node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.3:2364 || true - - - name: SELF-TEST D - use IMA to browse S-Chain via node 01-01 and test last is alive - working-directory: ${{env.working-directory}} - run: | - node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.4:2464 || true - name: INIT - build IMA docker container working-directory: ${{env.working-directory}} @@ -338,55 +209,21 @@ jobs: git pull git branch git status - cd .. - cd .. - name: INIT - update docker image SGX Wallet in the emulation mode working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd sgxwallet/run_sgx_sim + cd comprehensive-test/sgxwallet/run_sgx_sim rm -rf ../../local_sgxwallet_output_log.txt &> /dev/null - echo " --------------------------- stopping sgx wallet ------------------------------------------------------------------------------------------------------ " docker-compose down - echo " --------------------------- fixing sgx wallets docker config ----------------------------------------------------------------------------------------- " - mv docker-compose.yml docker-compose.yml.old-previous || true - echo "version: '3'" > docker-compose.yml - echo 'services:' >> docker-compose.yml - echo ' sgxwallet:' >> docker-compose.yml - echo ' image: skalenetwork/sgxwallet_sim:1.9.0-develop.11' >> docker-compose.yml - echo ' restart: unless-stopped' >> docker-compose.yml - echo ' network_mode: "host"' >> docker-compose.yml - # echo ' ports:' >> docker-compose.yml - # echo ' - "1026:1026"' >> docker-compose.yml - # echo ' - "1027:1027"' >> docker-compose.yml - # echo ' - "1028:1028"' >> docker-compose.yml - # echo ' - "1029:1029"' >> docker-compose.yml - # echo ' - "1030:1030"' >> docker-compose.yml - # echo ' - "1031:1031"' >> docker-compose.yml - echo ' volumes:' >> docker-compose.yml - echo ' - ./sgx_data:/usr/src/sdk/sgx_data' >> docker-compose.yml - echo ' - /dev/urandom:/dev/random' >> docker-compose.yml - echo ' logging:' >> docker-compose.yml - echo ' driver: json-file' >> docker-compose.yml - echo ' options:' >> docker-compose.yml - echo ' max-size: "10m"' >> docker-compose.yml - echo ' max-file: "4"' >> docker-compose.yml - echo ' command: -s -y -V -d' >> docker-compose.yml - echo " --------------------------- pulling sgx wallet ------------------------------------------------------------------------------------------------------- " docker-compose pull - cd ../.. - cd .. - name: INIT - start SGX Wallet working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd sgxwallet/run_sgx_sim + cd comprehensive-test/sgxwallet/run_sgx_sim docker-compose up &> ../../local_sgxwallet_output_log.txt & sleep 90 - cd ../.. - cd .. - name: INIT - check SGX Wallet has listening ports working-directory: ${{env.working-directory}} @@ -406,13 +243,11 @@ jobs: cd comprehensive-test sudo rm -rf ./transaction-manager || true git clone https://github.com/skalenetwork/transaction-manager --recursive - cd .. - name: INIT - start transaction manager and redis working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd transaction-manager + cd comprehensive-test/transaction-manager export SGX_SERVER_URL=http://127.0.0.1:1027 export ENDPOINT=http://127.0.0.1:8545 #export ETH_PRIVATE_KEY=23ABDBD3C61B5330AF61EBE8BEF582F4E5CC08E554053A718BDCE7813B9DC1FC @@ -429,7 +264,6 @@ jobs: export REDIS_CONTAINER_ID=$(docker ps | grep redis | awk '{print $1;}') echo "Redis container ID:" $REDIS_CONTAINER_ID docker logs $REDIS_CONTAINER_ID -f &> engine/redis.log & - cd .. - name: INIT - prepare ulimit working-directory: ${{env.working-directory}} @@ -440,8 +274,7 @@ jobs: - name: RUN - create certificates working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd engine/create_pems + cd comprehensive-test/engine/create_pems sudo rm -rf ./new_certs/* || true sudo rm -rf ./k.key || true sudo rm -rf ./k.pem || true @@ -450,16 +283,87 @@ jobs: sudo rm -rf ./client.pem || true sudo rm -rf ./client.crt || true ./create_pems.sh - cd ../.. - cd .. - - name: RUN - main engine steps + - name: RUN - full test - everything up and running + working-directory: ${{env.working-directory}} + run: | + export IMA_AGENT_ROOT_DIR=$(pwd) + echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR + cd comprehensive-test/engine + export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=1 + # + export VERSION=13.13.13-test.13 + echo "Docker image(will run) version is:" $VERSION + export NAME=ima + export BRANCH=$GIT_CURRENT_BRANCH + export REPO_NAME=skalenetwork/$NAME + export IMAGE_NAME=$REPO_NAME:$VERSION + export LATEST_IMAGE_NAME=$REPO_NAME:latest + echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME + # + export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=0 + export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=0 + node ./index.js + + - name: RUN - full test - one SKALED is down + working-directory: ${{env.working-directory}} + run: | + export IMA_AGENT_ROOT_DIR=$(pwd) + echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR + cd comprehensive-test/engine + export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=1 + # + export VERSION=13.13.13-test.13 + echo "Docker image(will run) version is:" $VERSION + export NAME=ima + export BRANCH=$GIT_CURRENT_BRANCH + export REPO_NAME=skalenetwork/$NAME + export IMAGE_NAME=$REPO_NAME:$VERSION + export LATEST_IMAGE_NAME=$REPO_NAME:latest + echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME + # + export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=1 + export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=0 + node ./index.js + + - name: RUN - full test - one IMA Agent is down + working-directory: ${{env.working-directory}} + run: | + export IMA_AGENT_ROOT_DIR=$(pwd) + echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR + cd comprehensive-test/engine + export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=1 + # + export VERSION=13.13.13-test.13 + echo "Docker image(will run) version is:" $VERSION + export NAME=ima + export BRANCH=$GIT_CURRENT_BRANCH + export REPO_NAME=skalenetwork/$NAME + export IMAGE_NAME=$REPO_NAME:$VERSION + export LATEST_IMAGE_NAME=$REPO_NAME:latest + echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME + # + export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=0 + export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=1 + node ./index.js + + - name: RUN - full test - one SKALED and one IMA Agent are down working-directory: ${{env.working-directory}} run: | export IMA_AGENT_ROOT_DIR=$(pwd) echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR cd comprehensive-test/engine export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=1 # export VERSION=13.13.13-test.13 echo "Docker image(will run) version is:" $VERSION @@ -471,16 +375,40 @@ jobs: echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME # export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=1 + export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=1 + node ./index.js + + - name: RUN - full test - one SKALED and one IMA Agent are down + working-directory: ${{env.working-directory}} + run: | + export IMA_AGENT_ROOT_DIR=$(pwd) + echo IMA_AGENT_ROOT_DIR = $IMA_AGENT_ROOT_DIR + cd comprehensive-test/engine + export ALL_SKALE_TEST_CLOUD_RUN=1 + export DISABLE_S2S_TESTS=1 + # + export VERSION=13.13.13-test.13 + echo "Docker image(will run) version is:" $VERSION + export NAME=ima + export BRANCH=$GIT_CURRENT_BRANCH + export REPO_NAME=skalenetwork/$NAME + export IMAGE_NAME=$REPO_NAME:$VERSION + export LATEST_IMAGE_NAME=$REPO_NAME:latest + echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME + # + export SEPARATED_IMA_AGENT_MODE=1 + export PATH=$PATH:$(dirname $(which npx)) + export ENABLED_IMA_MAIN_NET_TUNNELLING=true + export ENABLED_IMA_MAIN_NET_CONNECTION_PROBLEMS=true node ./index.js - cd ../.. - name: SHUTDOWN - stop SGX Wallet + working-directory: ${{env.working-directory}} run: | - cd comprehensive-test - cd sgxwallet/run_sgx_sim + cd comprehensive-test/sgxwallet/run_sgx_sim docker-compose down - cd ../.. - cd .. - name: SHUTDOWN - stop transaction manager and redis run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eaca4402..2b3c2cd9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,127 +1,34 @@ -# This is a basic workflow to help you get started with Actions - name: Build and test on: push: branches-ignore: - 'docs-v*' - pull_request: - branches-ignore: - - 'docs-v*' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - test-agent: - # The type of runner that the job will run on + main: runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 with: submodules: recursive - - uses: oven-sh/setup-bun@v1 - - - name: System Version Checks - run: | - echo ------------ GIT_CURRENT_BRANCH - export GIT_CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - echo $GIT_CURRENT_BRANCH - echo ------------ GIT_SYMBOLIC_BRANCH - export GIT_SYMBOLIC_BRANCH=$(git symbolic-ref --short HEAD) - echo $GIT_SYMBOLIC_BRANCH - echo ------------ GITHUB_WORKFLOW - echo $GITHUB_WORKFLOW - echo ------------ GITHUB_RUN_ID - echo $GITHUB_RUN_ID - echo ------------ GITHUB_RUN_NUMBER - echo $GITHUB_RUN_NUMBER - echo ------------ GITHUB_ACTION - echo $GITHUB_ACTION - echo ------------ GITHUB_ACTIONS - echo $GITHUB_ACTIONS - echo ------------ GITHUB_ACTOR - echo $GITHUB_ACTOR - echo ------------ GITHUB_REPOSITORY - echo $GITHUB_REPOSITORY - echo ------------ GITHUB_EVENT_NAME - echo $GITHUB_EVENT_NAME - echo ------------ GITHUB_EVENT_PATH - echo $GITHUB_EVENT_PATH - echo ------------ GITHUB_WORKSPACE - echo $GITHUB_WORKSPACE - echo ------------ GITHUB_SHA - echo $GITHUB_SHA - echo ------------ GITHUB_REF - echo $GITHUB_REF - echo ------------ GITHUB_HEAD_REF - echo $GITHUB_HEAD_REF - echo ------------ GITHUB_BASE_REF - echo $GITHUB_BASE_REF - echo ------------ user - echo $USER - echo ------------ home - echo $HOME - echo ------------ path - echo $PATH - echo ------------ pwd - pwd - echo ------------ unix name - a - uname -a || true - echo ------------ unix name - r - uname -r || true - echo ------------ lsb - lsb_release -a || true - echo ------------ hostnamectl - hostnamectl || true - echo ------------ /etc/os-release - cat /etc/os-release || true - echo ------------ /proc/version - cat /proc/version || true - echo ------------ lscpu - lscpu || true - - - name: INIT - install needed utilities - run: | - sudo apt-get install -y jq sed - - name: INIT - install Node JS - run: | - curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - - sudo apt-get install -y nodejs - sudo ln -s /usr/bin/node /usr/local/bin/node || true - - - name: INIT - install Node utilities - run: | - sudo npm install --global npm - sudo npm install --global color-support - sudo npm install --global yarn - sudo npm install --global node-gyp - - - name: INIT - version checks of Node JS and its utilities - run: | - which node - node --version - which npx - npx --version - which npm - npm --version - which yarn - yarn --version - which node-gyp - node-gyp --version - - - name: INIT - version checks of Bun SH - run: | - which bun - bun --version + uses: actions/setup-node@v4 + with: + node-version: 18 - - name: Install ESLINT + - name: Install Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - uses: oven-sh/setup-bun@v1 + + - name: INIT - install utilities run: | - sudo npm install -g eslint + sudo apt-get install -y jq sed + npm install -g eslint eslint --version - name: Install all NPMs at root @@ -138,102 +45,6 @@ jobs: run: | yarn run lint-nb - - name: Python Version Checks - run: | - echo ------------ python version check - which python || echo "----> Looks like python was not installed, next command will fail" - python --version - echo ------------ python3 version check - which python3 || echo "----> Looks like python3 was not installed, next command will fail" - python3 --version - - - name: Install Python Prerequisites - run: | - echo ------------ py3 installs - sudo apt-get install -y python3-pip python3-setuptools python3-dev - echo ------------ py3 wheel - apt - sudo apt-get install -y python3-wheel - echo ------------ py3 wheel - pip - pip3 install wheel - # echo ------------ slither analyzer install - # #pip3 install slither-analyzer==0.8.3 - # pip3 install -r IMA/proxy/scripts/requirements.txt - # echo ------------ slither search attempt - # sudo find / -name slither || true - # echo ------------ slither location detection - after install - # export PATH=$PATH:/home/$USER/.local/bin - # which slither || echo "----> Looks like slither was not installed, next command will fail" - # echo ------------ slither version check - after install - # slither --version || true - - test-integration: - runs-on: ubuntu-latest - - env: - working-directory: ./test - - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: oven-sh/setup-bun@v1 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: INIT - install Node JS - run: | - curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - - sudo apt-get install -y nodejs - sudo ln -s /usr/bin/node /usr/local/bin/node || true - - - name: INIT - install Node utilities - run: | - sudo npm install --global npm - sudo npm install --global color-support - sudo npm install --global yarn - sudo npm install --global node-gyp - - - name: INIT - version checks of Node JS and its utilities - run: | - which node - node --version - which npx - npx --version - which npm - npm --version - which yarn - yarn --version - which node-gyp - node-gyp --version - - - name: INIT - version checks of Bun SH - run: | - which bun - bun --version - - - name: Install Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install all NPMs in src working-directory: ./src run: | @@ -262,6 +73,11 @@ jobs: echo "Content of \"accounts.json\" is:" cat ../../test/accounts.json | jq + - name: Run test (JS part) + working-directory: ./test + run: | + yarn test + - name: Prepare test (PY part) working-directory: ./test run: | @@ -280,13 +96,3 @@ jobs: export URL_W3_ETHEREUM="http://127.0.0.1:8545" export URL_W3_S_CHAIN="http://127.0.0.1:8545" python3 test.py - - - name: Prepare test (JS part) - working-directory: ./test - run: | - yarn install - - - name: Run test (JS part) - working-directory: ./test - run: | - yarn test diff --git a/.github/workflows/network-browser-test.yml b/.github/workflows/network-browser-test.yml index 96da99a1..517c5b91 100644 --- a/.github/workflows/network-browser-test.yml +++ b/.github/workflows/network-browser-test.yml @@ -1,5 +1,5 @@ name: network-browser test -on: [push, pull_request] +on: [push] env: ETH_PRIVATE_KEY: ${{ secrets.ETH_PRIVATE_KEY }} MANAGER_TAG: "1.9.3-beta.0" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0b906e79..1a593613 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,36 +39,26 @@ jobs: ${{ runner.os }}-yarn- - name: INIT - install Node JS - run: | - curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - - sudo apt-get install -y nodejs - sudo ln -s /usr/bin/node /usr/local/bin/node || true - - - name: INIT - install Node utilities - run: | - sudo npm install --global npm - sudo npm install --global color-support - sudo npm install --global yarn - sudo npm install --global node-gyp + uses: actions/setup-node@v4 + with: + node-version: 18 - - name: INIT - version checks of Node JS and its utilities + - name: INIT - install Node utilities run: | - which node - node --version - which npx - npx --version - which npm - npm --version - which yarn - yarn --version - which node-gyp - node-gyp --version + npm install --global npx || true + npm install --global yarn + npm install --global node-gyp - name: Set up Python 3.8 uses: actions/setup-python@v2 with: python-version: 3.8 + - name: Ensure deps are latest and build everything + run: | + yarn install + yarn rebuild + - name: Build and publish container run: | export BRANCH=${GITHUB_REF##*/} diff --git a/Dockerfile b/Dockerfile index 1ece5042..ea53a155 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,7 @@ COPY package.json package.json COPY runner runner COPY src src +COPY src/pow src/build/pow RUN mkdir IMA COPY IMA/proxy IMA/proxy COPY IMA/package.json IMA/package.json diff --git a/src/package.json b/src/package.json index 84776503..13e1ef1e 100644 --- a/src/package.json +++ b/src/package.json @@ -4,7 +4,7 @@ "author": "SKALE Labs and contributors", "type": "module", "scripts": { - "build": "./node_modules/typescript/bin/tsc", + "build": "./node_modules/typescript/bin/tsc && cp -f ./pow ./build/pow", "rebuild": "yarn clean-build && yarn build", "clean-build": "rm -rf ./src/build/* || true", "lint-check": "eslint -c .eslintrc.cjs ./*.ts",