Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed Oct 25, 2023
1 parent 535ddc3 commit b26c781
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
6 changes: 3 additions & 3 deletions scripts/output_scripts/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def json_to_markdown(json_list, key):
# Start constructing the row with app_name
row = "| {} |".format(app_name)

# Iterate over each build and append the status
for build in ["nanos", "nanosp", "nanox", "stax"]:
build_data = app_data.get(build, {})
# Iterate over each device and append the status
for d in ["nanos", "nanosp", "nanox", "stax"]:
build_data = app_data.get(d, {})
if isinstance(build_data, dict): # nested structure
status_icon = ":red_circle:" if "Fail" in build_data.values() else ":heavy_check_mark:" if "Success" in build_data.values() else ":fast_forward:" if "Skipped" in build_data.values() else ""
else:
Expand Down
40 changes: 22 additions & 18 deletions scripts/output_scripts/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,31 @@ def count_status(json_list, key):
app_name = json_data.get("name", {})
fail_list[app_name] = {}

failed_devices = ""
for key_data, build_data in app_data.items():
for d in ["nanos", "nanosp", "nanox", "stax"]:
build_data = app_data.get(d, {})

if isinstance(build_data, dict): # nested structure
variant, status = build_data.popitem()
failed_variant_list = []
for variant, status in build_data.items():
if status == "Success":
total_count += 1
success_count += 1
elif status == "Fail":
total_count += 1
fail_count += 1
failed_variant_list.append(variant)

if failed_variant_list:
fail_list[app_name][d] = failed_variant_list
else:
status = build_data


if status == "Success":
total_count += 1
success_count += 1
elif status == "Fail":
total_count += 1
fail_count += 1
if variant:
fail_list[app_name][key_data] = variant
else:
failed_devices += f"{key_data}, "

if key == "test" and failed_devices:
fail_list[app_name] = failed_devices
if status == "Success":
total_count += 1
success_count += 1
elif status == "Fail":
total_count += 1
fail_count += 1
fail_list[app_name] = d

return success_count, fail_count, total_count, fail_list

Expand Down
22 changes: 15 additions & 7 deletions scripts/output_scripts/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
from argparse import ArgumentParser
from pathlib import Path


def check_status(json_data, key):
for app_data in json_data:
name = app_data["name"]
target_data = app_data.get(key) # Use .get() to safely access the key
if target_data is not None and isinstance(target_data, dict):
for _, status in target_data.items():
if status == "Fail":
raise ValueError(f"Failed for {name}")
# Iterate over each dictionary in the list
for json_data in json_data:
app_data = json_data.get(key, {})
app_name = json_data.get("name", {})

for d in ["nanos", "nanosp", "nanox", "stax"]:
data = app_data.get(d, {})
if isinstance(data, dict): # nested structure
if "Fail" in data.values():
raise ValueError(f"Failed for {app_name}")
else:
if data == "Fail":
raise ValueError(f"Failed for {app_name}")


if __name__ == "__main__":
parser = ArgumentParser()
Expand Down

0 comments on commit b26c781

Please sign in to comment.