Skip to content

System tests [replace-with-multiops] - [Merge branch 'sprint-july-4' into replace-with-multiops] #8502

System tests [replace-with-multiops] - [Merge branch 'sprint-july-4' into replace-with-multiops]

System tests [replace-with-multiops] - [Merge branch 'sprint-july-4' into replace-with-multiops] #8502

Workflow file for this run

name: "0Chain System Tests"
run-name: "System tests [${{ github.ref_name }}] - [${{ github.event.head_commit.message }}]"
concurrency:
group: "system-tests-${{ github.ref }}-${{ github.event_name }}"
cancel-in-progress: true
on:
push:
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:
golangci:
if: github.event_name == 'push'
name: "lint"
runs-on: [ arc-runner ]
steps:
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
skip-build-cache: true
skip-pkg-cache: true
only-new-issues: true
ensure-master-is-green:
if: github.ref != 'refs/heads/master'
name: "Ensure master is green"
runs-on: arc-runner
steps:
- name: Check CI
id: check-ci
uses: 0chain/actions/get-build-state@master
with:
github_token: ${{ github.token }}
repository: "0chain/system_test"
sha: master
- name: Success
if: ${{ env.BUILD_STATE == 'success' }}
run: echo "master is successful!"
- name: Not Successful
if: ${{ env.BUILD_STATE != 'success' }}
run: |
echo "master is NOT successful! was: [${{ env.BUILD_STATE }}]"
exit 1
system-tests:
name: "System Tests"
runs-on: [ tests-suite ]
timeout-minutes: 120
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-${RUNNER_NAME:(-1)}.devnet-0chain.net)" >> $GITHUB_ENV
echo "RUNNER_NUMBER=${RUNNER_NAME:(-1)}" >> $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: "Deploy 0Chain"
if: github.event_name == 'push' || github.event.inputs.existing_network == ''
uses: 0chain/actions/deploy-0chain@master
with:
repo_snapshots_branch: "${{ env.REPO_SNAPSHOTS_BRANCH }}"
kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }}
teardown_condition: "TESTS_PASSED"
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }}
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
graphnode_sc: ${{ secrets.GRAPHNODE_SC }}
graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }}
graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ secrets.TENDERLY_FORK_ID }}
authorizer_image: staging
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
- name: "Run System tests"
uses: 0chain/actions/run-system-tests@master
with:
repo_snapshots_branch: "${{ env.REPO_SNAPSHOTS_BRANCH }}"
system_tests_branch: ${{ env.CURRENT_BRANCH }}
network: ${{ env.NETWORK_URL }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
deploy_report_page: true
archive_results: true
run_flaky_tests: true
run_api_system_tests: true
run_cli_system_tests: true
run_tokenomics_system_tests: true
test_file_filter: ${{ env.TEST_FILE_FILTER }}
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }}
run_smoke_tests: ${{ inputs.run_smoke_tests }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
- name: "Set PR status as ${{ job.status }}"
if: ${{ (success() || failure()) && steps.findPr.outputs.number && github.event.inputs.test_file_filter == '' }}
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 }}
set-build-conclusion:
name: "Set build conclusion"
if: ${{ always() && github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch' }}
needs: [ golangci, system-tests ]
runs-on: self-hosted
steps:
- uses: technote-space/workflow-conclusion-action@v3
- name: "Parse status of ${{ env.WORKFLOW_CONCLUSION }}"
run: |
if [ "${{ env.WORKFLOW_CONCLUSION }}" != "success" ]; then
echo "WORKFLOW_CONCLUSION=failure" >> $GITHUB_ENV
fi
- name: "Set build status to ${{ env.WORKFLOW_CONCLUSION }}"
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: '0Chain System Tests CI'
description: "Build status: ${{ env.WORKFLOW_CONCLUSION }}"
state: ${{ env.WORKFLOW_CONCLUSION }}
sha: ${{github.event.pull_request.head.sha || github.sha}}