Added Github workflow for continuous deployment of contracts to Neutron testnet #20
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: Deploy contracts on Neutron testnet | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
jobs: | |
deploy-latest-contracts: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
# Checkout Hydro repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Download specific neutrond binary and add it to the PATH so it can be used by other scripts | |
- name: Download Neutron chain binary | |
run: | | |
curl -L -o neutrond https://github.com/neutron-org/neutron/releases/download/v5.0.2/neutrond-linux-amd64 | |
chmod +x neutrond | |
echo "$(pwd)" >> $GITHUB_PATH | |
# Checkout Neutron ICQ relayer repository | |
- name: Checkout Neutron ICQ relayer repository | |
uses: actions/checkout@v4 | |
with: | |
repository: neutron-org/neutron-query-relayer | |
path: ./neutron-query-relayer # directory to checkout the repo into | |
ref: 'refs/tags/v0.3.0' # tag to checkout | |
# Run scripts to store the codes, instantiate contracts and create proposals with tributes | |
- name: Deploy contracts | |
env: | |
TESTNET_MNEMONIC: ${{ secrets.E2E_TESTS_MNEMONIC }} | |
run: | | |
CONFIG_FILE="./tools/deployment/config_testnet.json" | |
TX_SENDER_WALLET=$(jq -r '.tx_sender_wallet' $CONFIG_FILE) | |
echo $TESTNET_MNEMONIC | neutrond keys add $TX_SENDER_WALLET --keyring-backend test --recover | |
chmod +x ./tools/deployment/store_instantiate.sh | |
chmod +x ./tools/deployment/populate_contracts.sh | |
source ./tools/deployment/store_instantiate.sh $CONFIG_FILE true | |
source ./tools/deployment/populate_contracts.sh $CONFIG_FILE | |
# Run tools/script.sh to create validator ICQs in the contract and run the ICQ relayer to | |
# get the results into the contract | |
- name: Run ICQs setup script | |
run: | | |
cp ./tools/script.sh . | |
chmod +x script.sh | |
CONFIG_FILE="./tools/deployment/config_testnet.json" | |
CHAIN_ID=$(echo $(jq -r '.chain_id' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g') | |
NEUTRON_RPC_NODE=$(echo $(jq -r '.neutron_rpc_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g') | |
NEUTRON_API_NODE=$(echo $(jq -r '.neutron_api_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g') | |
TX_SENDER_WALLET=$(echo $(jq -r '.tx_sender_wallet' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g') | |
HUB_CONNECTION_ID=$(echo $(jq -r '.hub_connection_id' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g') | |
HUB_RPC_NODE=$(echo $(jq -r '.hub_rpc_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g') | |
HUB_API_NODE=$(echo $(jq -r '.hub_api_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g') | |
sed -i "s|^RELAYER_REPO_PATH=.*$|RELAYER_REPO_PATH=\.\/neutron-query-relayer|" ./script.sh | |
sed -i "s/^export NEUTRON_CHAIN_ID=.*$/export NEUTRON_CHAIN_ID=$CHAIN_ID/" ./script.sh | |
sed -i "s/^export RELAYER_NEUTRON_CHAIN_RPC_ADDR=.*$/export RELAYER_NEUTRON_CHAIN_RPC_ADDR=$NEUTRON_RPC_NODE/" ./script.sh | |
sed -i "s/^export RELAYER_NEUTRON_CHAIN_REST_ADDR=.*$/export RELAYER_NEUTRON_CHAIN_REST_ADDR=$NEUTRON_API_NODE/" ./script.sh | |
sed -i "s/^export RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=.*$/export RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=$TX_SENDER_WALLET/" ./script.sh | |
sed -i "s/^export RELAYER_NEUTRON_CHAIN_CONNECTION_ID=.*$/export RELAYER_NEUTRON_CHAIN_CONNECTION_ID=$HUB_CONNECTION_ID/" ./script.sh | |
sed -i "s/^export RELAYER_TARGET_CHAIN_RPC_ADDR=.*$/export RELAYER_TARGET_CHAIN_RPC_ADDR=$HUB_RPC_NODE/" ./script.sh | |
sed -i "s/^export RELAYER_TARGET_CHAIN_API_ADDR=.*$/export RELAYER_TARGET_CHAIN_API_ADDR=$HUB_API_NODE/" ./script.sh | |
sed -i "s/^export RELAYER_REGISTRY_ADDRESSES=.*$/export RELAYER_REGISTRY_ADDRESSES=$HYDRO_CONTRACT_ADDRESS/" ./script.sh | |
sed -i "s/^export BATCH_SIZE=.*$/export BATCH_SIZE=5/" ./script.sh | |
sed -i "s/^export NUM_VALIDATORS_TO_ADD=.*$/export NUM_VALIDATORS_TO_ADD=5/" ./script.sh | |
sed -i "s/^export RELAYER_STORAGE_PATH=.*$/export RELAYER_STORAGE_PATH=\.neutron_queries_relayer\/leveldb/" ./script.sh | |
sed -i "s|^go run main\.go.*$|go run \./tools/main\.go|" ./script.sh | |
stop_icq_relayer() { | |
sleep 300 | |
killall neutron_query_relayer | |
} | |
stop_icq_relayer & | |
bash ./script.sh |