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

Fix workflow and nightly runs #974

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions .github/workflows/challenge_protocol_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: "Challenge Protocol Tests"
concurrency:
group: "challenge-nightly-tests-${{ github.ref }}-${{ github.event_name }}"
cancel-in-progress: true
on:
schedule:
# Runs every morning at 2am UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
repo_snapshots_branch:
description: 'branch of repo-snapshots to derive images and branches from.'
default: 'current-sprint'
required: true

jobs:
system-tests:
name: "Challenge System Tests"
runs-on: [ tests-suite ]
steps:
- name: "Config: Deploy new 0Chain network then run challenge tests against it"
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
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: 'Setup jq'
uses: dcarbone/[email protected]
with:
version: '1.7'
force: 'false'

- name: "Create Tenderly fork"
run: |
echo "TENDERLY_CREATION_INFO=$(curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV

- name: "Parse Tenderly fork creation transaction result"
run: |
echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV
echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV

- name: "Retrieve Tenderly fork block number"
run: |
echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV

echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV

- name: "Transfer Bridge ownership in Tenderly fork"
run: |
echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{
"network_id": "1",
"block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }},
"transaction_index": null,
"from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4",
"input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97",
"to": "0x7700d773022b19622095118fadf46f7b9448be9b",
"gas": 8000000,
"gas_price": "0",
"value": "0",
"access_list": [],
"generate_access_list": true,
"save": true,
"source": "dashboard",
"block_header": null,
"root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}",
"skip_fork_head_update": false,
"alias": "",
"description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97"
}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV

echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV

- name: "Transfer Authorizers ownership in Tenderly fork"
run: |
curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{
"network_id": "1",
"block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }},
"transaction_index": null,
"from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4",
"input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97",
"to": "0x481dab4407b9880de0a68dc62e6af611c4949e42",
"gas": 8000000,
"gas_price": "0",
"value": "0",
"access_list": [],
"generate_access_list": true,
"save": true,
"source": "dashboard",
"block_header": null,
"root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}",
"skip_fork_head_update": false,
"alias": "",
"description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97"
}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate

- name: "Deploy 0Chain"
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: ${{ env.TENDERLY_FORK_ID }}
graphnode_sc: ${{ secrets.GRAPHNODE_SC }}
graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }}
graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}

- name: "Run Challenge 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: false
run_api_system_tests: false
run_cli_system_tests: false
run_tokenomics_system_tests: false
run_smoke_tests: false
run_s3mgrt_system_tests: false
run_challenge_system_tests: true
test_file_filter: ${{ env.TEST_FILE_FILTER }}
TENDERLY_FORK_ID: ""
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}

- name: "Remove Tenderly fork"
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/fork/${{ env.TENDERLY_FORK_ID }}
11 changes: 2 additions & 9 deletions .github/workflows/nightly-challenge-sprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ on:
# Runs every morning at 2am UTC
- cron: '0 2 * * *'
workflow_dispatch:
repo_snapshots_branch:
description: 'branch of repo-snapshots to derive images and branches from.'
default: 'current-sprint'
required: true

jobs:
system-tests:
Expand All @@ -21,8 +17,6 @@ jobs:
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
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: 'Setup jq'
uses: dcarbone/[email protected]
Expand Down Expand Up @@ -111,7 +105,7 @@ jobs:
- name: "Deploy 0Chain"
uses: 0chain/actions/deploy-0chain@master
with:
repo_snapshots_branch: "${{ env.REPO_SNAPSHOTS_BRANCH }}"
repo_snapshots_branch: current-sprint
kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }}
teardown_condition: "TESTS_PASSED"
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }}
Expand All @@ -124,8 +118,7 @@ jobs:
- name: "Run Challenge System tests"
uses: 0chain/actions/run-system-tests@master
with:
repo_snapshots_branch: "${{ env.REPO_SNAPSHOTS_BRANCH }}"
system_tests_branch: ${{ env.CURRENT_BRANCH }}
repo_snapshots_branch: current-sprint
network: ${{ env.NETWORK_URL }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
deploy_report_page: true
Expand Down
180 changes: 180 additions & 0 deletions .github/workflows/nightly-challenge-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: "Challenge Protocol Nightly Tests - Staging"
concurrency:
group: "challenge-nightly-tests-${{ github.ref }}-${{ github.event_name }}"
cancel-in-progress: true
on:
schedule:
# Runs every morning at 2am UTC
- cron: '0 2 * * *'
workflow_dispatch:

jobs:
system-tests:
name: "Challenge System Tests"
runs-on: [ tests-suite ]
steps:
- name: "Config: Deploy new 0Chain network then run challenge tests against it"
run: |
echo "NETWORK_URL=$(echo dev-${RUNNER_NAME:(-1)}.devnet-0chain.net)" >> $GITHUB_ENV
echo "RUNNER_NUMBER=${RUNNER_NAME:(-1)}" >> $GITHUB_ENV

- name: 'Setup jq'
uses: dcarbone/[email protected]
with:
version: '1.7'
force: 'false'

- name: "Create Tenderly fork"
run: |
echo "TENDERLY_CREATION_INFO=$(curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{"alias":"mainnet-dev-${{ env.RUNNER_NUMBER }}-${{ github.run_id }}${{ github.run_attempt }}", "description":"", "block_number": 18539779, "network_id":"1"}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork)" >> $GITHUB_ENV

- name: "Parse Tenderly fork creation transaction result"
run: |
echo "TENDERLY_FORK_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.simulation_fork.id')" >> $GITHUB_ENV
echo "TENDERLY_ROOT_TRANSACTION_ID=$(echo '${{ env.TENDERLY_CREATION_INFO }}' | jq -r '.root_transaction.id')" >> $GITHUB_ENV

- name: "Retrieve Tenderly fork block number"
run: |
echo "TENDERLY_FORK_BLOCK_NUMBER=$(curl -X GET \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
https://api.tenderly.co/api/v1/network/1/block-number | jq -r '.block_number')" >> $GITHUB_ENV

echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV

- name: "Transfer Bridge ownership in Tenderly fork"
run: |
echo "TENDERLY_ROOT_TRANSACTION_ID=$(curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{
"network_id": "1",
"block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }},
"transaction_index": null,
"from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4",
"input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97",
"to": "0x7700d773022b19622095118fadf46f7b9448be9b",
"gas": 8000000,
"gas_price": "0",
"value": "0",
"access_list": [],
"generate_access_list": true,
"save": true,
"source": "dashboard",
"block_header": null,
"root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}",
"skip_fork_head_update": false,
"alias": "",
"description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97"
}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate | jq -r '.simulation.id')" >> $GITHUB_ENV

