Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup zus-cli-st #369

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
26 changes: 24 additions & 2 deletions deploy-0chain/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ inputs:
required: false
description: '0Wallet CLI (branch or commit SHA) which the tests will use'
default: ''
zus_cli_branch:
required: false
description: 'zus CLI (branch or commit SHA) which the tests will use'
default: ''
custom_go_sdk_version:
required: false
default: ""
Expand Down Expand Up @@ -168,6 +172,7 @@ runs:
./check-params.sh "${{inputs.zdns_image}}" "${{ env.SNAPSHOT_BRANCH_ZDNS_TAG }}" "ZDNS_TAG"
./check-params.sh "${{inputs.zbox_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZBOXCLI }}" "ZBOX_BRANCH"
./check-params.sh "${{inputs.zwallet_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZWALLETCLI }}" "ZWALLET_BRANCH"
./check-params.sh "${{inputs.zus_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZUSCLI }}" "ZUSCLI_BRANCH"
./check-params.sh "${{inputs.zs3_minio}}" "${{ env.SNAPSHOT_BRANCH_MIBIOSERVER_TAG }}" "ZS3_MINIO"
./check-params.sh "${{inputs.zs3_logsearchapi}}" "${{ env.SNAPSHOT_BRANCH_LOGSEARCHAPI_TAG }}" "ZS3_LOGSEARCHAPI"
./check-params.sh "${{inputs.zs3_client}}" "${{ env.SNAPSHOT_BRANCH_CLIENTAPI_TAG }}" "ZS3_CLIENT"
Expand Down Expand Up @@ -678,13 +683,21 @@ runs:
fetch-depth: 1
path: ./zboxcli

- name: "Checkout zus-cli"
uses: actions/checkout@v3
with:
ref: ${{ env.ZUSCLI_BRANCH }}
repository: 0chain/zus-cli
fetch-depth: 1
path: ./zus-cli

- name: "Upgrade GoSDK"
shell: 'script --return --quiet --command "bash {0}"'
if: ${{ env.GOSDK_VERSION != '' && env.GOSDK_VERSION != 'NONE' }}
run: |
echo
echo "=============================================================="
echo "UPGRADING GOSDK IN ZBOXCLI, ZWALLETCLI"
echo "UPGRADING GOSDK IN ZBOXCLI, ZWALLETCLI AND ZUSCLI"
echo "=============================================================="
echo

Expand All @@ -706,6 +719,8 @@ runs:
../upgrade-gosdk.sh $GOSDK_HEAD zwalletcli
cd ../zboxcli
../upgrade-gosdk.sh $GOSDK_HEAD zboxcli
cd ../zus-cli
../upgrade-gosdk.sh $GOSDK_HEAD zus-cli

sudo rm -rf upgrade-gosdk.sh

Expand All @@ -715,7 +730,7 @@ runs:
run: |
echo
echo "======================================================"
echo "BUILDING 0WALLET AND 0BOX CLI BINARIES:"
echo "BUILDING 0WALLET, 0BOX AND ZUS-CLI BINARIES:"
echo "======================================================"
echo
# echo "removing go.work file if present"
Expand All @@ -737,6 +752,13 @@ runs:
mv zbox ..
echo "CLI build SUCCESS!"

echo "Building zus-cli [${{ env.ZUSCLI_BRANCH }}]..."
cd ../zus-cli
go mod tidy
docker run --rm -v ./:/zus-cli -w /zus-cli golang:1.23 make install > build.log 2>&1 || { cat build.log && echo "::error title=zus-cli build failed::zus-cli build failed" && exit 1; }
mv zus-cli ..
echo "zus-cli build SUCCESS!"

- name: "Health Check"
shell: 'script --return --quiet --command "bash {0}"'
run: |
Expand Down
79 changes: 77 additions & 2 deletions run-system-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ inputs:
required: false
description: '0Wallet CLI (branch or commit SHA) which the tests will use'
default: ''
zus_cli_branch:
required: false
description: 'zus CLI (branch or commit SHA) which the tests will use'
default: ''
s3_migration_cli_branch:
required: false
description: 'S3 Migration CLI (branch or commit SHA) which the tests will use'
Expand Down Expand Up @@ -137,6 +141,7 @@ runs:

