mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +00:00
implement seed-chain cd job for internal testnet
This commit is contained in:
parent
06b434eaff
commit
8d713873d7
47
.github/scripts/seed-internal-testnet.sh
vendored
Executable file
47
.github/scripts/seed-internal-testnet.sh
vendored
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
# configure kava binary to talk to the desired chain endpoint
|
||||||
|
kava config node ${CHAIN_API_URL}
|
||||||
|
kava config chain-id ${CHAIN_ID}
|
||||||
|
|
||||||
|
# use the test keyring to allow scriptng key generation
|
||||||
|
kava config keyring-backend test
|
||||||
|
|
||||||
|
# wait for transactions to be committed per CLI command
|
||||||
|
kava config broadcast-mode block
|
||||||
|
|
||||||
|
# setup dev wallet
|
||||||
|
echo "${DEV_WALLET_MNEMONIC}" | kava keys add --recover dev-wallet
|
||||||
|
|
||||||
|
# setup kava etherum comptabile account for deploying
|
||||||
|
# erc20 contracts to the kava chain
|
||||||
|
echo "sweet ocean blush coil mobile ten floor sample nuclear power legend where place swamp young marble grit observe enforce lake blossom lesson upon plug" | kava keys add --recover --eth dev-erc20-deployer-wallet
|
||||||
|
|
||||||
|
# fund evm-contract-deployer account (using issuance)
|
||||||
|
yes y | kava tx issuance issue 200000000ukava kava1van3znl6597xgwwh46jgquutnqkwvwszjg04fz --from dev-wallet --gas-prices 0.5ukava
|
||||||
|
|
||||||
|
# deploy and fund USDC ERC20 contract
|
||||||
|
USD_CONTRACT_DEPLOY=$(npx hardhat --network demonet deploy-erc20 "USD Coin" USDC 6)
|
||||||
|
USD_CONTRACT_ADDRESS=${USD_CONTRACT_DEPLOY: -42}
|
||||||
|
npx hardhat --network demonet mint-erc20 "$USD_CONTRACT_ADDRESS" 0x6767114FFAA17C6439D7AEA480738B982CE63A02 1000000000000
|
||||||
|
|
||||||
|
# # deploy and fund wKava ERC20 contract
|
||||||
|
wKAVA_CONTRACT_DEPLOY=$(npx hardhat --network demonet deploy-erc20 "Wrapped Kava" wKava 6)
|
||||||
|
wKAVA_CONTRACT_ADDRESS=${wKAVA_CONTRACT_DEPLOY: -42}
|
||||||
|
npx hardhat --network demonet mint-erc20 "$wKAVA_CONTRACT_ADDRESS" 0x6767114FFAA17C6439D7AEA480738B982CE63A02 1000000000000
|
||||||
|
|
||||||
|
# deploy and fund BNB contract
|
||||||
|
BNB_CONTRACT_DEPLOY=$(npx hardhat --network demonet deploy-erc20 "Binance" BNB 8)
|
||||||
|
BNB_CONTRACT_ADDRESS=${BNB_CONTRACT_DEPLOY: -42}
|
||||||
|
npx hardhat --network demonet mint-erc20 "$BNB_CONTRACT_ADDRESS" 0x6767114FFAA17C6439D7AEA480738B982CE63A02 1000000000000
|
||||||
|
|
||||||
|
# deploy and fund USDT contract
|
||||||
|
USDT_CONTRACT_DEPLOY=$(npx hardhat --network demonet deploy-erc20 "USDT" USDT 6)
|
||||||
|
USDT_CONTRACT_ADDRESS=${USDT_CONTRACT_DEPLOY: -42}
|
||||||
|
npx hardhat --network demonet mint-erc20 "$USDT_CONTRACT_ADDRESS" 0x6767114FFAA17C6439D7AEA480738B982CE63A02 1000000000000
|
||||||
|
|
||||||
|
# deploy and fund DAI contract
|
||||||
|
DAI_CONTRACT_DEPLOY=$(npx hardhat --network demonet deploy-erc20 "DAI" DAI 18)
|
||||||
|
DAI_CONTRACT_ADDRESS=${DAI_CONTRACT_DEPLOY: -42}
|
||||||
|
npx hardhat --network demonet mint-erc20 "$DAI_CONTRACT_ADDRESS" 0x6767114FFAA17C6439D7AEA480738B982CE63A02 1000000000000
|
12
.github/workflows/cd-internal-testnet.yml
vendored
12
.github/workflows/cd-internal-testnet.yml
vendored
@ -5,10 +5,6 @@ on:
|
|||||||
workflows: [Continuous Integration (Kava Master)]
|
workflows: [Continuous Integration (Kava Master)]
|
||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
push:
|
|
||||||
# run CI on any push to the feature branch
|
|
||||||
branches:
|
|
||||||
- ls-internal-testnet-cd-pipeline
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# in order:
|
# in order:
|
||||||
@ -26,7 +22,7 @@ jobs:
|
|||||||
chain-id: demo_2221-17000
|
chain-id: demo_2221-17000
|
||||||
ssm-document-name: kava-demonet-node-update
|
ssm-document-name: kava-demonet-node-update
|
||||||
playbook-name: reset-internal-testnet-playbook.yml
|
playbook-name: reset-internal-testnet-playbook.yml
|
||||||
playbook-infrastructure-branch: ls-deploy-testnet-for-cd-prototyping
|
playbook-infrastructure-branch: master
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
# start kava with new binary and genesis state on api, peer and seed nodes, place nodes in service once they start and are synched to live
|
# start kava with new binary and genesis state on api, peer and seed nodes, place nodes in service once they start and are synched to live
|
||||||
@ -37,12 +33,16 @@ jobs:
|
|||||||
chain-id: demo_2221-17000
|
chain-id: demo_2221-17000
|
||||||
ssm-document-name: kava-demonet-node-update
|
ssm-document-name: kava-demonet-node-update
|
||||||
playbook-name: start-chain-api-playbook.yml
|
playbook-name: start-chain-api-playbook.yml
|
||||||
playbook-infrastructure-branch: ls-deploy-testnet-for-cd-prototyping
|
playbook-infrastructure-branch: master
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
needs: [reset-chain-to-zero-state]
|
needs: [reset-chain-to-zero-state]
|
||||||
|
|
||||||
# setup test and development accounts and balances, deploy contracts by calling the chain's api
|
# setup test and development accounts and balances, deploy contracts by calling the chain's api
|
||||||
seed-chain-state:
|
seed-chain-state:
|
||||||
uses: ./.github/workflows/cd-seed-chain.yml
|
uses: ./.github/workflows/cd-seed-chain.yml
|
||||||
|
with:
|
||||||
|
chain-api-url: https://rpc.data.demonet.us-east.production.kava.io:443
|
||||||
|
chain-id: kava_2221-17000
|
||||||
|
seed-script-filename: seed-internal-testnet.sh
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
needs: [start-chain-api]
|
needs: [start-chain-api]
|
||||||
|
@ -50,7 +50,7 @@ jobs:
|
|||||||
repository: Kava-Labs/infrastructure
|
repository: Kava-Labs/infrastructure
|
||||||
token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
|
token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
|
||||||
path: infrastructure
|
path: infrastructure
|
||||||
ref: ls-deploy-testnet-for-cd-prototyping
|
ref: master
|
||||||
- name: set up Go
|
- name: set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
|
63
.github/workflows/cd-seed-chain.yml
vendored
63
.github/workflows/cd-seed-chain.yml
vendored
@ -2,10 +2,67 @@ name: Seed Chain
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
chain-api-url:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
chain-id:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
seed-script-filename:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
DEV_WALLET_MNEMONIC:
|
||||||
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
no-op:
|
seed-chain-state:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: no-op
|
- name: checkout repo from current commit
|
||||||
run: echo "Hello World"
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.18'
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- name: build kava binary
|
||||||
|
run: make install
|
||||||
|
- name: checkout go evm tools repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: ethereum/go-ethereum
|
||||||
|
path: go-ethereum
|
||||||
|
- name: install go evm tools
|
||||||
|
run: |
|
||||||
|
make
|
||||||
|
make devtools
|
||||||
|
working-directory: go-ethereum
|
||||||
|
- name: checkout kava bridge repo for deploying evm contracts
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: Kava-Labs/kava-bridge
|
||||||
|
path: kava-bridge
|
||||||
|
ref: master
|
||||||
|
- name: install nodeJS
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
cache: npm
|
||||||
|
node-version: 18
|
||||||
|
cache-dependency-path: kava-bridge/contract/package.json
|
||||||
|
- name: "install ERC20 contract deployment dependencies"
|
||||||
|
run: "npm install"
|
||||||
|
working-directory: kava-bridge/contract
|
||||||
|
- name: compile default erc20 contracts
|
||||||
|
run: make compile-contracts
|
||||||
|
working-directory: kava-bridge
|
||||||
|
- name: run seed scripts
|
||||||
|
run: bash ${GITHUB_WORKSPACE}/.github/scripts/${SEED_SCRIPT_FILENAME}
|
||||||
|
working-directory: kava-bridge/contract
|
||||||
|
env:
|
||||||
|
CHAIN_API_URL: ${{ inputs.chain-api-url }}
|
||||||
|
CHAIN_ID: ${{ inputs.chain-id }}
|
||||||
|
DEV_WALLET_MNEMONIC: ${{ secrets.DEV_WALLET_MNEMONIC }}
|
||||||
|
SEED_SCRIPT_FILENAME: ${{ inputs.seed-script-filename }}
|
||||||
|
2
.github/workflows/cd-start-chain.yml
vendored
2
.github/workflows/cd-start-chain.yml
vendored
@ -46,7 +46,7 @@ jobs:
|
|||||||
repository: Kava-Labs/infrastructure
|
repository: Kava-Labs/infrastructure
|
||||||
token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
|
token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
|
||||||
path: infrastructure
|
path: infrastructure
|
||||||
ref: ls-deploy-testnet-for-cd-prototyping
|
ref: master
|
||||||
- name: set up Go
|
- name: set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
|
Loading…
Reference in New Issue
Block a user