echo "TENDERLY_FORK_BLOCK_NUMBER=$((${{ env.TENDERLY_FORK_BLOCK_NUMBER }} + 1))" >> GITHUB_ENV

- name: "Transfer Authorizers ownership in Tenderly fork"
run: |
curl -X POST \
-H "x-access-key: ${{ secrets.TENDERLY_SECRET }}" \
-H "Content-Type: application/json" \
-d '{
"network_id": "1",
"block_number": ${{ env.TENDERLY_FORK_BLOCK_NUMBER }},
"transaction_index": null,
"from": "0xed8f3170db6d1a71c8fa6d8d73cc2c51db95d5a4",
"input": "0xf2fde38b0000000000000000000000008e25cfd9bd6c0ca67a5522cd920b3c66d39d6e97",
"to": "0x481dab4407b9880de0a68dc62e6af611c4949e42",
"gas": 8000000,
"gas_price": "0",
"value": "0",
"access_list": [],
"generate_access_list": true,
"save": true,
"source": "dashboard",
"block_header": null,
"root": "${{ env.TENDERLY_ROOT_TRANSACTION_ID }}",
"skip_fork_head_update": false,
"alias": "",
"description": "Transfer ownership to 0x8E25cfd9bd6c0ca67a5522cd920b3c66D39d6E97"
}' \
https://api.tenderly.co/api/v1/account/zus_network/project/project/fork/${{ env.TENDERLY_FORK_ID }}/simulate

- name: "Deploy 0Chain"
uses: 0chain/actions/deploy-0chain@master
with:
repo_snapshots_branch: staging
kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }}
teardown_condition: "TESTS_PASSED"
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }}
TENDERLY_FORK_ID: ${{ env.TENDERLY_FORK_ID }}
graphnode_sc: ${{ secrets.GRAPHNODE_SC }}
graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }}
graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ env.TENDERLY_FORK_ID }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}

- name: "Run Challenge System tests"
uses: 0chain/actions/run-system-tests@master
with:
repo_snapshots_branch: staging
network: ${{ env.NETWORK_URL }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
deploy_report_page: true
archive_results: true
run_flaky_tests: false
run_api_system_tests: false
run_cli_system_tests: false
run_tokenomics_system_tests: false
run_smoke_tests: false
run_s3mgrt_system_tests: false
run_challenge_system_tests: true
test_file_filter: ${{ env.TEST_FILE_FILTER }}
TENDERLY_FORK_ID: ""
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}

- name: "Remove Tenderly fork"
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/fork/${{ env.TENDERLY_FORK_ID }}

notify_slack_on_failure:
runs-on: [self-hosted, arc-runner]
needs: [system-tests]
if: always() && (needs.system-tests.result == 'failure')
steps:
- name: "Notify Slack"
run: |
payload='{
"text": "'"<!here> Challenge Protocol Nightly Tests - Staging FAILED on $(echo ${GITHUB_REF#refs/heads/})!.\n View the test results on Github: https://github.com/0chain/system_test/actions/runs/${{ github.run_id }}"'",
"attachments": [
{
"text": "Challenge Protocol Nightly Tests - Staging: FAILED ⚠️",
"color": "#ff0000"
}
]
}'
curl -X POST -H 'Content-type: application/json' --data "${payload}" ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}

notify_slack_on_success:
runs-on: [self-hosted, arc-runner]
needs: [system-tests]
if: always() && (needs.system-tests.result == 'success')
steps:
- name: "Notify Slack"
run: |
payload='{
"text": "'"<!here> Challenge Protocol Nightly Tests - Staging PASSING on $(echo ${GITHUB_REF#refs/heads/})!.\n View the test results on Github: https://github.com/0chain/system_test/actions/runs/${{ github.run_id }}"'",
"attachments": [
{
"text": "Challenge Protocol Nightly Tests - Staging: PASSED ✅",
"color": "#22bb33"
}
]
}'
curl -X POST -H 'Content-type: application/json' --data "${payload}" ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}
Loading
Loading