./check-params.sh "${{inputs.zbox_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZBOXCLI }}" "ZBOX_BRANCH"
./check-params.sh "${{inputs.zwallet_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZWALLETCLI }}" "ZWALLET_BRANCH"
./check-params.sh "${{inputs.zus_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZUSCLI_BRANCH }}" "ZUSCLI_BRANCH"
./check-params.sh "${{inputs.system_tests_branch}}" "${{ env.SNAPSHOT_BRANCH_SYSTEM_TEST }}" "SYSTEM_TESTS_BRANCH"
./check-params.sh "${{inputs.s3_migration_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_S3-MIGRATION }}" "S3_MIGRATION_BRANCH"
./check-params.sh "${{inputs.custom_go_sdk_version}}" "${{ env.SNAPSHOT_BRANCH_GOSDK }}" "GOSDK_VERSION"
Expand Down Expand Up @@ -235,6 +240,7 @@ runs:
echo "0box network URL: [0box.${{ env.NETWORK_URL }}]"
echo "0box CLI branch: [${{ env.ZBOX_BRANCH }}]"
echo "0wallet CLI branch: [${{ env.ZWALLET_BRANCH }}]"
echo "zus-cli branch: [${{ env.ZUSCLI_BRANCH }}]"
echo "s3 migration CLI branch: [${{ env.S3_MIGRATION_BRANCH }}]"
echo "Ethereum node URL: [https://virtual.mainnet.rpc.tenderly.co/${{ inputs.TENDERLY_VIRTUAL_TESTNET_RPC_ID }}]"
echo "Custom gosdk version: [${{ env.GOSDK_VERSION }}]"
Expand Down Expand Up @@ -270,6 +276,14 @@ runs:
fetch-depth: 1
path: ./zboxcli

- name: "Checkout zus-cli"
uses: actions/checkout@v3
with:
ref: ${{ env.ZUSCLI_BRANCH }}
repository: 0chain/zus-cli
fetch-depth: 1
path: ./zus-cli

- name: "Checkout S3 Migration CLI"
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -312,7 +326,7 @@ runs:
run: |
echo
echo "=============================================================="
echo "UPGRADING GOSDK IN ZBOXCLI, ZWALLETCLI, ZS3CLI & SYSTEM TESTS"
echo "UPGRADING GOSDK IN ZBOXCLI, ZWALLETCLI, ZUSCLI, ZS3CLI & SYSTEM TESTS"
echo "=============================================================="
echo

Expand All @@ -333,6 +347,8 @@ runs:
../upgrade-gosdk.sh $GOSDK_HEAD zwalletcli
cd ../zboxcli
../upgrade-gosdk.sh $GOSDK_HEAD zboxcli
cd ../zus-cli
../upgrade-gosdk.sh $GOSDK_HEAD zus-cli
cd ../s3-migration
../upgrade-gosdk.sh $GOSDK_HEAD zs3cli
cd ../tests/cli_tests
Expand All @@ -348,7 +364,7 @@ runs:
run: |
echo
echo "======================================================"
echo "BUILDING 0WALLET AND 0BOX CLI BINARIES:"
echo "BUILDING 0WALLET, 0BOX AND ZUS CLI BINARIES:"
echo "======================================================"
echo

Expand All @@ -363,6 +379,11 @@ runs:
cd ../zboxcli
make install > build.log 2>&1 || { cat build.log && echo "::error title=zbox CLI build failed::zbox CLI build failed" && exit 1; }
mv zbox ../tests/cli_tests

echo "Building zus-cli [${{ env.ZUSCLI_BRANCH }}]..."
cd ../zus-cli
make install > build.log 2>&1 || { cat build.log && echo "::error title=zus-cli build failed::zus-cli build failed" && exit 1; }
mv zus-cli ../tests/cli_tests

echo "Building s3 migration CLI [${{ env.S3_MIGRATION_BRANCH }}]..."
cd ../s3-migration
Expand Down Expand Up @@ -871,6 +892,7 @@ runs:

GOPATH=$(echo $(go env GOPATH))

