-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from HugoByte/test/add-workflow-local-test-main
test: add workflow local test and main
- Loading branch information
Showing
7 changed files
with
220 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: localnet | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
localnet: | ||
name: test all parachains run on localnet | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Installing Kurtosis CLI if not found in cache | ||
run: | | ||
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list | ||
sudo apt update | ||
sudo apt install kurtosis-cli | ||
- name: Starting the Kurtosis engine | ||
run: kurtosis engine start | ||
|
||
- name: Read CSV and loop over items | ||
run: | | ||
# Read CSV file and extract values | ||
while IFS=',' read -r para_chain relay_chain; do | ||
kurtosis clean -a | ||
echo "Processing para chain: $para_chain, relay chain: $relay_chain" | ||
# Call Python script with para_chain and relay_chain as arguments | ||
python ./testdata/generate_json.py --relay "$relay_chain" --para "$para_chain" --network "local" | ||
kurtosis run . --args-file ./testdata/updated_config.json --enclave polkadot | ||
done < ./testdata/chain_value.csv | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: mainnet | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
mainnet: | ||
name: test all parachains run on mainnet | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Installing Kurtosis CLI if not found in cache | ||
run: | | ||
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list | ||
sudo apt update | ||
sudo apt install kurtosis-cli | ||
- name: Starting the Kurtosis engine | ||
run: kurtosis engine start | ||
|
||
- name: Read CSV and loop over items | ||
run: | | ||
# Read CSV file and extract values | ||
while IFS=',' read -r para_chain relay_chain; do | ||
kurtosis clean -a | ||
echo "Processing para chain: $para_chain, relay chain: $relay_chain" | ||
# Call Python script with para_chain and relay_chain as arguments | ||
python ./testdata/generate_json.py --relay "$relay_chain" --para "$para_chain" --network "mainnet" | ||
kurtosis run . --args-file ./testdata/updated_config.json --enclave polkadot | ||
done < ./testdata/chain_value.csv | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: testnet | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
testnet: | ||
name: test all parachains run on testnet | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Installing Kurtosis CLI if not found in cache | ||
run: | | ||
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list | ||
sudo apt update | ||
sudo apt install kurtosis-cli | ||
- name: Starting the Kurtosis engine | ||
run: kurtosis engine start | ||
|
||
- name: Read CSV and loop over items | ||
run: | | ||
# Read CSV file and extract values | ||
while IFS=',' read -r para_chain relay_chain; do | ||
kurtosis clean -a | ||
echo "Processing para chain: $para_chain, relay chain: $relay_chain" | ||
# Call Python script with para_chain and relay_chain as arguments | ||
python ./testdata/generate_json.py --relay "$relay_chain" --para "$para_chain" --network "testnet" | ||
kurtosis run . --args-file ./testdata/updated_config.json --enclave polkadot | ||
done < ./testdata/chain_value.csv | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"chain-type": "mainnet", | ||
"chain-type": "testnet", | ||
"relaychain": { | ||
"name": "kusama", | ||
"nodes": [ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
acala,Polkadot | ||
bifrost,Polkadot | ||
clover,Polkadot | ||
integritee,Polkadot | ||
kilt-spiritnet,Polkadot | ||
litentry,Polkadot | ||
moonbeam,Polkadot | ||
nodle,Polkadot | ||
pendulum,Polkadot | ||
polkadex,Polkadot | ||
zeitgeist,Polkadot | ||
altair,Kusama | ||
bifrost,Kusama | ||
karura,Kusama | ||
kintsugi-btc,Kusama | ||
mangata,Kusama | ||
robonomics,Kusama | ||
turing,Kusama | ||
ajuna,Polkadot | ||
centrifuge,Polkadot | ||
frequency,Polkadot | ||
interlay,Polkadot | ||
kylin,Polkadot | ||
manta,Polkadot | ||
moonsama,Polkadot | ||
parallel,Polkadot | ||
subsocial,Polkadot | ||
encointer-network,Kusama | ||
bajun,Kusama | ||
khala network,Kusama | ||
subzero,Kusama | ||
litmus,Kusama | ||
moonriver,Kusama | ||
calamari,Kusama | ||
phala-network,Polkadot |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import argparse | ||
import json | ||
|
||
|
||
def update_config(original_config, relay_chain, para_chain, network): | ||
# Read the original JSON file | ||
with open(original_config, 'r') as file: | ||
config_data = json.load(file) | ||
|
||
if network == "testnet": | ||
config_data["chain-type"] = "testnet" | ||
config_data["relaychain"]["name"] = "rococo" | ||
elif network == "mainnet": | ||
config_data["chain-type"] = "mainnet" | ||
config_data["relaychain"]["name"] = relay_chain.lower() | ||
else: | ||
# Update the original JSON data | ||
config_data["chain-type"] = "local" | ||
config_data["relaychain"]["name"] = relay_chain | ||
|
||
name = next(iter(config_data["para"].keys())) | ||
|
||
config_data["para"][para_chain] = config_data["para"].pop(name) | ||
updated_config = json.dumps(config_data, indent=2) | ||
|
||
# Optionally, save the updated config to a new file | ||
with open('./testdata/updated_config.json', 'w') as file: | ||
file.write(updated_config) | ||
|
||
print(updated_config) | ||
|
||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Your script description') | ||
parser.add_argument('--relay', type=str, help='Relay chain argument') | ||
parser.add_argument('--para', type=str, help='Para chain argument') | ||
parser.add_argument('--network', type=str, help='test environment') | ||
|
||
args = parser.parse_args() | ||
update_config("./local.json", args.relay, args.para, args.network) | ||
|
||
if __name__ == "__main__": | ||
main() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"chain-type": "mainnet", | ||
"relaychain": { | ||
"name": "rococo", | ||
"nodes": [ | ||
{ | ||
"name": "alice", | ||
"node-type": "validator", | ||
"port": 9944 | ||
}, | ||
{ | ||
"name": "bob", | ||
"node-type": "full", | ||
"port": 9945 | ||
} | ||
] | ||
}, | ||
"para": { | ||
"clover": { | ||
"nodes": [ | ||
{ | ||
"name": "alice", | ||
"node-type": "collator" | ||
}, | ||
{ | ||
"name": "bob", | ||
"node-type": "full" | ||
} | ||
] | ||
} | ||
} | ||
} |