System tests [feat/enterprise-blobber-tests] - [] #117
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "DEV-ST.DEVNET-0CHAIN.NET" | |
run-name: "System tests [${{ github.ref_name }}] - [${{ github.event.head_commit.message }}]" | |
concurrency: | |
group: "dev-st-${{ github.ref }}-${{ github.event_name }}" | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
inputs: | |
repo_snapshots_branch: | |
description: 'branch of repo-snapshots to derive images and branches from.' | |
default: 'current-sprint' | |
required: true | |
existing_network: | |
description: '(OPTIONAL): *EXISTING NETWORK* to run system tests against *INSTEAD OF* deploying a new network. [example: dev.0chain.net]' | |
default: '' | |
required: false | |
test_file_filter: | |
description: 'Comma separated list of test files to run (eg. zwalletcli_send_and_balance_test.go). If supplied, the PR will NOT be notified of the test result' | |
default: '' | |
required: false | |
run_smoke_tests: | |
description: 'Only run smoke tests (subset of system tests for fast feedback)' | |
default: 'false' | |
required: false | |
jobs: | |
dev-st: | |
name: "Deploy dev-st.devnet-0chain.net" | |
runs-on: [ tests-suitest ] | |
timeout-minutes: 150 | |
steps: | |
# - name: "Get current PR" | |
# uses: jwalton/gh-find-current-pr@v1 | |
# id: findPr | |
# with: | |
# github-token: ${{ github.token }} | |
# - name: "Set PR status as pending" | |
# uses: 0chain/actions/set-pr-status@master | |
# if: steps.findPr.outputs.number && github.event.inputs.test_file_filter == '' | |
# with: | |
# pr_number: ${{ steps.findPr.outputs.pr }} | |
# description: "System tests running with default config..." | |
# state: "pending" | |
# repository: ${{ github.repository }} | |
# status_name: "0Chain System Tests" | |
# target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
# github_token: ${{ github.token }} | |
- name: "Config: Run tests against existing 0Chain network" | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.existing_network != '' | |
run: | | |
echo "NETWORK_URL=$(echo ${{ github.event.inputs.existing_network }})" >> $GITHUB_ENV | |
echo "TEST_FILE_FILTER=$(echo $(([ -z '${{github.event.inputs.test_file_filter}}' ] && echo '') || echo '${{github.event.inputs.test_file_filter}}'))" >> $GITHUB_ENV | |
echo "CURRENT_BRANCH=$(echo $(([ -z '${{ github.head_ref }}' ] && echo ${GITHUB_REF#refs/*/}) || echo '${{ github.head_ref }}'))" >> $GITHUB_ENV | |
echo "REPO_SNAPSHOTS_BRANCH=$(echo $(([ -z '${{github.event.inputs.repo_snapshots_branch}}' ] && echo '<CURRENT BRANCH WITH FALLBACK TO CURRENT_SPRINT>') || echo '${{github.event.inputs.repo_snapshots_branch}}'))" >> $GITHUB_ENV | |
- name: "Config: Deploy new 0Chain network then run tests against it" | |
if: github.event_name == 'push' || github.event.inputs.existing_network == '' | |
run: | | |
echo "NETWORK_URL=$(echo dev-st.devnet-0chain.net)" >> $GITHUB_ENV | |
echo "RUNNER_NUMBER=st" >> $GITHUB_ENV | |
echo "TEST_FILE_FILTER=$(echo $(([ -z '${{github.event.inputs.test_file_filter}}' ] && echo '') || echo '${{github.event.inputs.test_file_filter}}'))" >> $GITHUB_ENV | |
echo "CURRENT_BRANCH=$(echo $(([ -z '${{ github.head_ref }}' ] && echo ${GITHUB_REF#refs/*/}) || echo '${{ github.head_ref }}'))" >> $GITHUB_ENV | |
echo "REPO_SNAPSHOTS_BRANCH=$(echo $(([ -z '${{github.event.inputs.repo_snapshots_branch}}' ] && echo '<CURRENT BRANCH WITH FALLBACK TO CURRENT_SPRINT>') || echo '${{github.event.inputs.repo_snapshots_branch}}'))" >> $GITHUB_ENV | |
if [[ "${{github.event.inputs.run_smoke_tests}}" == 'true' ]]; | |
then | |
echo RUN_SMOKE_TESTS=true >> $GITHUB_ENV | |
else | |
echo RUN_SMOKE_TESTS=false >> $GITHUB_ENV | |
fi | |
- name: 'Setup jq' | |
uses: dcarbone/[email protected] | |
with: | |
version: '1.7' | |
force: 'false' | |
- name: "Create Tenderly virtual testnet" | |
run: | | |
echo "TENDERLY_CREATION_INFO=$(curl -X POST \ | |
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ | |
-H "Content-Type: application/json" \ | |
-d '{"slug":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","displayName":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}","description":"","visibility":"TEAM","tags":{"purpose":"development"},"networkConfig":{"networkId":"1","blockNumber":"18512782","chainConfig":{"chainId":"1"},"baseFeePerGas":"1"},"explorerConfig":{"enabled":false,"verificationVisibility":"bytecode"},"syncState":false}' \ | |
https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container)" >> $GITHUB_ENV | |
- name: "Parse Tenderly virtual testnet creation transaction result" | |
run: | | |
echo "TENDERLY_VIRTUAL_TESTNET_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.id')" >> $GITHUB_ENV | |
echo "TENDERLY_VIRTUAL_TESTNET_RPC_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.container.connectivityConfig.endpoints[0].id')" >> $GITHUB_ENV | |
- name: "Deploy 0Chain" | |
if: github.event_name == 'push' || github.event.inputs.existing_network == '' | |
uses: 0chain/actions/deploy-0chain@feature/enterprise-blobber | |
with: | |
repo_snapshots_branch: "${{ env.REPO_SNAPSHOTS_BRANCH }}" | |
kube_config: ${{ secrets[format('DEVSTKC', env.RUNNER_NUMBER)] }} | |
teardown_condition: "TESTS_PASSED" | |
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} | |
TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} | |
graphnode_sc: ${{ secrets.GRAPHNODE_SC }} | |
graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} | |
graphnode_ethereum_node_url: https://virtual.mainnet.rpc.tenderly.co/${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} | |
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} | |
- name: "Remove Tenderly virtual testnet" | |
if: always() | |
run: | | |
curl -X DELETE \ | |
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \ | |
-H "Content-Type: application/json" \ | |
https://api.tenderly.co/api/v1/account/zus_network/project/project/testnet/container/${{ env.TENDERLY_VIRTUAL_TESTNET_ID }} |