Skip to content

Commit

Permalink
Merge pull request #142 from HugoByte/DIVE-367-To-run-the-Github-acti…
Browse files Browse the repository at this point in the history
…ons-simultaneously-and-refactor-accordingly

test: run the GitHub actions simultaneously and refactor accordingly
  • Loading branch information
Mr-Nobody21 authored Dec 4, 2023
2 parents ff87897 + c7f3333 commit 8a34089
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 99 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,16 @@ jobs:
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 || true
# Check if Kurtosis command failed
if [ $? -ne 0 ]; then
echo "Chain $para_chain failed."
failed_chains+=("$para_chain")
else
echo "Chain $para_chain succeeded."
fi
kurtosis run . --args-file ./testdata/updated_config.json --enclave polkadot || failed_chains+=("$para_chain")
done < ./testdata/chain_value.csv
if [ ${#failed_chains[@]} -gt 0 ]; then
echo "Failed chains: ${failed_chains[@]}"
else
echo "All chains succeeded."
fi
- name: Print failed chains
run: |
if [ ${#failed_chains[@]} -gt 0 ]; then
echo "Failed chains: ${failed_chains[@]}"
else
echo "All chains succeeded."
fi

Expand Down
26 changes: 6 additions & 20 deletions .github/workflows/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,11 @@ jobs:
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 || true
# Check if Kurtosis command failed
if [ $? -ne 0 ]; then
echo "Chain $para_chain failed."
failed_chains+=("$para_chain")
else
echo "Chain $para_chain succeeded."
fi
kurtosis run . --args-file ./testdata/updated_config.json --enclave polkadot || failed_chains+=("$para_chain")
done < ./testdata/chain_value.csv
- name: Print failed chains
run: |
if [ ${#failed_chains[@]} -gt 0 ]; then
echo "Failed chains: ${failed_chains[@]}"
else
echo "All chains succeeded."
fi

if [ ${#failed_chains[@]} -gt 0 ]; then
echo "Failed chains: ${failed_chains[@]}"
else
echo "All chains succeeded."
fi
37 changes: 0 additions & 37 deletions .github/workflows/smoke.yaml

This file was deleted.

39 changes: 16 additions & 23 deletions .github/workflows/testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,23 @@ jobs:
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 || true
# Check if Kurtosis command failed
if [ $? -ne 0 ]; then
echo "Chain $para_chain failed."
failed_chains+=("$para_chain")
else
echo "Chain $para_chain succeeded."
fi
done < ./testdata/chain_value.csv
- name: Print failed chains
run: |
if [ ${#failed_chains[@]} -gt 0 ]; then
echo "Failed chains: ${failed_chains[@]}"
else
echo "All chains succeeded."
fi
kurtosis clean -a
echo "Processing para chain: $para_chain, relay chain: $relay_chain"
# Call Python script with para_chain and relay_chain as arguments
if [ "$para_chain" == 'parallel' ] || [ "$para_chain" == 'subzero' ]; then
echo "testnet not supported for $para_chain"
else
python ./testdata/generate_json.py --relay "$relay_chain" --para "$para_chain" --network "testnet"
kurtosis run . --args-file ./testdata/updated_config.json --enclave polkadot || failed_chains+=("$para_chain")
fi
done < ./testdata/chain_value.csv
if [ ${#failed_chains[@]} -gt 0 ]; then
echo "Failed chains: ${failed_chains[@]}"
else
echo "All chains succeeded."
fi



3 changes: 2 additions & 1 deletion testdata/chain_value.csv
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ subzero,Kusama
litmus,Kusama
moonriver,Kusama
calamari,Kusama
phala,Polkadot
phala,Polkadot
end
5 changes: 3 additions & 2 deletions testdata/generate_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ def update_config(original_config, relay_chain, para_chain, network):
config_data["chain-type"] = "local"
config_data["relaychain"]["name"] = relay_chain

name = next(iter(config_data["para"].keys()))
for para in config_data["para"]:
para["name"] = para_chain

config_data["para"][para_chain] = config_data["para"].pop(name)
# 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
Expand Down

0 comments on commit 8a34089

Please sign in to comment.