[action] add the yml file support
This commit is contained in:
parent
ee052245d3
commit
96165a5e99
|
@ -390,7 +390,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@main
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
devices.gpio:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_GPIO=y
|
||||||
|
scons_arg:
|
||||||
|
- '--strict'
|
||||||
|
devices.adc:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_SAADC=y
|
||||||
|
devices.flash:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_ON_CHIP_FLASH=y
|
||||||
|
devices.i2c:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_I2C=y
|
||||||
|
devices.spi:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_SPI=y
|
||||||
|
devices.uart:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_UART=y
|
||||||
|
devices.watchdog:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_WDT=y
|
||||||
|
devices.qspi_flash:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_QSPI_FLASH=y
|
||||||
|
devices.pwm:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_PWM=y
|
||||||
|
devices.rtc:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_ONCHIP_RTC=y
|
||||||
|
devices.hwtimer:
|
||||||
|
kconfig:
|
||||||
|
- CONFIG_BSP_USING_TIM=y
|
||||||
|
- CONFIG_BSP_USING_TIM0=y
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_SAADC=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_ON_CHIP_FLASH=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_GPIO=y
|
|
|
@ -1,2 +0,0 @@
|
||||||
CONFIG_BSP_USING_TIM=y
|
|
||||||
CONFIG_BSP_USING_TIM0=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_I2C=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_PWM=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_QSPI_FLASH=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_ONCHIP_RTC=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_SPI=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_UART=y
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_BSP_USING_WDT=y
|
|
|
@ -2,7 +2,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
import yaml
|
||||||
|
|
||||||
def add_summary(text):
|
def add_summary(text):
|
||||||
"""
|
"""
|
||||||
|
@ -159,13 +159,50 @@ if __name__ == "__main__":
|
||||||
add_summary(f'- ✅ build {bsp} success.')
|
add_summary(f'- ✅ build {bsp} success.')
|
||||||
print("::endgroup::")
|
print("::endgroup::")
|
||||||
|
|
||||||
|
yml_files_content = []
|
||||||
|
directory = os.path.join(rtt_root, 'bsp', bsp, '.ci/attachconfig')
|
||||||
|
if os.path.exists(directory):
|
||||||
|
for filename in os.listdir(directory):
|
||||||
|
if filename.endswith('attachconfig.yml'):
|
||||||
|
file_path = os.path.join(directory, filename)
|
||||||
|
if os.path.exists(file_path):
|
||||||
|
with open(file_path, 'r') as file:
|
||||||
|
content = yaml.safe_load(file)
|
||||||
|
yml_files_content.append(content)
|
||||||
|
|
||||||
|
config_file = os.path.join(rtt_root, 'bsp', bsp, '.config')
|
||||||
|
|
||||||
|
for projects in yml_files_content:
|
||||||
|
for name, details in projects.items():
|
||||||
|
count += 1
|
||||||
|
config_bacakup = config_file+'.origin'
|
||||||
|
shutil.copyfile(config_file, config_bacakup)
|
||||||
|
with open(config_file, 'a') as destination:
|
||||||
|
for line in details.get('kconfig'):
|
||||||
|
destination.write(line + '\n')
|
||||||
|
scons_arg = details.get('scons_arg')
|
||||||
|
scons_arg_str = scons_arg[0] if scons_arg else ' '
|
||||||
|
print(f"::group::\tCompiling yml project: =={count}==={name}=scons_arg={scons_arg_str}==")
|
||||||
|
res = build_bsp(bsp, scons_arg_str)
|
||||||
|
if not res:
|
||||||
|
print(f"::error::build {bsp} {name} failed.")
|
||||||
|
add_summary(f'\t- ❌ build {bsp} {name} failed.')
|
||||||
|
failed += 1
|
||||||
|
else:
|
||||||
|
add_summary(f'\t- ✅ build {bsp} {name} success.')
|
||||||
|
print("::endgroup::")
|
||||||
|
|
||||||
|
shutil.copyfile(config_bacakup, config_file)
|
||||||
|
os.remove(config_bacakup)
|
||||||
|
|
||||||
attach_dir = os.path.join(rtt_root, 'bsp', bsp, '.ci/attachconfig')
|
attach_dir = os.path.join(rtt_root, 'bsp', bsp, '.ci/attachconfig')
|
||||||
attach_list = []
|
attach_list = []
|
||||||
for root, dirs, files in os.walk(attach_dir):
|
for root, dirs, files in os.walk(attach_dir):
|
||||||
for file in files:
|
for file in files:
|
||||||
file_path = os.path.join(root, file)
|
if file.endswith('attach'):
|
||||||
relative_path = os.path.relpath(file_path, attach_dir)
|
file_path = os.path.join(root, file)
|
||||||
attach_list.append(relative_path)
|
relative_path = os.path.relpath(file_path, attach_dir)
|
||||||
|
attach_list.append(relative_path)
|
||||||
|
|
||||||
for attach_file in attach_list:
|
for attach_file in attach_list:
|
||||||
count += 1
|
count += 1
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
pyyaml
|
||||||
|
pandas
|
Loading…
Reference in New Issue