mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-17 15:37:34 +08:00
ci: build every target on a single step
Switching to use an all_variants approach to reduce the number of jobs we are creating per workflow since are starting to get throttled by GitHub, and we have limited resources. TODO: Build artifact uploadeds to S3, and GH Releases
This commit is contained in:
@@ -23,6 +23,10 @@ parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
|
||||
help='Verbose Output')
|
||||
parser.add_argument('-p', '--pretty', dest='pretty', action='store_true',
|
||||
help='Pretty output instead of a single line')
|
||||
parser.add_argument('-a', '--all_variants', dest='all_variants', action='store_true',
|
||||
help='Prints targets into a single all_variants_* target')
|
||||
parser.add_argument('-b', '--bloaty', dest='bloaty', action='store_true',
|
||||
help='Includes all bloaty targets')
|
||||
|
||||
args = parser.parse_args()
|
||||
verbose = args.verbose
|
||||
@@ -35,6 +39,15 @@ excluded_labels = [
|
||||
'nolockstep', 'replay', 'test',
|
||||
'uavcanv1' # TODO: fix and enable
|
||||
]
|
||||
bloaty_helpers = [
|
||||
'bloaty_compileunits',
|
||||
'bloaty_inlines',
|
||||
'bloaty_segments',
|
||||
'bloaty_symbols',
|
||||
'bloaty_templates',
|
||||
'bloaty_ram',
|
||||
'bloaty_compare_master',
|
||||
]
|
||||
|
||||
def process_target(px4board_file, target_name):
|
||||
ret = None
|
||||
@@ -77,6 +90,15 @@ def process_target(px4board_file, target_name):
|
||||
|
||||
return ret
|
||||
|
||||
def process_bloaty(target_path, target_name):
|
||||
response = []
|
||||
for bloat in bloaty_helpers:
|
||||
bloaty_name = target_name + ' ' + bloat + ' || true'
|
||||
processed_target = process_target(target_path, bloaty_name)
|
||||
response.append(processed_target)
|
||||
return response
|
||||
|
||||
# Look up boards from each manufacturer
|
||||
for manufacturer in os.scandir(os.path.join(source_dir, 'boards')):
|
||||
if not manufacturer.is_dir():
|
||||
continue
|
||||
@@ -85,18 +107,34 @@ for manufacturer in os.scandir(os.path.join(source_dir, 'boards')):
|
||||
continue
|
||||
|
||||
for board in os.scandir(manufacturer.path):
|
||||
# Only boards are directories don't proceed if otherwise
|
||||
if not board.is_dir():
|
||||
continue
|
||||
for files in os.scandir(board.path):
|
||||
if files.is_file() and files.name.endswith('.px4board'):
|
||||
label = files.name[:-9]
|
||||
target_name = manufacturer.name + '_' + board.name + '_' + label
|
||||
if label in excluded_labels:
|
||||
if verbose: print(f'excluding label {label} ({target_name})')
|
||||
continue
|
||||
target = process_target(files.path, target_name)
|
||||
if target is not None:
|
||||
build_configs.append(target)
|
||||
|
||||
if args.all_variants:
|
||||
# The all_variants target makes all targets for a board
|
||||
target_name = 'all_variants_' + manufacturer.name + '_' + board.name
|
||||
default_target_path = f'{board.path}/default.px4board'
|
||||
target = process_target(default_target_path, target_name)
|
||||
if target is not None:
|
||||
build_configs.append(target)
|
||||
if args.bloaty and target is not None:
|
||||
# bloaty targets
|
||||
bloat_target_name = manufacturer.name + '_' + board.name
|
||||
bloaty_targets = process_bloaty(default_target_path, bloat_target_name)
|
||||
build_configs += bloaty_targets
|
||||
else:
|
||||
# Each board can have multiple variant targets
|
||||
for files in os.scandir(board.path):
|
||||
if files.is_file() and files.name.endswith('.px4board'):
|
||||
label = files.name[:-9]
|
||||
target_name = manufacturer.name + '_' + board.name + '_' + label
|
||||
if label in excluded_labels:
|
||||
if verbose: print(f'excluding label {label} ({target_name})')
|
||||
continue
|
||||
target = process_target(files.path, target_name)
|
||||
if target is not None:
|
||||
build_configs.append(target)
|
||||
|
||||
|
||||
github_action_config = { 'include': build_configs }
|
||||
|
||||
Reference in New Issue
Block a user