diff --git a/.github/workflows/local.yaml b/.github/workflows/local.yaml new file mode 100644 index 0000000..f11513d --- /dev/null +++ b/.github/workflows/local.yaml @@ -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 + + + + \ No newline at end of file diff --git a/.github/workflows/mainnet.yaml b/.github/workflows/mainnet.yaml new file mode 100644 index 0000000..1e6f9da --- /dev/null +++ b/.github/workflows/mainnet.yaml @@ -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 + + + + \ No newline at end of file diff --git a/.github/workflows/testnet.yaml b/.github/workflows/testnet.yaml new file mode 100644 index 0000000..4699262 --- /dev/null +++ b/.github/workflows/testnet.yaml @@ -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 + + + + \ No newline at end of file diff --git a/local.json b/local.json index 0a55f73..5c18bdd 100644 --- a/local.json +++ b/local.json @@ -1,5 +1,5 @@ { - "chain-type": "mainnet", + "chain-type": "testnet", "relaychain": { "name": "kusama", "nodes": [ diff --git a/testdata/chain_value.csv b/testdata/chain_value.csv new file mode 100644 index 0000000..4229037 --- /dev/null +++ b/testdata/chain_value.csv @@ -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 \ No newline at end of file diff --git a/testdata/generate_json.py b/testdata/generate_json.py new file mode 100644 index 0000000..b0b7010 --- /dev/null +++ b/testdata/generate_json.py @@ -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() \ No newline at end of file diff --git a/testdata/updated_config.json b/testdata/updated_config.json new file mode 100644 index 0000000..86e4f4e --- /dev/null +++ b/testdata/updated_config.json @@ -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" + } + ] + } + } + } \ No newline at end of file