Fix/refactor zboxcore #2153
Workflow file for this run
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: Tests | |
concurrency: | |
group: "tests-${{ github.ref }}" | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [ master, staging, sprint* ] | |
pull_request: | |
jobs: | |
unit-test: | |
runs-on: [self-hosted, build] | |
steps: | |
- name: Setup go 1.21 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
- name: Clone Zbox | |
uses: actions/checkout@v2 | |
- name: Install Packages | |
run: | | |
lsb_release -a | |
sudo apt-get update | |
sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev | |
- name: Run Tests | |
run: make zboxcli-test | |
build-linux: | |
runs-on: [self-hosted, build] | |
needs: unit-test | |
steps: | |
- name: Setup go 1.21 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
- name: Clone 0Box | |
uses: actions/checkout@v2 | |
- name: check software | |
run: | | |
lsb_release -a | |
sudo apt update | |
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev containerd docker.io | |
- name: Build zbox | |
run: make install | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: zbox-linux | |
path: zbox | |
retention-days: 5 | |
system-tests: | |
if: github.event_name != 'workflow_dispatch' | |
needs: build-linux | |
runs-on: [ tests-suite ] | |
timeout-minutes: 90 | |
steps: | |
- name: "Get current PR" | |
uses: jwalton/gh-find-current-pr@v1 | |
id: findPr | |
with: | |
github-token: ${{ github.token }} | |
- name: "Setup Test Run" | |
run: | | |
echo "NETWORK_URL=$(echo dev-${RUNNER_NAME:(-1)}.devnet-0chain.net)" >> $GITHUB_ENV | |
echo "RUNNER_NUMBER=${RUNNER_NAME:(-1)}" >> $GITHUB_ENV | |
echo "CURRENT_BRANCH=$(echo $(([ -z '${{ github.head_ref }}' ] && echo ${GITHUB_REF#refs/*/}) || echo '${{ github.head_ref }}'))" >> $GITHUB_ENV | |
- name: "Set PR status as pending" | |
uses: 0chain/actions/set-pr-status@master | |
if: steps.findPr.outputs.number | |
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: '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" | |
uses: 0chain/actions/deploy-0chain@master | |
with: | |
repo_snapshots_branch: "<CURRENT BRANCH WITH FALLBACK TO CURRENT_SPRINT>" | |
kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} | |
teardown_condition: "TESTS_PASSED" | |
zbox_cli_branch: ${{ env.CURRENT_BRANCH }} | |
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: "Run System tests" | |
uses: 0chain/actions/run-system-tests@master | |
with: | |
repo_snapshots_branch: "<CURRENT BRANCH WITH FALLBACK TO CURRENT_SPRINT>" | |
network: ${{ env.NETWORK_URL }} | |
zbox_cli_branch: ${{ env.CURRENT_BRANCH }} | |
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} | |
deploy_report_page: false | |
archive_results: true | |
run_flaky_tests: false | |
retry_failures: true | |
TENDERLY_VIRTUAL_TESTNET_RPC_ID: ${{ env.TENDERLY_VIRTUAL_TESTNET_RPC_ID }} | |
DEVOPS_CHANNEL_WEBHOOK_URL: ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }} | |
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} | |
run_smoke_tests: ${{ github.ref != 'refs/heads/staging' && github.base_ref != 'staging' && github.ref != 'refs/heads/master' && github.base_ref != 'master' }} | |
- 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 }} | |
- name: "Set PR status as ${{ job.status }}" | |
if: ${{ (success() || failure()) && steps.findPr.outputs.number }} | |
uses: 0chain/actions/set-pr-status@master | |
with: | |
pr_number: ${{ steps.findPr.outputs.pr }} | |
description: "System tests with default config ${{ job.status }}" | |
state: ${{ job.status }} | |
repository: ${{ github.repository }} | |
status_name: "0Chain System Tests" | |
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
github_token: ${{ github.token }} |