More ci tweak (#2636)

* change concurrency group to ${{ github.workflow }}-${{ github.ref }}
* use argparse for build.py hil_test.py, remove the need to install click
* move ci win/mac to build_cmake.yml
* rename build_family.yml to build_util.yml
* build_util.yml support esp32
* integrate build-espressif into build.yml
* build.py support make with --board option
* add get_deps action
* update hil test to reuse action
This commit is contained in:
Ha Thach
2024-05-10 18:55:43 +07:00
committed by GitHub
parent bf9cf107c6
commit 3e2ea77506
24 changed files with 296 additions and 443 deletions

View File

@@ -1,8 +1,8 @@
import argparse
import os
import sys
import time
import subprocess
import click
from pathlib import Path
from multiprocessing import Pool
@@ -125,13 +125,20 @@ def build_family(family, toolchain, build_system):
return ret
@click.command()
@click.argument('families', nargs=-1, required=False)
@click.option('-b', '--board', multiple=True, default=None, help='Boards to build')
@click.option('-t', '--toolchain', default='gcc', help='Toolchain to use, default is gcc')
@click.option('-s', '--build-system', default='cmake', help='Build system to use, default is cmake')
def main(families, board, toolchain, build_system):
if len(families) == 0 and len(board) == 0:
def main():
parser = argparse.ArgumentParser()
parser.add_argument('families', nargs='*', default=[], help='Families to build')
parser.add_argument('-b', '--board', action='append', default=[], help='Boards to build')
parser.add_argument('-t', '--toolchain', default='gcc', help='Toolchain to use, default is gcc')
parser.add_argument('-s', '--build-system', default='cmake', help='Build system to use, default is cmake')
args = parser.parse_args()
families = args.families
boards = args.board
toolchain = args.toolchain
build_system = args.build_system
if len(families) == 0 and len(boards) == 0:
print("Please specify families or board to build")
return 1
@@ -159,12 +166,23 @@ def main(families, board, toolchain, build_system):
total_result[2] += fret[2]
# build board (only cmake)
if board is not None:
for b in board:
r = build_board_cmake(b, toolchain)
total_result[0] += r[0]
total_result[1] += r[1]
total_result[2] += r[2]
if boards is not None:
for b in boards:
if build_system == 'cmake':
r = build_board_cmake(b, toolchain)
total_result[0] += r[0]
total_result[1] += r[1]
total_result[2] += r[2]
elif build_system == 'make':
all_examples = get_examples(find_family(b))
with Pool(processes=os.cpu_count()) as pool:
pool_args = list((map(lambda e, bb=b, o=f"TOOLCHAIN={toolchain}": [e, bb, o], all_examples)))
r = pool.starmap(build_utils.build_example, pool_args)
# sum all element of same index (column sum)
rsum = list(map(sum, list(zip(*r))))
total_result[0] += rsum[0]
total_result[1] += rsum[1]
total_result[2] += rsum[2]
total_time = time.monotonic() - total_time
print(build_separator)