Skip to content

Commit

Permalink
Command bot GHA v2 - /cmd <cmd> (paritytech#5457)
Browse files Browse the repository at this point in the history
Closes paritytech/product-engineering#93

- Deprecates old command bot bash scripts. New cmd implementation is
re-written on Python
- Deprecates `sync` command, which was never used
- Benchmarks:
- Uses new
[frame-omni-bencher](https://crates.io/crates/frame-omni-bencher)
- Simplifies usage to only providing a runtime and/or pallet name (even
multiple runtimes or pallets)
- Supports sub-modules (like `/cmd bench --runtime dev --pallet
pallet_asset_conversion_ops`)
- Can regenerate all weights with one command (substrate, polkadot,
cumulus) for provided pallet(s) name
- Adds [subweight](https://crates.io/crates/subweight-core) diff as a
result of bench command
  • Loading branch information
mordamax authored Aug 28, 2024
1 parent 4096ad7 commit 8e0cefc
Show file tree
Hide file tree
Showing 30 changed files with 851 additions and 1,934 deletions.
Binary file removed .github/command-screnshot.png
Binary file not shown.
276 changes: 0 additions & 276 deletions .github/commands-readme.md

This file was deleted.

26 changes: 26 additions & 0 deletions .github/scripts/cmd/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import argparse

"""
Custom help action for argparse, it prints the help message for the main parser and all subparsers.
"""


class _HelpAction(argparse._HelpAction):
def __call__(self, parser, namespace, values, option_string=None):
parser.print_help()

# retrieve subparsers from parser
subparsers_actions = [
action for action in parser._actions
if isinstance(action, argparse._SubParsersAction)]
# there will probably only be one subparser_action,
# but better save than sorry
for subparsers_action in subparsers_actions:
# get all subparsers and print help
for choice, subparser in subparsers_action.choices.items():
print("\n### Command '{}'".format(choice))
print(subparser.format_help())

parser.exit()
Loading

0 comments on commit 8e0cefc

Please sign in to comment.