Skip to content

Commit

Permalink
Add system tests to gosdk repo (#335)
Browse files Browse the repository at this point in the history
* Add system tests to gosdk repo

* branch name debug

* add concurrency

* separate system tests into own stage

* use SHA instead of branch

* use SHA instead of branch

* set PR correctly

Co-authored-by: Lz <imlangzi@qq.com>
  • Loading branch information
stewartie4 and cnlangzi authored Dec 26, 2021
1 parent acc3121 commit baa993c
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Tests

concurrency:
group: "${{ github.ref }}"
cancel-in-progress: true

on:
push:
branches: [ master, staging ]
Expand Down Expand Up @@ -30,6 +34,7 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: '1.16' # The Go version to download (if necessary) and use.

- uses: actions/setup-node@v2
with:
node-version: '14'
Expand All @@ -40,6 +45,93 @@ jobs:
- name: Run Unit Test
run: LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH make gosdk-test

system-test:
needs: go-test
runs-on: [ tests-suite ]
steps:
- name: "Get current PR"
uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
github-token: ${{ github.token }}

- name: "Set PR Status Pending"
uses: niteoweb/pull_request_status_action@v1.0.0
if: steps.findPr.outputs.number
with:
pr_number: ${{ steps.findPr.outputs.pr }}
description: "System tests running with default config..."
state: "pending"
repository: ${{ github.repository }}
context: "0Chain System Tests"
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: "Setup"
run: |
echo "CURRENT_BRANCH_HEAD=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
echo "NETWORK_URL=$(echo dev-${RUNNER_NAME:(-1)}.devnet-0chain.net)" >> $GITHUB_ENV
echo "RUNNER_NUMBER=${RUNNER_NAME:(-1)}" >> $GITHUB_ENV
- name: "Deploy 0Chain"
uses: 0chain/actions/deploy-0chain@feature/add-gosdk-flag
with:
kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }}
teardown_condition: "TESTS_PASSED"
miner_image: staging
sharder_image: staging
blobber_image: staging
validator_image: staging
zbox_image: staging
zblock_image: staging
zdns_image: staging
explorer_image: latest
zproxy_image: staging
zsearch_image: staging
blobber_stake_image: latest

- name: "Run System tests"
uses: 0chain/actions/run-system-tests@feature/add-gosdk-flag
with:
custom_go_sdk_version: ${{ env.CURRENT_BRANCH_HEAD }}
system_tests_branch: master
network: ${{ env.NETWORK_URL }}
zbox_cli_branch: fix/upgrade_gosdk
zwallet_cli_branch: staging
smart_contract_owner_wallet_json: ${{ secrets.SMART_CONTRACT_OWNER_WALLET_JSON }}
svc_account_secret: ${{ github.token }}
deploy_report_page: false
archive_results: true
run_flaky_tests: false
retry_failures: true

- name: "Set PR Status Success"
if: ${{ success() && steps.findPr.outputs.number }}
uses: niteoweb/pull_request_status_action@v1.0.0
with:
pr_number: ${{ steps.findPr.outputs.pr }}
description: "System tests with default config completed successfully"
state: ${{ job.status }}
repository: ${{ github.repository }}
context: "0Chain System Tests"
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: "Set PR Status Failed"
if: ${{ failure() && steps.findPr.outputs.number }}
uses: niteoweb/pull_request_status_action@v1.0.0
with:
pr_number: ${{ steps.findPr.outputs.pr }}
description: "System tests with default config failed. Try running manually with more specific config"
state: ${{ job.status }}
repository: ${{ github.repository }}
context: "0Chain System Tests"
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ github.token }}

wasm-test:
runs-on: ubuntu-latest
env:
Expand Down

0 comments on commit baa993c

Please sign in to comment.