echo "CLI_TESTS_DIR=$(pwd)/tests/cli_tests" >> $GITHUB_ENV
cd tests/cli_tests
system_tests_exit_code=0
echo "Sequential tests are currently running.... It will take a few minutes for initial test output to appear..."
Expand Down Expand Up @@ -899,6 +921,59 @@ runs:

exit $system_tests_exit_code

- name: "Run zus-cli system tests"
shell: 'script --return --quiet --command "bash {0}"'
if: ${{ always() && env.TESTS_READY && env.RUN_SUBSET_OF_TESTS == 'false' && env.RUN_CLI_SYSTEM_TESTS == 'true' }}
run: |
echo
echo "======================================================"
echo "RUNNING SYSTEM TESTS:"
echo "======================================================"
echo

export HOME="/root"

GOPATH=$(echo $(go env GOPATH))

# create symlink
cd $CLI_TESTS_DIR
echo "Current Directory: $(pwd)"
echo "CREATING SYMLINKS:"
rm -f ./zbox ./zwallet
ln -s ./zus-cli ./zbox
ln -s ./zus-cli ./zwallet
echo "VERIFY SYMLINKS:"
ls -l ./zbox ./zwallet
readlink ./zbox
readlink ./zwallet

system_tests_exit_code=0
echo "Sequential tests are currently running.... It will take a few minutes for initial test output to appear..."
echo
${GOPATH}/bin/gotestsum --jsonfile test-output.json --hide-summary=output --format testname ${{ env.SHOULD_RETRY_FAILURES }} --raw-command -- ../../TEST_RUNNER_COMMAND.sh || system_tests_exit_code=$?
cat test-output.json | ${GOPATH}/bin/go-test-report --groupSize 1 --output ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/cli/index.html --title "0Chain System test suite [${{ env.BRANCH_DIR }}/${GITHUB_SHA:0:8}] ran against [${{ env.NETWORK_URL }}] at [${{ env.TEST_TIME }}]"

${GOPATH}/bin/gotestsum --jsonfile test-output.json --hide-summary=output --format testname ${{ env.SHOULD_RETRY_FAILURES }} --raw-command -- ../../KILL_TEST_RUNNER_COMMAND.sh || system_tests_exit_code=$?
cat test-output.json | ${GOPATH}/bin/go-test-report --groupSize 1 --output ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/killtestscli/index.html --title "0Chain System test suite: Kill tests [${{ env.BRANCH_DIR }}/${GITHUB_SHA:0:8}] ran against [${{ env.NETWORK_URL }}] at [${{ env.TEST_TIME }}]"

${GOPATH}/bin/gotestsum --jsonfile test-output.json --hide-summary=output --format testname ${{ env.SHOULD_RETRY_FAILURES }} --raw-command -- ../../MONITORING_TEST_RUNNER_COMMAND.sh || system_tests_exit_code=$?
cat test-output.json | ${GOPATH}/bin/go-test-report --groupSize 1 --output ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/monitoringtestscli/index.html --title "0Chain System test suite: Monitoring tests [${{ env.BRANCH_DIR }}/${GITHUB_SHA:0:8}] ran against [${{ env.NETWORK_URL }}] at [${{ env.TEST_TIME }}]"

cp -R ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/cli ../../${{ env.BRANCH_DIR }}/latest/
cp -R ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/killtestscli ../../${{ env.BRANCH_DIR }}/latest/
cp -R ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/monitoringtestscli ../../${{ env.BRANCH_DIR }}/latest/
echo "TESTS_RAN=true" >> $GITHUB_ENV

if [[ $system_tests_exit_code == 0 ]];
then
echo TESTS_PASSED=true >> $GITHUB_ENV
else
echo TESTS_PASSED=false >> $GITHUB_ENV
echo "::error title=System tests faled!::System tests failed. Ensure tests are running against the correct images/branches and rule out any possible code issues before attempting a re-run"
fi

exit $system_tests_exit_code

- name: "Run subset of CLI System Tests"
if: ${{ always() && env.TESTS_READY && env.RUN_SUBSET_OF_TESTS == 'true' }}
shell: 'script --return --quiet --command "bash {0}"'
Expand Down