diff options
| author | Lywx <kiritodev01@gmail.com> | 2023-12-30 14:33:27 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-30 17:33:27 -0300 |
| commit | d00cff570a3fc0a7eb256c8d23e34eadee796e9a (patch) | |
| tree | 7371c4f970f8f086984aae42b2b28a3f7208fb1d /tools | |
| parent | 62a4a36804944874bde6de3ae84438133460627c (diff) | |
Discord matching progress inside CI (#64)
* Discord matching progress inside CI
* Readded frogress rule
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/requirements-python.txt | 3 | ||||
| -rw-r--r-- | tools/upload_progress.py | 32 |
2 files changed, 34 insertions, 1 deletions
diff --git a/tools/requirements-python.txt b/tools/requirements-python.txt index 1f5686f7..2c17d75f 100644 --- a/tools/requirements-python.txt +++ b/tools/requirements-python.txt @@ -8,4 +8,5 @@ colorama pygfxd n64img>=0.1.4 GitPython -colour
\ No newline at end of file +colour +requests
\ No newline at end of file diff --git a/tools/upload_progress.py b/tools/upload_progress.py new file mode 100644 index 00000000..726a0927 --- /dev/null +++ b/tools/upload_progress.py @@ -0,0 +1,32 @@ +from progress import * +import requests +import argparse + +def main(args): + func_sizes, total_size = get_func_sizes() + all_funcs = set(func_sizes.keys()) + + nonmatching_funcs = get_nonmatching_funcs() + matching_funcs = all_funcs - nonmatching_funcs + + matching_size, nonmatching_size = get_funcs_sizes(func_sizes, matching_funcs, nonmatching_funcs) + + if len(all_funcs) == 0: + funcs_matching_ratio = 0.0 + matching_ratio = 0.0 + else: + funcs_matching_ratio = (len(matching_funcs) / len(all_funcs)) * 100 + matching_ratio = (matching_size / total_size) * 100 + + content = { + "embeds": [{ + "description": f"**{len(matching_funcs)}** matched functions / **{len(all_funcs)}** total (**{funcs_matching_ratio:.2f}%**)\n**{matching_size}** matching bytes / **{total_size}** total (**{matching_ratio:.2f}%**)" + }] + } + requests.post(args.discord_url, json=content) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Reports progress for the project on Discord") + parser.add_argument("--discord_url", help="Discord webhook URL", required=True) + args = parser.parse_args() + main(args)
\ No newline at end of file |
