From 86295319301573918784abc98c8b2cf4992b9441 Mon Sep 17 00:00:00 2001 From: wcgcyx Date: Tue, 21 Nov 2023 12:03:56 +1000 Subject: [PATCH] Enable CI --- .github/workflows/e2e.yml | 30 ++++++++++++++++++++++++++++++ package.json | 1 + scripts/localdev/ci.sh | 20 ++++++++++++++++++++ scripts/localdev/deploy.sh | 23 ++++++++++++++++++++++- 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/e2e.yml create mode 100755 scripts/localdev/ci.sh diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000..71f9b593 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,30 @@ +name: End to End Test + +on: [push] + +jobs: + build: + name: End to End Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: Run install + uses: borales/actions-yarn@v4 + with: + cmd: install + + - name: Run build + uses: borales/actions-yarn@v4 + with: + cmd: build + + - name: Run Test + uses: borales/actions-yarn@v4 + with: + cmd: local:ci \ No newline at end of file diff --git a/package.json b/package.json index 7c02379a..a5f63478 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "local:start": "cd scripts/localdev; ./start.sh", "local:setup": "cd scripts/localdev; ./deploy.sh", "local:test": "cd scripts/localdev; npx mocha --require mocha-suppress-logs ../e2e/", + "local:ci": "cd scripts/localdev; ./ci.sh", "local:chainonly": "cd scripts/localdev; LOCAL_CHAIN_ONLY=true ./start.sh", "local:axelaronly": "cd scripts/localdev; node axelar_setup.js", "stop": "cd scripts/localdev; ./stop.sh" diff --git a/scripts/localdev/ci.sh b/scripts/localdev/ci.sh new file mode 100755 index 00000000..fa58eabc --- /dev/null +++ b/scripts/localdev/ci.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +./start.sh & + +# Try at most 300 seconds +counter=1 +while [ $counter -le 300 ] +do + echo "Waiting for chain and axelar setup... ${counter}" + SKIP_WAIT_FOR_CONFIRMATION=true SKIP_MULTISIG_CHECK=true node ../bootstrap/2_deployment_validation.js > /dev/null 2>&1 + if [ $? -ne 0 ]; then + sleep 1 + ((counter++)) + continue + fi + break +done + +./deploy.sh +npx mocha --require mocha-suppress-logs ../e2e/ \ No newline at end of file diff --git a/scripts/localdev/deploy.sh b/scripts/localdev/deploy.sh index d423ccc0..06abf03c 100755 --- a/scripts/localdev/deploy.sh +++ b/scripts/localdev/deploy.sh @@ -2,21 +2,42 @@ # Verify deployment SKIP_WAIT_FOR_CONFIRMATION=true SKIP_MULTISIG_CHECK=true node ../bootstrap/2_deployment_validation.js +if [ $? -ne 0 ]; then + exit 1; +fi # Deploy child contracts SKIP_WAIT_FOR_CONFIRMATION=true node ../bootstrap/3_child_deployment.js +if [ $? -ne 0 ]; then + exit 1; +fi # Deploy root contracts SKIP_WAIT_FOR_CONFIRMATION=true node ../bootstrap/4_root_deployment.js +if [ $? -ne 0 ]; then + exit 1; +fi # Initialise child contracts SKIP_WAIT_FOR_CONFIRMATION=true node ../bootstrap/5_child_initialisation.js +if [ $? -ne 0 ]; then + exit 1; +fi # IMX Burning SKIP_WAIT_FOR_CONFIRMATION=true node ../bootstrap/6_imx_burning.js +if [ $? -ne 0 ]; then + exit 1; +fi # IMX Rebalancing SKIP_WAIT_FOR_CONFIRMATION=true node ../bootstrap/7_imx_rebalancing.js +if [ $? -ne 0 ]; then + exit 1; +fi # Initialise root contracts -SKIP_WAIT_FOR_CONFIRMATION=true node ../bootstrap/8_root_initialisation.js \ No newline at end of file +SKIP_WAIT_FOR_CONFIRMATION=true node ../bootstrap/8_root_initialisation.js +if [ $? -ne 0 ]; then + exit 1; +fi \ No newline at end of file